From a8f67b684de08e1e7fa751ca78a068a4e6400cd1 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Wed, 8 Feb 2023 16:53:49 +0900 Subject: - is it my fault that I'm getting kicked from pixel? => No, it's my apartment's fault Signed-off-by: syeyoung --- .../mod/events/listener/PacketInjector.java | 2 ++ .../mod/events/listener/PacketListener.java | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java index 676682ff..ca295afa 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java @@ -25,6 +25,8 @@ import kr.syeyoung.dungeonsguide.mod.events.impl.RawPacketReceivedEvent; import net.minecraft.client.Minecraft; import net.minecraft.network.Packet; import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.network.play.client.C0EPacketClickWindow; +import net.minecraft.network.play.client.C0FPacketConfirmTransaction; import net.minecraft.network.play.server.*; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketListener.java index 5ef43e8c..f84da51f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketListener.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketListener.java @@ -44,17 +44,21 @@ public class PacketListener { @SubscribeEvent public void onPacketReceive(RawPacketReceivedEvent event) { - Packet packet = event.packet; - if (skyblockStatus.isOnSkyblock() - && packet instanceof S04PacketEntityEquipment + try { + Packet packet = event.packet; + if (skyblockStatus.isOnSkyblock() + && packet instanceof S04PacketEntityEquipment && FeatureRegistry.FIX_SPIRIT_BOOTS.isEnabled()) { // Inventory packet name - S04PacketEntityEquipment packet2 = (S04PacketEntityEquipment) packet; - if (packet2.getEntityID() == Minecraft.getMinecraft().thePlayer.getEntityId()) { - packet2 = new S04PacketEntityEquipment(packet2.getEntityID(), packet2.getEquipmentSlot() + 1, packet2.getItemStack()); - packet = packet2; + S04PacketEntityEquipment packet2 = (S04PacketEntityEquipment) packet; + if (packet2.getEntityID() == Minecraft.getMinecraft().thePlayer.getEntityId()) { + packet2 = new S04PacketEntityEquipment(packet2.getEntityID(), packet2.getEquipmentSlot() + 1, packet2.getItemStack()); + packet = packet2; + } } + event.packet = packet; + } catch (Exception e) { + e.printStackTrace(); } - event.packet = packet; } @SubscribeEvent -- cgit