summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/ftbsc/bscv/patches/BackgroundPatch.java20
-rw-r--r--src/main/java/ftbsc/bscv/patches/BlockPushPatch.java19
-rw-r--r--src/main/java/ftbsc/bscv/patches/BoatPatch.java53
-rw-r--r--src/main/java/ftbsc/bscv/patches/ChatPatch.java8
-rw-r--r--src/main/java/ftbsc/bscv/patches/CommandsPatch.java22
-rw-r--r--src/main/java/ftbsc/bscv/patches/EntityPushPatch.java19
-rw-r--r--src/main/java/ftbsc/bscv/patches/LiquidPushPatch.java19
-rw-r--r--src/main/java/ftbsc/bscv/patches/NoSlowPatch.java19
-rw-r--r--src/main/java/ftbsc/bscv/patches/PacketPatch.java39
-rw-r--r--src/main/java/ftbsc/bscv/patches/PortalGuiPatch.java6
10 files changed, 129 insertions, 95 deletions
diff --git a/src/main/java/ftbsc/bscv/patches/BackgroundPatch.java b/src/main/java/ftbsc/bscv/patches/BackgroundPatch.java
index 5a5a8a7..c60ff0f 100644
--- a/src/main/java/ftbsc/bscv/patches/BackgroundPatch.java
+++ b/src/main/java/ftbsc/bscv/patches/BackgroundPatch.java
@@ -5,7 +5,7 @@ import ftbsc.lll.processor.annotations.Find;
import ftbsc.lll.processor.annotations.Injector;
import ftbsc.lll.processor.annotations.Patch;
import ftbsc.lll.processor.annotations.Target;
-import ftbsc.lll.proxies.MethodProxy;
+import ftbsc.lll.proxies.impl.MethodProxy;
import ftbsc.lll.tools.InsnSequence;
import ftbsc.lll.tools.PatternMatcher;
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
@@ -34,15 +34,19 @@ public class BackgroundPatch implements ICommons {
}
}
- @Patch(value = Screen.class, reason = "add hook to cancel background on some screens")
+ @Patch(Screen.class)
public abstract static class BackgroundOverride implements Opcodes {
- @Find(parent = BackgroundPatch.class)
- abstract MethodProxy shouldDrawBackground();
- @Target
+ @Find(BackgroundPatch.class)
+ MethodProxy shouldDrawBackground;
+
+ @Target(of = "shouldDrawBackground")
+ abstract boolean shouldDrawBackground(Screen screen);
+
+ @Target(of = "injectCancelBackgroundHook")
abstract void renderBackground(MatrixStack stack, int x);
- @Injector
- public void inject(ClassNode clazz, MethodNode main) {
+ @Injector(reason = "add hook to cancel background on some screens")
+ public void injectCancelBackgroundHook(ClassNode clazz, MethodNode main) {
AbstractInsnNode found = PatternMatcher.builder()
.opcodes(ALOAD, ALOAD, ICONST_0, ICONST_0)
.ignoreFrames()
@@ -55,7 +59,7 @@ public class BackgroundPatch implements ICommons {
LabelNode skip = new LabelNode();
InsnSequence is = new InsnSequence();
is.add(new VarInsnNode(ALOAD, 0));
- is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldDrawBackground()));
+ is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldDrawBackground));
is.add(new JumpInsnNode(IFEQ, skip));
is.add(new InsnNode(RETURN));
is.add(skip);
diff --git a/src/main/java/ftbsc/bscv/patches/BlockPushPatch.java b/src/main/java/ftbsc/bscv/patches/BlockPushPatch.java
index 26745d5..b9d2075 100644
--- a/src/main/java/ftbsc/bscv/patches/BlockPushPatch.java
+++ b/src/main/java/ftbsc/bscv/patches/BlockPushPatch.java
@@ -4,7 +4,7 @@ import ftbsc.lll.processor.annotations.Find;
import ftbsc.lll.processor.annotations.Injector;
import ftbsc.lll.processor.annotations.Patch;
import ftbsc.lll.processor.annotations.Target;
-import ftbsc.lll.proxies.MethodProxy;
+import ftbsc.lll.proxies.impl.MethodProxy;
import ftbsc.lll.tools.InsnSequence;
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
import net.minecraft.client.entity.player.ClientPlayerEntity;
@@ -24,19 +24,22 @@ public class BlockPushPatch {
return MinecraftForge.EVENT_BUS.post(new PlayerBlockPushEvent());
}
- @Patch(value = ClientPlayerEntity.class, reason = "add hook to cancel block collisions")
+ @Patch(ClientPlayerEntity.class)
public abstract static class BlockCollisionsOverride implements Opcodes {
- @Find(parent = BlockPushPatch.class)
- abstract MethodProxy shouldCancelBlockCollisions();
+ @Find(BlockPushPatch.class)
+ MethodProxy shouldCancelBlockCollisions;
- @Target
+ @Target(of = "shouldCancelBlockCollisions")
+ abstract boolean shouldCancelBlockCollisions();
+
+ @Target(of = "injectCancelCollisionsHook")
abstract void moveTowardsClosestSpace(double x, double z);
- @Injector
- public void inject(ClassNode clazz, MethodNode main) {
+ @Injector(reason = "add hook to cancel block collisions")
+ public void injectCancelCollisionsHook(ClassNode clazz, MethodNode main) {
LabelNode skip = new LabelNode();
InsnSequence is = new InsnSequence();
- is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldCancelBlockCollisions()));
+ is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldCancelBlockCollisions));
is.add(new JumpInsnNode(IFEQ, skip));
is.add(new InsnNode(RETURN));
is.add(skip);
diff --git a/src/main/java/ftbsc/bscv/patches/BoatPatch.java b/src/main/java/ftbsc/bscv/patches/BoatPatch.java
index 7c35e9a..b8a31fe 100644
--- a/src/main/java/ftbsc/bscv/patches/BoatPatch.java
+++ b/src/main/java/ftbsc/bscv/patches/BoatPatch.java
@@ -5,7 +5,7 @@ import ftbsc.lll.processor.annotations.Find;
import ftbsc.lll.processor.annotations.Injector;
import ftbsc.lll.processor.annotations.Patch;
import ftbsc.lll.processor.annotations.Target;
-import ftbsc.lll.proxies.MethodProxy;
+import ftbsc.lll.proxies.impl.MethodProxy;
import ftbsc.lll.tools.InsnSequence;
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
import net.minecraft.entity.Entity;
@@ -45,20 +45,23 @@ public class BoatPatch implements ICommons {
return MinecraftForge.EVENT_BUS.post(new BoatEvent.Gravity());
}
- @Patch(value = BoatEntity.class, reason = "add hook to cancel vanilla boat controls")
+ @Patch(BoatEntity.class)
public abstract static class BoatControlOverride implements Opcodes {
- @Find(parent = BoatPatch.class)
- abstract MethodProxy boatControl();
+ @Find(BoatPatch.class)
+ MethodProxy boatControl;
- @Target
+ @Target(of = "boatControl")
+ abstract boolean boatControl();
+
+ @Target(of = "injectBoatControlHook")
public abstract void controlBoat();
- @Injector
- public void inject(ClassNode clazz, MethodNode main) {
+ @Injector(reason = "add hook to cancel vanilla boat controls")
+ public void injectBoatControlHook(ClassNode clazz, MethodNode main) {
// Hook at method start
LabelNode skip = new LabelNode();
InsnSequence is = new InsnSequence();
- is.add(new MethodProxyInsnNode(INVOKESTATIC, boatControl()));
+ is.add(new MethodProxyInsnNode(INVOKESTATIC, boatControl));
is.add(new JumpInsnNode(IFEQ, skip));
is.add(new InsnNode(RETURN));
is.add(skip);
@@ -67,20 +70,23 @@ public class BoatPatch implements ICommons {
}
}
- @Patch(value = BoatEntity.class, reason = "add hook to cancel vanilla boat rotation clamping")
+ @Patch(BoatEntity.class)
public abstract static class BoatClampOverride implements Opcodes {
- @Find(parent = BoatPatch.class)
- abstract MethodProxy boatClampRotation();
+ @Find(BoatPatch.class)
+ MethodProxy boatClampRotation;
+
+ @Target(of = "boatClampRotation")
+ abstract boolean boatClampRotation();
- @Target
+ @Target(of = "injectRotationClampingHook")
public abstract void clampRotation(Entity e);
- @Injector
- public void inject(ClassNode clazz, MethodNode main) {
+ @Injector(reason = "add hook to cancel vanilla boat rotation clamping")
+ public void injectRotationClampingHook(ClassNode clazz, MethodNode main) {
// Hook at method start
LabelNode skip = new LabelNode();
InsnSequence is = new InsnSequence();
- is.add(new MethodProxyInsnNode(INVOKESTATIC, boatClampRotation()));
+ is.add(new MethodProxyInsnNode(INVOKESTATIC, boatClampRotation));
is.add(new JumpInsnNode(IFEQ, skip));
is.add(new InsnNode(RETURN));
is.add(skip);
@@ -89,21 +95,24 @@ public class BoatPatch implements ICommons {
}
}
- @Patch(value = Entity.class, reason = "add hook to alter vanilla boat gravity")
+ @Patch(Entity.class)
public abstract static class BoatGravityOverride implements Opcodes {
- @Find(parent = BoatPatch.class)
- abstract MethodProxy boatGravityCheck();
+ @Find(BoatPatch.class)
+ MethodProxy boatGravityCheck;
+
+ @Target(of = "boatGravityCheck")
+ abstract boolean boatGravityCheck(Entity entity);
- @Target
+ @Target(of = "injectGravityHook")
public abstract boolean isNoGravity();
- @Injector
- public void inject(ClassNode clazz, MethodNode main) {
+ @Injector(reason = "add hook to alter vanilla boat gravity")
+ public void injectGravityHook(ClassNode clazz, MethodNode main) {
// Hook at method start
LabelNode skip = new LabelNode();
InsnSequence is = new InsnSequence();
is.add(new VarInsnNode(ALOAD, 0));
- is.add(new MethodProxyInsnNode(INVOKESTATIC, boatGravityCheck()));
+ is.add(new MethodProxyInsnNode(INVOKESTATIC, boatGravityCheck));
is.add(new JumpInsnNode(IFEQ, skip));
is.add(new InsnNode(ICONST_1));
is.add(new InsnNode(IRETURN));
diff --git a/src/main/java/ftbsc/bscv/patches/ChatPatch.java b/src/main/java/ftbsc/bscv/patches/ChatPatch.java
index 0441c28..a19bcd3 100644
--- a/src/main/java/ftbsc/bscv/patches/ChatPatch.java
+++ b/src/main/java/ftbsc/bscv/patches/ChatPatch.java
@@ -14,16 +14,16 @@ import org.objectweb.asm.tree.*;
public class ChatPatch {
- @Patch(value = Minecraft.class, reason = "add hook to prevent chat from being cleared")
+ @Patch(Minecraft.class)
public abstract static class ChatClearInterceptor implements Opcodes {
// TODO this should be optional
- @Target
+ @Target(of = "injectClearChatHook")
abstract void setScreen(Screen screen);
- @Injector
- public void inject(ClassNode clazz, MethodNode main) {
+ @Injector(reason = "skips chat clearing")
+ public void injectClearChatHook(ClassNode clazz, MethodNode main) {
InsnSequence match = PatternMatcher.builder()
.opcodes(ALOAD, GETFIELD, INVOKEVIRTUAL, ICONST_1, INVOKEVIRTUAL)
.ignoreLineNumbers()
diff --git a/src/main/java/ftbsc/bscv/patches/CommandsPatch.java b/src/main/java/ftbsc/bscv/patches/CommandsPatch.java
index d819cbd..a7474a0 100644
--- a/src/main/java/ftbsc/bscv/patches/CommandsPatch.java
+++ b/src/main/java/ftbsc/bscv/patches/CommandsPatch.java
@@ -4,7 +4,7 @@ import ftbsc.lll.processor.annotations.Find;
import ftbsc.lll.processor.annotations.Injector;
import ftbsc.lll.processor.annotations.Patch;
import ftbsc.lll.processor.annotations.Target;
-import ftbsc.lll.proxies.MethodProxy;
+import ftbsc.lll.proxies.impl.MethodProxy;
import ftbsc.lll.tools.InsnSequence;
import ftbsc.lll.tools.PatternMatcher;
import ftbsc.lll.tools.debug.BytecodePrinter;
@@ -34,17 +34,20 @@ public class CommandsPatch {
MinecraftForge.EVENT_BUS.post(new CommandsBuiltEvent(dispatcher));
}
- @Patch(value = ClientPlayNetHandler.class, reason = "add hook to insert our command suggestions")
+ @Patch(ClientPlayNetHandler.class)
public abstract static class CommandsDispatcherCatcher implements Opcodes {
- @Find(parent = CommandsPatch.class)
- abstract MethodProxy cmdBuilt();
+ @Find(CommandsPatch.class)
+ MethodProxy cmdBuilt;
- @Target
+
+ @Target(of = "cmdBuilt")
+ abstract void cmdBuilt(CommandDispatcher<CommandSource> dispatcher);
+
+ @Target(of = "injectCommandHandler")
abstract void handleCommands(SCommandListPacket pkt);
- @Injector
- public void inject(ClassNode clazz, MethodNode main) {
- BytecodePrinter.logAsmMethod(main, "pre.log");
+ @Injector(reason = "add hook to insert our command suggestions")
+ public void injectCommandHandler(ClassNode clazz, MethodNode main) {
AbstractInsnNode found = PatternMatcher.builder()
.opcodes(ALOAD, INVOKEVIRTUAL, INVOKESPECIAL)
.ignoreFrames()
@@ -56,10 +59,9 @@ public class CommandsPatch {
InsnSequence is = new InsnSequence();
is.add(new InsnNode(DUP));
- is.add(new MethodProxyInsnNode(INVOKESTATIC, cmdBuilt()));
+ is.add(new MethodProxyInsnNode(INVOKESTATIC, cmdBuilt));
main.instructions.insert(found, is);
- BytecodePrinter.logAsmMethod(main, "post.log");
}
}
}
diff --git a/src/main/java/ftbsc/bscv/patches/EntityPushPatch.java b/src/main/java/ftbsc/bscv/patches/EntityPushPatch.java
index 9cf74bd..d425987 100644
--- a/src/main/java/ftbsc/bscv/patches/EntityPushPatch.java
+++ b/src/main/java/ftbsc/bscv/patches/EntityPushPatch.java
@@ -5,7 +5,7 @@ import ftbsc.lll.processor.annotations.Find;
import ftbsc.lll.processor.annotations.Injector;
import ftbsc.lll.processor.annotations.Patch;
import ftbsc.lll.processor.annotations.Target;
-import ftbsc.lll.proxies.MethodProxy;
+import ftbsc.lll.proxies.impl.MethodProxy;
import ftbsc.lll.tools.InsnSequence;
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
import net.minecraft.entity.Entity;
@@ -28,20 +28,23 @@ public class EntityPushPatch implements ICommons {
return false;
}
- @Patch(value = Entity.class, reason = "add hook to cancel entity collisions")
+ @Patch(Entity.class)
public abstract static class EntityCollisionsOverride implements Opcodes {
- @Find(parent = EntityPushPatch.class)
- abstract MethodProxy shouldCancelEntityCollisions();
+ @Find(EntityPushPatch.class)
+ MethodProxy shouldCancelEntityCollisions;
- @Target
+ @Target(of = "shouldCancelEntityCollisions")
+ abstract boolean shouldCancelEntityCollisions(Entity e);
+
+ @Target(of = "injectEntityCollisionHook")
abstract void push(double x, double y, double z);
- @Injector
- public void inject(ClassNode clazz, MethodNode main) {
+ @Injector(reason = "add hook to cancel entity collisions")
+ public void injectEntityCollisionHook(ClassNode clazz, MethodNode main) {
LabelNode skip = new LabelNode();
InsnSequence is = new InsnSequence();
is.add(new VarInsnNode(ALOAD, 0));
- is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldCancelEntityCollisions()));
+ is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldCancelEntityCollisions));
is.add(new JumpInsnNode(IFEQ, skip));
is.add(new InsnNode(RETURN));
is.add(skip);
diff --git a/src/main/java/ftbsc/bscv/patches/LiquidPushPatch.java b/src/main/java/ftbsc/bscv/patches/LiquidPushPatch.java
index a800878..af8ccc1 100644
--- a/src/main/java/ftbsc/bscv/patches/LiquidPushPatch.java
+++ b/src/main/java/ftbsc/bscv/patches/LiquidPushPatch.java
@@ -5,7 +5,7 @@ import ftbsc.lll.processor.annotations.Find;
import ftbsc.lll.processor.annotations.Injector;
import ftbsc.lll.processor.annotations.Patch;
import ftbsc.lll.processor.annotations.Target;
-import ftbsc.lll.proxies.MethodProxy;
+import ftbsc.lll.proxies.impl.MethodProxy;
import ftbsc.lll.tools.InsnSequence;
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
import net.minecraft.entity.player.PlayerEntity;
@@ -28,20 +28,23 @@ public class LiquidPushPatch implements ICommons {
return false;
}
- @Patch(value = PlayerEntity.class, reason = "add hook to cancel liquid collisions")
+ @Patch(PlayerEntity.class)
public abstract static class LiquidCollisionsOverride implements Opcodes {
- @Find(parent = LiquidPushPatch.class)
- abstract MethodProxy shouldCancelLiquidCollisions();
+ @Find(LiquidPushPatch.class)
+ MethodProxy shouldCancelLiquidCollisions;
- @Target
+ @Target(of = "shouldCancelLiquidCollisions")
+ abstract boolean shouldCancelLiquidCollisions(PlayerEntity player);
+
+ @Target(of = "injectLiquidCollisionHook")
abstract boolean isPushedByFluid();
- @Injector
- public void inject(ClassNode clazz, MethodNode main) {
+ @Injector(reason = "add hook to cancel liquid collisions")
+ public void injectLiquidCollisionHook(ClassNode clazz, MethodNode main) {
LabelNode skip = new LabelNode();
InsnSequence is = new InsnSequence();
is.add(new VarInsnNode(ALOAD, 0));
- is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldCancelLiquidCollisions()));
+ is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldCancelLiquidCollisions));
is.add(new JumpInsnNode(IFEQ, skip));
is.add(new InsnNode(ICONST_0));
is.add(new InsnNode(IRETURN));
diff --git a/src/main/java/ftbsc/bscv/patches/NoSlowPatch.java b/src/main/java/ftbsc/bscv/patches/NoSlowPatch.java
index c9ce730..f0e2c21 100644
--- a/src/main/java/ftbsc/bscv/patches/NoSlowPatch.java
+++ b/src/main/java/ftbsc/bscv/patches/NoSlowPatch.java
@@ -4,7 +4,7 @@ import ftbsc.lll.processor.annotations.Find;
import ftbsc.lll.processor.annotations.Injector;
import ftbsc.lll.processor.annotations.Patch;
import ftbsc.lll.processor.annotations.Target;
-import ftbsc.lll.proxies.MethodProxy;
+import ftbsc.lll.proxies.impl.MethodProxy;
import ftbsc.lll.tools.InsnSequence;
import ftbsc.lll.tools.PatternMatcher;
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
@@ -25,17 +25,20 @@ public class NoSlowPatch {
return MinecraftForge.EVENT_BUS.post(new PlayerSlowDownEvent());
}
- @Patch(value = ClientPlayerEntity.class, reason = "add hook to cancel slowing down effect of using items")
+ @Patch(ClientPlayerEntity.class)
public abstract static class SlowDownOverride implements Opcodes {
- @Find(parent = NoSlowPatch.class)
- abstract MethodProxy shouldSlowPlayer();
+ @Find(NoSlowPatch.class)
+ MethodProxy shouldSlowPlayer;
- @Target
+ @Target(of = "shouldSlowPlayer")
+ abstract boolean shouldSlowPlayer();
+
+ @Target(of = "injectNoSlowHook")
abstract void aiStep();
- @Injector
- public void inject(ClassNode clazz, MethodNode main) {
+ @Injector(reason = "add hook to cancel slowing down effect of using items")
+ public void injectNoSlowHook(ClassNode clazz, MethodNode main) {
AbstractInsnNode found = PatternMatcher.builder()
.opcodes(ALOAD, INVOKEVIRTUAL, IFEQ, ALOAD, INVOKEVIRTUAL, IFNE)
.ignoreFrames()
@@ -56,7 +59,7 @@ public class NoSlowPatch {
LabelNode skip = new LabelNode(); // TODO can we get the label that the original IF is jumping to without adding one ourselves?
InsnSequence is = new InsnSequence();
- is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldSlowPlayer()));
+ is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldSlowPlayer));
is.add(new JumpInsnNode(IFNE, skip));
main.instructions.insert(found, is);
diff --git a/src/main/java/ftbsc/bscv/patches/PacketPatch.java b/src/main/java/ftbsc/bscv/patches/PacketPatch.java
index 603dd09..fbf5889 100644
--- a/src/main/java/ftbsc/bscv/patches/PacketPatch.java
+++ b/src/main/java/ftbsc/bscv/patches/PacketPatch.java
@@ -4,7 +4,7 @@ import ftbsc.lll.processor.annotations.Find;
import ftbsc.lll.processor.annotations.Injector;
import ftbsc.lll.processor.annotations.Patch;
import ftbsc.lll.processor.annotations.Target;
-import ftbsc.lll.proxies.MethodProxy;
+import ftbsc.lll.proxies.impl.MethodProxy;
import ftbsc.lll.tools.InsnSequence;
import ftbsc.lll.tools.PatternMatcher;
import ftbsc.lll.tools.debug.BytecodePrinter;
@@ -51,16 +51,19 @@ public class PacketPatch {
return MinecraftForge.EVENT_BUS.post(new PacketEvent.Outgoing(pkt));
}
- @Patch(value = NetworkManager.class, reason = "add hook to intercept and alter/cancel incoming packets")
+ @Patch(NetworkManager.class)
public abstract static class IncomingPacketInterceptor implements Opcodes {
- @Find(parent = PacketPatch.class)
- abstract MethodProxy pktIn();
+ @Find(PacketPatch.class)
+ MethodProxy pktIn;
- @Target
- public abstract void channelRead0(ChannelHandlerContext ctx, IPacket<?> pak);
+ @Target(of = "pktIn")
+ abstract boolean pktIn(IPacket<?> pkt);
- @Injector
- public void inject(ClassNode clazz, MethodNode main) {
+ @Target(of = "injectIncomingInterceptor")
+ abstract void channelRead0(ChannelHandlerContext ctx, IPacket<?> pak);
+
+ @Injector(reason = "add hook to intercept and alter/cancel incoming packets")
+ public void injectIncomingInterceptor(ClassNode clazz, MethodNode main) {
AbstractInsnNode found = PatternMatcher.builder()
.opcodes(ALOAD, GETFIELD, INVOKEINTERFACE, IFEQ)
.ignoreFrames()
@@ -73,7 +76,7 @@ public class PacketPatch {
LabelNode skip = new LabelNode();
InsnSequence is = new InsnSequence();
is.add(new VarInsnNode(ALOAD, 2));
- is.add(new MethodProxyInsnNode(INVOKESTATIC, pktIn()));
+ is.add(new MethodProxyInsnNode(INVOKESTATIC, pktIn));
is.add(new JumpInsnNode(IFEQ, skip));
is.add(new InsnNode(RETURN));
is.add(skip);
@@ -82,21 +85,25 @@ public class PacketPatch {
}
}
- @Patch(value = NetworkManager.class, reason = "add hook to intercept and alter/cancel outgoing packets")
+ @Patch(NetworkManager.class)
public abstract static class OutgoingPacketInterceptor implements Opcodes {
- @Find(parent = PacketPatch.class)
- abstract MethodProxy pktOut();
+ @Find(PacketPatch.class)
+ MethodProxy pktOut;
+
+ @Target(of = "pktOut")
+ abstract boolean pktOut(IPacket<?> pkt);
+
- @Target
+ @Target(of = "injectOutgoingInterceptor")
public abstract void sendPacket(IPacket<?> pak, GenericFutureListener<? extends Future<? super Void>> gfl);
- @Injector
- public void inject(ClassNode clazz, MethodNode main) {
+ @Injector(reason = "add hook to intercept and alter/cancel outgoing packets")
+ public void injectOutgoingInterceptor(ClassNode clazz, MethodNode main) {
// hook at the top
LabelNode skip = new LabelNode();
InsnSequence is = new InsnSequence();
is.add(new VarInsnNode(ALOAD, 1));
- is.add(new MethodProxyInsnNode(INVOKESTATIC, pktOut()));
+ is.add(new MethodProxyInsnNode(INVOKESTATIC, pktOut));
is.add(new JumpInsnNode(IFEQ, skip));
is.add(new InsnNode(RETURN));
is.add(skip);
diff --git a/src/main/java/ftbsc/bscv/patches/PortalGuiPatch.java b/src/main/java/ftbsc/bscv/patches/PortalGuiPatch.java
index 7a36e8e..0eaf858 100644
--- a/src/main/java/ftbsc/bscv/patches/PortalGuiPatch.java
+++ b/src/main/java/ftbsc/bscv/patches/PortalGuiPatch.java
@@ -13,12 +13,12 @@ import ftbsc.lll.processor.annotations.Target;
import ftbsc.lll.tools.PatternMatcher;
import net.minecraft.client.entity.player.ClientPlayerEntity;
-@Patch(value = ClientPlayerEntity.class, reason = "prevent minecraft from force closing guis when entering portals")
+@Patch(ClientPlayerEntity.class)
public abstract class PortalGuiPatch implements Opcodes {
- @Target
+ @Target(of = "inject")
abstract void handleNetherPortalClient();
- @Injector
+ @Injector(reason = "prevent minecraft from force closing guis when entering portals")
public void inject(ClassNode clazz, MethodNode main) {
LabelNode skip = new LabelNode();