diff --git a/common/src/main/java/traben/entity_texture_features/mixin/entity/block/MixinMobSpawnerBlockEntityRenderer.java b/common/src/main/java/traben/entity_texture_features/mixin/entity/block/MixinMobSpawnerBlockEntityRenderer.java deleted file mode 100644 index 95d537fb..00000000 --- a/common/src/main/java/traben/entity_texture_features/mixin/entity/block/MixinMobSpawnerBlockEntityRenderer.java +++ /dev/null @@ -1,30 +0,0 @@ -package traben.entity_texture_features.mixin.entity.block; - -import net.minecraft.block.entity.BellBlockEntity; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.MobSpawnerBlockEntityRenderer; -import net.minecraft.entity.Entity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyArg; - -import java.util.UUID; - -@Mixin(MobSpawnerBlockEntityRenderer.class) -public abstract class MixinMobSpawnerBlockEntityRenderer implements BlockEntityRenderer { - - @Unique - private static final UUID ETF$MOBSPAWNER_UUID = UUID.nameUUIDFromBytes(("MOB_SPAWNER").getBytes()); - - @ModifyArg(method = "render(FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/Entity;Lnet/minecraft/client/render/entity/EntityRenderDispatcher;DD)V", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/EntityRenderDispatcher;render(Lnet/minecraft/entity/Entity;DDDFFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V" - ), index = 0) - private static Entity etf$addUUID(Entity entity) { - entity.setUuid(ETF$MOBSPAWNER_UUID); - return entity; - - } -} - - diff --git a/common/src/main/java/traben/entity_texture_features/mixin/entity/block/MixinMobSpawnerLogic.java b/common/src/main/java/traben/entity_texture_features/mixin/entity/block/MixinMobSpawnerLogic.java new file mode 100644 index 00000000..fc134cc4 --- /dev/null +++ b/common/src/main/java/traben/entity_texture_features/mixin/entity/block/MixinMobSpawnerLogic.java @@ -0,0 +1,28 @@ +package traben.entity_texture_features.mixin.entity.block; + +import net.minecraft.block.spawner.MobSpawnerLogic; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.UUID; + +@Mixin(MobSpawnerLogic.class) +public abstract class MixinMobSpawnerLogic { + + + @Inject(method = "getRenderedEntity", + at = @At(value = "RETURN")) + private static void etf$stabiliseMobSpawnerUUID(World world, BlockPos pos, CallbackInfoReturnable cir) { + Entity entity = cir.getReturnValue(); + if(entity != null){ + entity.setUuid(new UUID(pos.asLong(), world.hashCode())); + } + } +} + + diff --git a/common/src/main/resources/entity_texture_features-common.mixins.json b/common/src/main/resources/entity_texture_features-common.mixins.json index c779b257..8248e7ce 100644 --- a/common/src/main/resources/entity_texture_features-common.mixins.json +++ b/common/src/main/resources/entity_texture_features-common.mixins.json @@ -16,7 +16,7 @@ "accessor.PlayerSkinProviderAccessor", "accessor.PlayerSkinTextureAccessor", "accessor.TooltipAccessor", - "entity.block.MixinMobSpawnerBlockEntityRenderer", + "entity.block.MixinMobSpawnerLogic", "entity.block.MixinSkullBlockEntityRenderer", "entity.misc.MixinBlazeEntity", "entity.misc.MixinBlockEntity",