From 771b444bdf1b8350b802fcd820f70b846ecab486 Mon Sep 17 00:00:00 2001
From: modmuss <modmuss50@gmail.com>
Date: Tue, 15 Oct 2024 13:20:38 +0100
Subject: [PATCH] Don't try to resolve the choice type for modded entities.
 (#4165)

---
 .../mixin/object/builder/EntityTypeBuilderMixin.java       | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/EntityTypeBuilderMixin.java b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/EntityTypeBuilderMixin.java
index 9c2265449..15be0c7fd 100644
--- a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/EntityTypeBuilderMixin.java
+++ b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/EntityTypeBuilderMixin.java
@@ -20,6 +20,7 @@ import java.util.Objects;
 
 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;
@@ -35,6 +36,7 @@ import net.minecraft.entity.EntityType;
 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;
@@ -88,8 +90,9 @@ public abstract class EntityTypeBuilderMixin<T extends Entity> implements Fabric
 	}
 
 	@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;
 		}