Skip to content

Commit

Permalink
Don't try to resolve the choice type for modded entities. (#4165)
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 authored Oct 15, 2024
1 parent 6e4c084 commit 771b444
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.datafixers.DSL;
import com.mojang.datafixers.types.Type;
import org.jetbrains.annotations.Nullable;
Expand All @@ -35,6 +36,7 @@
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.registry.RegistryKey;
import net.minecraft.util.Identifier;

import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityType;
import net.fabricmc.fabric.impl.object.builder.FabricEntityTypeImpl;
Expand Down Expand Up @@ -88,8 +90,9 @@ private static <T extends MobEntity> EntityType<T> castMob(EntityType<?> type) {
}

@WrapOperation(method = "build", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Util;getChoiceType(Lcom/mojang/datafixers/DSL$TypeReference;Ljava/lang/String;)Lcom/mojang/datafixers/types/Type;"))
private @Nullable Type<?> allowNullId(DSL.TypeReference typeReference, String id, Operation<Type<?>> original) {
if (id == null) {
private @Nullable Type<?> allowNoModdedDatafixers(DSL.TypeReference typeReference, String id, Operation<Type<?>> original, @Local(argsOnly = true) RegistryKey<EntityType<?>> registryKey) {
if (!registryKey.getValue().getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) {
// Don't try to resolve the choice type for modded entities.
return null;
}

Expand Down

0 comments on commit 771b444

Please sign in to comment.