diff options
Diffstat (limited to 'src/main/java/ftbsc')
-rw-r--r-- | src/main/java/ftbsc/bscv/BoSCoVicino.java | 3 | ||||
-rw-r--r-- | src/main/java/ftbsc/bscv/events/PacketEvent.java | 6 | ||||
-rw-r--r-- | src/main/java/ftbsc/bscv/patches/PacketPatch.java | 33 |
3 files changed, 12 insertions, 30 deletions
diff --git a/src/main/java/ftbsc/bscv/BoSCoVicino.java b/src/main/java/ftbsc/bscv/BoSCoVicino.java index 8290741..5ea29b1 100644 --- a/src/main/java/ftbsc/bscv/BoSCoVicino.java +++ b/src/main/java/ftbsc/bscv/BoSCoVicino.java @@ -29,7 +29,6 @@ import java.util.List; import ftbsc.bscv.module.Module; import ftbsc.bscv.module.vision.*; -import ftbsc.bscv.patches.PacketPatch; import ftbsc.bscv.module.motion.*; import ftbsc.bscv.module.self.*; import ftbsc.bscv.module.hud.*; @@ -62,8 +61,6 @@ public class BoSCoVicino { ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder(); - PacketPatch.PacketHook hook = PacketPatch.PacketHook.packetHook(); // make sure Forge doesn't strip this - // TODO also push! // modules cannot easily pop from their builder, but here we can't easily get // the module name yet. We should push and pop the builder ourselves and not diff --git a/src/main/java/ftbsc/bscv/events/PacketEvent.java b/src/main/java/ftbsc/bscv/events/PacketEvent.java index 7c2e431..67808fd 100644 --- a/src/main/java/ftbsc/bscv/events/PacketEvent.java +++ b/src/main/java/ftbsc/bscv/events/PacketEvent.java @@ -10,15 +10,9 @@ public class PacketEvent extends Event { public IPacket<?> packet; public boolean outgoing; - public boolean canceled; public PacketEvent(IPacket<?> pkt, boolean outgoing) { this.packet = pkt; - this.canceled = false; this.outgoing = outgoing; } - - public void cancel() { - this.canceled = true; - } } diff --git a/src/main/java/ftbsc/bscv/patches/PacketPatch.java b/src/main/java/ftbsc/bscv/patches/PacketPatch.java index 786f900..4c7292d 100644 --- a/src/main/java/ftbsc/bscv/patches/PacketPatch.java +++ b/src/main/java/ftbsc/bscv/patches/PacketPatch.java @@ -13,7 +13,6 @@ import org.objectweb.asm.tree.MethodInsnNode; import org.objectweb.asm.tree.MethodNode; import org.objectweb.asm.tree.VarInsnNode; -import ftbsc.bscv.BoSCoVicino; import ftbsc.bscv.events.PacketEvent; import ftbsc.lll.IInjector; import ftbsc.lll.tools.DescriptorBuilder; @@ -23,20 +22,12 @@ import ftbsc.lll.tools.PatternMatcher; public class PacketPatch { public static class PacketHook { - private static final PacketHook INSTANCE = new PacketHook(); - - public static PacketHook packetHook() { - return PacketHook.INSTANCE; - } - - public static void pktIn(IPacket<?> pkt) { - BoSCoVicino.LOGGER.info("<[pkt] {}", pkt); - MinecraftForge.EVENT_BUS.post(new PacketEvent(pkt, false)); // return post() + public static boolean pktIn(IPacket<?> pkt) { + return MinecraftForge.EVENT_BUS.post(new PacketEvent(pkt, false)); } - public static void pktOut(IPacket<?> pkt) { - BoSCoVicino.LOGGER.info("[pkt]> {}", pkt); - MinecraftForge.EVENT_BUS.post(new PacketEvent(pkt, true)); // return post() + public static boolean pktOut(IPacket<?> pkt) { + return MinecraftForge.EVENT_BUS.post(new PacketEvent(pkt, true)); } } @@ -72,11 +63,11 @@ public class PacketPatch { INVOKESTATIC, "ftbsc/bscv/patches/PacketPatch$PacketHook", "pktIn", - "(Lnet/minecraft/network/IPacket;)V" // Z for bool return + "(Lnet/minecraft/network/IPacket;)Z" )); - // is.add(new JumpInsnNode(IFEQ, skip)); - // is.add(new InsnNode(RET)); - // is.add(skip); + is.add(new JumpInsnNode(IFEQ, skip)); + is.add(new InsnNode(RETURN)); + is.add(skip); main.instructions.insert(found, is); } @@ -105,11 +96,11 @@ public class PacketPatch { INVOKESTATIC, "ftbsc/bscv/patches/PacketPatch$PacketHook", "pktOut", - "(Lnet/minecraft/network/IPacket;)V" // Z for bool return + "(Lnet/minecraft/network/IPacket;)Z" )); - // is.add(new JumpInsnNode(IFEQ, skip)); - // is.add(new InsnNode(RET)); - // is.add(skip); + is.add(new JumpInsnNode(IFEQ, skip)); + is.add(new InsnNode(RETURN)); + is.add(skip); main.instructions.insert(is); } |