From 7758d2139bf17e7e0676ed8cf699e188aa039268 Mon Sep 17 00:00:00 2001 From: UselessBullets <80850784+UselessBullets@users.noreply.github.com> Date: Sat, 9 Mar 2024 09:01:40 -0600 Subject: [PATCH] Fixed vanilla type casting bug --- gradle.properties | 2 +- .../mixin/mixins/PacketMobSpawnMixin.java | 20 +++++++++++++++++++ src/main/resources/halplibe.mixins.json | 3 ++- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 src/main/java/turniplabs/halplibe/mixin/mixins/PacketMobSpawnMixin.java diff --git a/gradle.properties b/gradle.properties index faf3c8a..886a6ed 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ bta_version=7.1-pre1a loader_version=0.14.19-babric.3-bta # Mod -mod_version=3.4.13 +mod_version=3.4.14 mod_group=turniplabs mod_name=halplibe diff --git a/src/main/java/turniplabs/halplibe/mixin/mixins/PacketMobSpawnMixin.java b/src/main/java/turniplabs/halplibe/mixin/mixins/PacketMobSpawnMixin.java new file mode 100644 index 0000000..32c10fa --- /dev/null +++ b/src/main/java/turniplabs/halplibe/mixin/mixins/PacketMobSpawnMixin.java @@ -0,0 +1,20 @@ +package turniplabs.halplibe.mixin.mixins; + +import net.minecraft.core.entity.EntityDispatcher; +import net.minecraft.core.entity.EntityLiving; +import net.minecraft.core.net.packet.Packet24MobSpawn; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = Packet24MobSpawn.class, remap = false) +public class PacketMobSpawnMixin { + @Shadow public short type; + + @Inject(method = "(Lnet/minecraft/core/entity/EntityLiving;)V", at = @At("TAIL")) + private void fixTypeValue(EntityLiving entityliving, CallbackInfo ci){ + this.type = (short) EntityDispatcher.getEntityID(entityliving); + } +} diff --git a/src/main/resources/halplibe.mixins.json b/src/main/resources/halplibe.mixins.json index ae3c131..083c3f6 100644 --- a/src/main/resources/halplibe.mixins.json +++ b/src/main/resources/halplibe.mixins.json @@ -23,6 +23,7 @@ "mixins.I18nMixin", "mixins.ItemJarMixin", "mixins.ItemStackJsonAdapterMixin", + "mixins.PacketMobSpawnMixin", "mixins.RegistryMixin", "mixins.TileEntityBlastFurnaceMixin", "mixins.TileEntityFurnaceMixin", @@ -38,9 +39,9 @@ "mixins.EntityClientPlayerMPMixin", "mixins.GuiIngameMenuMixin", "mixins.GuiRenderItemMixin", + "mixins.GuiTooltipMixin", "mixins.MinecraftMixin", "mixins.MobPageMixin", - "mixins.GuiTooltipMixin", "mixins.PlayerRendererMixin", "mixins.RenderEngineMixin", "mixins.RenderGlobalMixin",