aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/handlers/PacketHandler.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-10-20 11:57:50 -0400
committerGitHub <noreply@github.com>2020-10-20 11:57:50 -0400
commit5c5ffdbd4379d4c5002cd42c297f90e631566006 (patch)
tree1f203e2c7506697efe5efc326d95567bd7e958a0 /src/main/java/me/Danker/handlers/PacketHandler.java
parent20b405f59dcd92df1b4c3cd5b9ac353652ef4405 (diff)
parent1635fe604e6ca2d32d96409165fcc298f1c5b067 (diff)
downloadSkyblockMod-5c5ffdbd4379d4c5002cd42c297f90e631566006.tar.gz
SkyblockMod-5c5ffdbd4379d4c5002cd42c297f90e631566006.tar.bz2
SkyblockMod-5c5ffdbd4379d4c5002cd42c297f90e631566006.zip
1.8v1.8
Merge pull request #22 from bowser0000/development
Diffstat (limited to 'src/main/java/me/Danker/handlers/PacketHandler.java')
-rw-r--r--src/main/java/me/Danker/handlers/PacketHandler.java31
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);
+ }
+
+}