diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-10-18 05:36:00 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-10-18 05:36:00 -0400 |
commit | 65f8c8ea13df8451583ef257976f761d13d35f1f (patch) | |
tree | fbf2ae9f75a8814a94f6f636c3fb88eb77e0c405 /src/main/java/me/Danker/handlers | |
parent | 3413ab538e830977206ec1b6bd95e5f6c334ebf1 (diff) | |
download | SkyblockMod-65f8c8ea13df8451583ef257976f761d13d35f1f.tar.gz SkyblockMod-65f8c8ea13df8451583ef257976f761d13d35f1f.tar.bz2 SkyblockMod-65f8c8ea13df8451583ef257976f761d13d35f1f.zip |
Add Spirit Boots fix
Experimental, could cause issues elsewhere. Uses reflection to modify packet equipmentSlot to correct values.
Credit to Cold tQ for the help.
Diffstat (limited to 'src/main/java/me/Danker/handlers')
-rw-r--r-- | src/main/java/me/Danker/handlers/PacketHandler.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/handlers/PacketHandler.java b/src/main/java/me/Danker/handlers/PacketHandler.java new file mode 100644 index 0000000..56bbc24 --- /dev/null +++ b/src/main/java/me/Danker/handlers/PacketHandler.java @@ -0,0 +1,31 @@ +package me.Danker.handlers; + +import java.lang.reflect.Field; + +import io.netty.channel.ChannelDuplexHandler; +import io.netty.channel.ChannelHandlerContext; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S04PacketEntityEquipment; + +public class PacketHandler extends ChannelDuplexHandler { + + public static boolean added = false; + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + if (Utils.inSkyblock && msg instanceof Packet && msg.getClass().getName().endsWith("S04PacketEntityEquipment")) { // Inventory packet name + S04PacketEntityEquipment packet = (S04PacketEntityEquipment) msg; + if (packet.getEntityID() == Minecraft.getMinecraft().thePlayer.getEntityId()) { + Field slot = packet.getClass().getDeclaredField("field_149392_b"); // equipmentSlot + slot.setAccessible(true); + slot.setInt(packet, slot.getInt(packet) + 1); + msg = packet; + } + } + + super.channelRead(ctx, msg); + } + +} |