chore: updated to lillero-processor 0.4, updated patches to new system
This commit is contained in:
parent
a1d538f299
commit
7119da1cc2
10 changed files with 80 additions and 72 deletions
|
@ -65,6 +65,10 @@ dependencies {
|
||||||
annotationProcessor libs.autoService
|
annotationProcessor libs.autoService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileJava { //mappings for lillero-processor
|
||||||
|
options.compilerArgs << '-AmappingsFile=https://data.fantabos.co/output.tsrg'
|
||||||
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
archiveFileName = "${jar.archiveBaseName.get()}-${shortVersion}.${jar.archiveExtension.get()}"
|
archiveFileName = "${jar.archiveBaseName.get()}-${shortVersion}.${jar.archiveExtension.get()}"
|
||||||
manifest {
|
manifest {
|
||||||
|
|
|
@ -5,7 +5,7 @@ minecraft = "1.16.5"
|
||||||
forge = "1.16.5-36.2.34"
|
forge = "1.16.5-36.2.34"
|
||||||
autoService = "1.0.1"
|
autoService = "1.0.1"
|
||||||
lillero = "0.3.4"
|
lillero = "0.3.4"
|
||||||
lilleroProcessor = "0.3.0"
|
lilleroProcessor = "0.4.2"
|
||||||
checkerFramework = "0.6.24"
|
checkerFramework = "0.6.24"
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package ftbsc.bscv.patches;
|
package ftbsc.bscv.patches;
|
||||||
|
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
|
import ftbsc.lll.processor.annotations.Find;
|
||||||
import ftbsc.lll.processor.annotations.Injector;
|
import ftbsc.lll.processor.annotations.Injector;
|
||||||
import ftbsc.lll.processor.annotations.Patch;
|
import ftbsc.lll.processor.annotations.Patch;
|
||||||
import ftbsc.lll.processor.annotations.Target;
|
import ftbsc.lll.processor.annotations.Target;
|
||||||
|
import ftbsc.lll.proxies.MethodProxy;
|
||||||
import ftbsc.lll.tools.InsnSequence;
|
import ftbsc.lll.tools.InsnSequence;
|
||||||
import ftbsc.lll.tools.PatternMatcher;
|
import ftbsc.lll.tools.PatternMatcher;
|
||||||
|
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.eventbus.api.Cancelable;
|
import net.minecraftforge.eventbus.api.Cancelable;
|
||||||
|
@ -33,6 +36,8 @@ public class BackgroundPatch implements ICommons {
|
||||||
|
|
||||||
@Patch(value = Screen.class, reason = "add hook to cancel background on some screens")
|
@Patch(value = Screen.class, reason = "add hook to cancel background on some screens")
|
||||||
public abstract static class BackgroundOverride implements Opcodes {
|
public abstract static class BackgroundOverride implements Opcodes {
|
||||||
|
@Find(parent = BackgroundPatch.class)
|
||||||
|
abstract MethodProxy shouldDrawBackground();
|
||||||
@Target
|
@Target
|
||||||
abstract void renderBackground(MatrixStack stack, int x);
|
abstract void renderBackground(MatrixStack stack, int x);
|
||||||
|
|
||||||
|
@ -50,12 +55,7 @@ public class BackgroundPatch implements ICommons {
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
is.add(new VarInsnNode(ALOAD, 0));
|
is.add(new VarInsnNode(ALOAD, 0));
|
||||||
is.add(new MethodInsnNode(
|
is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldDrawBackground()));
|
||||||
INVOKESTATIC,
|
|
||||||
"ftbsc/bscv/patches/BackgroundPatch",
|
|
||||||
"shouldDrawBackground",
|
|
||||||
"(Lnet/minecraft/client/gui/screen/Screen;)Z"
|
|
||||||
));
|
|
||||||
is.add(new JumpInsnNode(IFEQ, skip));
|
is.add(new JumpInsnNode(IFEQ, skip));
|
||||||
is.add(new InsnNode(RETURN));
|
is.add(new InsnNode(RETURN));
|
||||||
is.add(skip);
|
is.add(skip);
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package ftbsc.bscv.patches;
|
package ftbsc.bscv.patches;
|
||||||
|
|
||||||
|
import ftbsc.lll.processor.annotations.Find;
|
||||||
import ftbsc.lll.processor.annotations.Injector;
|
import ftbsc.lll.processor.annotations.Injector;
|
||||||
import ftbsc.lll.processor.annotations.Patch;
|
import ftbsc.lll.processor.annotations.Patch;
|
||||||
import ftbsc.lll.processor.annotations.Target;
|
import ftbsc.lll.processor.annotations.Target;
|
||||||
|
import ftbsc.lll.proxies.MethodProxy;
|
||||||
import ftbsc.lll.tools.InsnSequence;
|
import ftbsc.lll.tools.InsnSequence;
|
||||||
|
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
|
||||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.eventbus.api.Cancelable;
|
import net.minecraftforge.eventbus.api.Cancelable;
|
||||||
|
@ -23,6 +26,9 @@ public class BlockPushPatch {
|
||||||
|
|
||||||
@Patch(value = ClientPlayerEntity.class, reason = "add hook to cancel block collisions")
|
@Patch(value = ClientPlayerEntity.class, reason = "add hook to cancel block collisions")
|
||||||
public abstract static class BlockCollisionsOverride implements Opcodes {
|
public abstract static class BlockCollisionsOverride implements Opcodes {
|
||||||
|
@Find(parent = BlockPushPatch.class)
|
||||||
|
abstract MethodProxy shouldCancelBlockCollisions();
|
||||||
|
|
||||||
@Target
|
@Target
|
||||||
abstract void moveTowardsClosestSpace(double x, double z);
|
abstract void moveTowardsClosestSpace(double x, double z);
|
||||||
|
|
||||||
|
@ -30,12 +36,7 @@ public class BlockPushPatch {
|
||||||
public void inject(ClassNode clazz, MethodNode main) {
|
public void inject(ClassNode clazz, MethodNode main) {
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
is.add(new MethodInsnNode(
|
is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldCancelBlockCollisions()));
|
||||||
INVOKESTATIC,
|
|
||||||
"ftbsc/bscv/patches/BlockPushPatch",
|
|
||||||
"shouldCancelBlockCollisions",
|
|
||||||
"()Z"
|
|
||||||
));
|
|
||||||
is.add(new JumpInsnNode(IFEQ, skip));
|
is.add(new JumpInsnNode(IFEQ, skip));
|
||||||
is.add(new InsnNode(RETURN));
|
is.add(new InsnNode(RETURN));
|
||||||
is.add(skip);
|
is.add(skip);
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package ftbsc.bscv.patches;
|
package ftbsc.bscv.patches;
|
||||||
|
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
|
import ftbsc.lll.processor.annotations.Find;
|
||||||
import ftbsc.lll.processor.annotations.Injector;
|
import ftbsc.lll.processor.annotations.Injector;
|
||||||
import ftbsc.lll.processor.annotations.Patch;
|
import ftbsc.lll.processor.annotations.Patch;
|
||||||
import ftbsc.lll.processor.annotations.Target;
|
import ftbsc.lll.processor.annotations.Target;
|
||||||
|
import ftbsc.lll.proxies.MethodProxy;
|
||||||
import ftbsc.lll.tools.InsnSequence;
|
import ftbsc.lll.tools.InsnSequence;
|
||||||
|
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.item.BoatEntity;
|
import net.minecraft.entity.item.BoatEntity;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
@ -44,6 +47,9 @@ public class BoatPatch implements ICommons {
|
||||||
|
|
||||||
@Patch(value = BoatEntity.class, reason = "add hook to cancel vanilla boat controls")
|
@Patch(value = BoatEntity.class, reason = "add hook to cancel vanilla boat controls")
|
||||||
public abstract static class BoatControlOverride implements Opcodes {
|
public abstract static class BoatControlOverride implements Opcodes {
|
||||||
|
@Find(parent = BoatPatch.class)
|
||||||
|
abstract MethodProxy boatControl();
|
||||||
|
|
||||||
@Target
|
@Target
|
||||||
public abstract void controlBoat();
|
public abstract void controlBoat();
|
||||||
|
|
||||||
|
@ -52,12 +58,7 @@ public class BoatPatch implements ICommons {
|
||||||
// Hook at method start
|
// Hook at method start
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
is.add(new MethodInsnNode(
|
is.add(new MethodProxyInsnNode(INVOKESTATIC, boatControl()));
|
||||||
INVOKESTATIC,
|
|
||||||
"ftbsc/bscv/patches/BoatPatch",
|
|
||||||
"boatControl",
|
|
||||||
"()Z"
|
|
||||||
));
|
|
||||||
is.add(new JumpInsnNode(IFEQ, skip));
|
is.add(new JumpInsnNode(IFEQ, skip));
|
||||||
is.add(new InsnNode(RETURN));
|
is.add(new InsnNode(RETURN));
|
||||||
is.add(skip);
|
is.add(skip);
|
||||||
|
@ -68,6 +69,9 @@ public class BoatPatch implements ICommons {
|
||||||
|
|
||||||
@Patch(value = BoatEntity.class, reason = "add hook to cancel vanilla boat rotation clamping")
|
@Patch(value = BoatEntity.class, reason = "add hook to cancel vanilla boat rotation clamping")
|
||||||
public abstract static class BoatClampOverride implements Opcodes {
|
public abstract static class BoatClampOverride implements Opcodes {
|
||||||
|
@Find(parent = BoatPatch.class)
|
||||||
|
abstract MethodProxy boatClampRotation();
|
||||||
|
|
||||||
@Target
|
@Target
|
||||||
public abstract void clampRotation(Entity e);
|
public abstract void clampRotation(Entity e);
|
||||||
|
|
||||||
|
@ -76,12 +80,7 @@ public class BoatPatch implements ICommons {
|
||||||
// Hook at method start
|
// Hook at method start
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
is.add(new MethodInsnNode(
|
is.add(new MethodProxyInsnNode(INVOKESTATIC, boatClampRotation()));
|
||||||
INVOKESTATIC,
|
|
||||||
"ftbsc/bscv/patches/BoatPatch",
|
|
||||||
"boatClampRotation",
|
|
||||||
"()Z"
|
|
||||||
));
|
|
||||||
is.add(new JumpInsnNode(IFEQ, skip));
|
is.add(new JumpInsnNode(IFEQ, skip));
|
||||||
is.add(new InsnNode(RETURN));
|
is.add(new InsnNode(RETURN));
|
||||||
is.add(skip);
|
is.add(skip);
|
||||||
|
@ -92,6 +91,9 @@ public class BoatPatch implements ICommons {
|
||||||
|
|
||||||
@Patch(value = Entity.class, reason = "add hook to alter vanilla boat gravity")
|
@Patch(value = Entity.class, reason = "add hook to alter vanilla boat gravity")
|
||||||
public abstract static class BoatGravityOverride implements Opcodes {
|
public abstract static class BoatGravityOverride implements Opcodes {
|
||||||
|
@Find(parent = BoatPatch.class)
|
||||||
|
abstract MethodProxy boatGravityCheck();
|
||||||
|
|
||||||
@Target
|
@Target
|
||||||
public abstract boolean isNoGravity();
|
public abstract boolean isNoGravity();
|
||||||
|
|
||||||
|
@ -101,12 +103,7 @@ public class BoatPatch implements ICommons {
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
is.add(new VarInsnNode(ALOAD, 0));
|
is.add(new VarInsnNode(ALOAD, 0));
|
||||||
is.add(new MethodInsnNode(
|
is.add(new MethodProxyInsnNode(INVOKESTATIC, boatGravityCheck()));
|
||||||
INVOKESTATIC,
|
|
||||||
"ftbsc/bscv/patches/BoatPatch",
|
|
||||||
"boatGravityCheck",
|
|
||||||
"(Lnet/minecraft/entity/Entity;)Z"
|
|
||||||
));
|
|
||||||
is.add(new JumpInsnNode(IFEQ, skip));
|
is.add(new JumpInsnNode(IFEQ, skip));
|
||||||
is.add(new InsnNode(ICONST_1));
|
is.add(new InsnNode(ICONST_1));
|
||||||
is.add(new InsnNode(IRETURN));
|
is.add(new InsnNode(IRETURN));
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
package ftbsc.bscv.patches;
|
package ftbsc.bscv.patches;
|
||||||
|
|
||||||
|
import ftbsc.lll.processor.annotations.Find;
|
||||||
import ftbsc.lll.processor.annotations.Injector;
|
import ftbsc.lll.processor.annotations.Injector;
|
||||||
import ftbsc.lll.processor.annotations.Patch;
|
import ftbsc.lll.processor.annotations.Patch;
|
||||||
import ftbsc.lll.processor.annotations.Target;
|
import ftbsc.lll.processor.annotations.Target;
|
||||||
|
import ftbsc.lll.proxies.MethodProxy;
|
||||||
import ftbsc.lll.tools.InsnSequence;
|
import ftbsc.lll.tools.InsnSequence;
|
||||||
import ftbsc.lll.tools.PatternMatcher;
|
import ftbsc.lll.tools.PatternMatcher;
|
||||||
|
import ftbsc.lll.tools.debug.BytecodePrinter;
|
||||||
|
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
|
||||||
import net.minecraft.client.network.play.ClientPlayNetHandler;
|
import net.minecraft.client.network.play.ClientPlayNetHandler;
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import net.minecraft.network.play.server.SCommandListPacket;
|
import net.minecraft.network.play.server.SCommandListPacket;
|
||||||
|
@ -32,11 +36,15 @@ public class CommandsPatch {
|
||||||
|
|
||||||
@Patch(value = ClientPlayNetHandler.class, reason = "add hook to insert our command suggestions")
|
@Patch(value = ClientPlayNetHandler.class, reason = "add hook to insert our command suggestions")
|
||||||
public abstract static class CommandsDispatcherCatcher implements Opcodes {
|
public abstract static class CommandsDispatcherCatcher implements Opcodes {
|
||||||
|
@Find(parent = CommandsPatch.class)
|
||||||
|
abstract MethodProxy cmdBuilt();
|
||||||
|
|
||||||
@Target
|
@Target
|
||||||
abstract void handleCommands(SCommandListPacket pkt);
|
abstract void handleCommands(SCommandListPacket pkt);
|
||||||
|
|
||||||
@Injector
|
@Injector
|
||||||
public void inject(ClassNode clazz, MethodNode main) {
|
public void inject(ClassNode clazz, MethodNode main) {
|
||||||
|
BytecodePrinter.logAsmMethod(main, "pre.log");
|
||||||
AbstractInsnNode found = PatternMatcher.builder()
|
AbstractInsnNode found = PatternMatcher.builder()
|
||||||
.opcodes(ALOAD, INVOKEVIRTUAL, INVOKESPECIAL)
|
.opcodes(ALOAD, INVOKEVIRTUAL, INVOKESPECIAL)
|
||||||
.ignoreFrames()
|
.ignoreFrames()
|
||||||
|
@ -48,14 +56,10 @@ public class CommandsPatch {
|
||||||
|
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
is.add(new InsnNode(DUP));
|
is.add(new InsnNode(DUP));
|
||||||
is.add(new MethodInsnNode(
|
is.add(new MethodProxyInsnNode(INVOKESTATIC, cmdBuilt()));
|
||||||
INVOKESTATIC,
|
|
||||||
"ftbsc/bscv/patches/CommandsPatch",
|
|
||||||
"cmdBuilt",
|
|
||||||
"(Lcom/mojang/brigadier/CommandDispatcher;)V"
|
|
||||||
));
|
|
||||||
|
|
||||||
main.instructions.insert(found, is);
|
main.instructions.insert(found, is);
|
||||||
|
BytecodePrinter.logAsmMethod(main, "post.log");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package ftbsc.bscv.patches;
|
package ftbsc.bscv.patches;
|
||||||
|
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
|
import ftbsc.lll.processor.annotations.Find;
|
||||||
import ftbsc.lll.processor.annotations.Injector;
|
import ftbsc.lll.processor.annotations.Injector;
|
||||||
import ftbsc.lll.processor.annotations.Patch;
|
import ftbsc.lll.processor.annotations.Patch;
|
||||||
import ftbsc.lll.processor.annotations.Target;
|
import ftbsc.lll.processor.annotations.Target;
|
||||||
|
import ftbsc.lll.proxies.MethodProxy;
|
||||||
import ftbsc.lll.tools.InsnSequence;
|
import ftbsc.lll.tools.InsnSequence;
|
||||||
|
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.eventbus.api.Cancelable;
|
import net.minecraftforge.eventbus.api.Cancelable;
|
||||||
|
@ -27,6 +30,9 @@ public class EntityPushPatch implements ICommons {
|
||||||
|
|
||||||
@Patch(value = Entity.class, reason = "add hook to cancel entity collisions")
|
@Patch(value = Entity.class, reason = "add hook to cancel entity collisions")
|
||||||
public abstract static class EntityCollisionsOverride implements Opcodes {
|
public abstract static class EntityCollisionsOverride implements Opcodes {
|
||||||
|
@Find(parent = EntityPushPatch.class)
|
||||||
|
abstract MethodProxy shouldCancelEntityCollisions();
|
||||||
|
|
||||||
@Target
|
@Target
|
||||||
abstract void push(double x, double y, double z);
|
abstract void push(double x, double y, double z);
|
||||||
|
|
||||||
|
@ -35,12 +41,7 @@ public class EntityPushPatch implements ICommons {
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
is.add(new VarInsnNode(ALOAD, 0));
|
is.add(new VarInsnNode(ALOAD, 0));
|
||||||
is.add(new MethodInsnNode(
|
is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldCancelEntityCollisions()));
|
||||||
INVOKESTATIC,
|
|
||||||
"ftbsc/bscv/patches/EntityPushPatch",
|
|
||||||
"shouldCancelEntityCollisions",
|
|
||||||
"(Lnet/minecraft/entity/Entity;)Z"
|
|
||||||
));
|
|
||||||
is.add(new JumpInsnNode(IFEQ, skip));
|
is.add(new JumpInsnNode(IFEQ, skip));
|
||||||
is.add(new InsnNode(RETURN));
|
is.add(new InsnNode(RETURN));
|
||||||
is.add(skip);
|
is.add(skip);
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package ftbsc.bscv.patches;
|
package ftbsc.bscv.patches;
|
||||||
|
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
|
import ftbsc.lll.processor.annotations.Find;
|
||||||
import ftbsc.lll.processor.annotations.Injector;
|
import ftbsc.lll.processor.annotations.Injector;
|
||||||
import ftbsc.lll.processor.annotations.Patch;
|
import ftbsc.lll.processor.annotations.Patch;
|
||||||
import ftbsc.lll.processor.annotations.Target;
|
import ftbsc.lll.processor.annotations.Target;
|
||||||
|
import ftbsc.lll.proxies.MethodProxy;
|
||||||
import ftbsc.lll.tools.InsnSequence;
|
import ftbsc.lll.tools.InsnSequence;
|
||||||
|
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.eventbus.api.Cancelable;
|
import net.minecraftforge.eventbus.api.Cancelable;
|
||||||
|
@ -27,6 +30,9 @@ public class LiquidPushPatch implements ICommons {
|
||||||
|
|
||||||
@Patch(value = PlayerEntity.class, reason = "add hook to cancel liquid collisions")
|
@Patch(value = PlayerEntity.class, reason = "add hook to cancel liquid collisions")
|
||||||
public abstract static class LiquidCollisionsOverride implements Opcodes {
|
public abstract static class LiquidCollisionsOverride implements Opcodes {
|
||||||
|
@Find(parent = LiquidPushPatch.class)
|
||||||
|
abstract MethodProxy shouldCancelLiquidCollisions();
|
||||||
|
|
||||||
@Target
|
@Target
|
||||||
abstract boolean isPushedByFluid();
|
abstract boolean isPushedByFluid();
|
||||||
|
|
||||||
|
@ -35,12 +41,7 @@ public class LiquidPushPatch implements ICommons {
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
is.add(new VarInsnNode(ALOAD, 0));
|
is.add(new VarInsnNode(ALOAD, 0));
|
||||||
is.add(new MethodInsnNode(
|
is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldCancelLiquidCollisions()));
|
||||||
INVOKESTATIC,
|
|
||||||
"ftbsc/bscv/patches/LiquidPushPatch",
|
|
||||||
"shouldCancelLiquidCollisions",
|
|
||||||
"(Lnet/minecraft/entity/player/PlayerEntity;)Z"
|
|
||||||
));
|
|
||||||
is.add(new JumpInsnNode(IFEQ, skip));
|
is.add(new JumpInsnNode(IFEQ, skip));
|
||||||
is.add(new InsnNode(ICONST_0));
|
is.add(new InsnNode(ICONST_0));
|
||||||
is.add(new InsnNode(IRETURN));
|
is.add(new InsnNode(IRETURN));
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package ftbsc.bscv.patches;
|
package ftbsc.bscv.patches;
|
||||||
|
|
||||||
|
import ftbsc.lll.processor.annotations.Find;
|
||||||
import ftbsc.lll.processor.annotations.Injector;
|
import ftbsc.lll.processor.annotations.Injector;
|
||||||
import ftbsc.lll.processor.annotations.Patch;
|
import ftbsc.lll.processor.annotations.Patch;
|
||||||
import ftbsc.lll.processor.annotations.Target;
|
import ftbsc.lll.processor.annotations.Target;
|
||||||
|
import ftbsc.lll.proxies.MethodProxy;
|
||||||
import ftbsc.lll.tools.InsnSequence;
|
import ftbsc.lll.tools.InsnSequence;
|
||||||
import ftbsc.lll.tools.PatternMatcher;
|
import ftbsc.lll.tools.PatternMatcher;
|
||||||
|
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
|
||||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.eventbus.api.Cancelable;
|
import net.minecraftforge.eventbus.api.Cancelable;
|
||||||
|
@ -24,6 +27,10 @@ public class NoSlowPatch {
|
||||||
|
|
||||||
@Patch(value = ClientPlayerEntity.class, reason = "add hook to cancel slowing down effect of using items")
|
@Patch(value = ClientPlayerEntity.class, reason = "add hook to cancel slowing down effect of using items")
|
||||||
public abstract static class SlowDownOverride implements Opcodes {
|
public abstract static class SlowDownOverride implements Opcodes {
|
||||||
|
|
||||||
|
@Find(parent = NoSlowPatch.class)
|
||||||
|
abstract MethodProxy shouldSlowPlayer();
|
||||||
|
|
||||||
@Target
|
@Target
|
||||||
abstract void aiStep();
|
abstract void aiStep();
|
||||||
|
|
||||||
|
@ -49,12 +56,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?
|
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();
|
InsnSequence is = new InsnSequence();
|
||||||
is.add(new MethodInsnNode(
|
is.add(new MethodProxyInsnNode(INVOKESTATIC, shouldSlowPlayer()));
|
||||||
INVOKESTATIC,
|
|
||||||
"ftbsc/bscv/patches/NoSlowPatch",
|
|
||||||
"shouldSlowPlayer",
|
|
||||||
"()Z"
|
|
||||||
));
|
|
||||||
is.add(new JumpInsnNode(IFNE, skip));
|
is.add(new JumpInsnNode(IFNE, skip));
|
||||||
|
|
||||||
main.instructions.insert(found, is);
|
main.instructions.insert(found, is);
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
package ftbsc.bscv.patches;
|
package ftbsc.bscv.patches;
|
||||||
|
|
||||||
|
import ftbsc.lll.processor.annotations.Find;
|
||||||
import ftbsc.lll.processor.annotations.Injector;
|
import ftbsc.lll.processor.annotations.Injector;
|
||||||
import ftbsc.lll.processor.annotations.Patch;
|
import ftbsc.lll.processor.annotations.Patch;
|
||||||
import ftbsc.lll.processor.annotations.Target;
|
import ftbsc.lll.processor.annotations.Target;
|
||||||
|
import ftbsc.lll.proxies.MethodProxy;
|
||||||
import ftbsc.lll.tools.InsnSequence;
|
import ftbsc.lll.tools.InsnSequence;
|
||||||
import ftbsc.lll.tools.PatternMatcher;
|
import ftbsc.lll.tools.PatternMatcher;
|
||||||
|
import ftbsc.lll.tools.debug.BytecodePrinter;
|
||||||
|
import ftbsc.lll.tools.nodes.MethodProxyInsnNode;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.util.concurrent.Future;
|
||||||
import io.netty.util.concurrent.GenericFutureListener;
|
import io.netty.util.concurrent.GenericFutureListener;
|
||||||
import net.minecraft.network.IPacket;
|
import net.minecraft.network.IPacket;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
|
@ -48,13 +53,14 @@ public class PacketPatch {
|
||||||
|
|
||||||
@Patch(value = NetworkManager.class, reason = "add hook to intercept and alter/cancel incoming packets")
|
@Patch(value = NetworkManager.class, reason = "add hook to intercept and alter/cancel incoming packets")
|
||||||
public abstract static class IncomingPacketInterceptor implements Opcodes {
|
public abstract static class IncomingPacketInterceptor implements Opcodes {
|
||||||
|
@Find(parent = PacketPatch.class)
|
||||||
|
abstract MethodProxy pktIn();
|
||||||
|
|
||||||
@Target
|
@Target
|
||||||
@SuppressWarnings("rawtypes")
|
public abstract void channelRead0(ChannelHandlerContext ctx, IPacket<?> pak);
|
||||||
public abstract void channelRead0(ChannelHandlerContext ctx, IPacket pak);
|
|
||||||
|
|
||||||
@Injector
|
@Injector
|
||||||
public void inject(ClassNode clazz, MethodNode main) {
|
public void inject(ClassNode clazz, MethodNode main) {
|
||||||
// ALOAD, GETFIELD, INVOKEINTERFACE, IFEQ
|
|
||||||
AbstractInsnNode found = PatternMatcher.builder()
|
AbstractInsnNode found = PatternMatcher.builder()
|
||||||
.opcodes(ALOAD, GETFIELD, INVOKEINTERFACE, IFEQ)
|
.opcodes(ALOAD, GETFIELD, INVOKEINTERFACE, IFEQ)
|
||||||
.ignoreFrames()
|
.ignoreFrames()
|
||||||
|
@ -67,12 +73,7 @@ public class PacketPatch {
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
is.add(new VarInsnNode(ALOAD, 2));
|
is.add(new VarInsnNode(ALOAD, 2));
|
||||||
is.add(new MethodInsnNode(
|
is.add(new MethodProxyInsnNode(INVOKESTATIC, pktIn()));
|
||||||
INVOKESTATIC,
|
|
||||||
"ftbsc/bscv/patches/PacketPatch",
|
|
||||||
"pktIn",
|
|
||||||
"(Lnet/minecraft/network/IPacket;)Z"
|
|
||||||
));
|
|
||||||
is.add(new JumpInsnNode(IFEQ, skip));
|
is.add(new JumpInsnNode(IFEQ, skip));
|
||||||
is.add(new InsnNode(RETURN));
|
is.add(new InsnNode(RETURN));
|
||||||
is.add(skip);
|
is.add(skip);
|
||||||
|
@ -83,9 +84,11 @@ public class PacketPatch {
|
||||||
|
|
||||||
@Patch(value = NetworkManager.class, reason = "add hook to intercept and alter/cancel outgoing packets")
|
@Patch(value = NetworkManager.class, reason = "add hook to intercept and alter/cancel outgoing packets")
|
||||||
public abstract static class OutgoingPacketInterceptor implements Opcodes {
|
public abstract static class OutgoingPacketInterceptor implements Opcodes {
|
||||||
|
@Find(parent = PacketPatch.class)
|
||||||
|
abstract MethodProxy pktOut();
|
||||||
|
|
||||||
@Target
|
@Target
|
||||||
@SuppressWarnings("rawtypes")
|
public abstract void sendPacket(IPacket<?> pak, GenericFutureListener<? extends Future<? super Void>> gfl);
|
||||||
public abstract void sendPacket(IPacket pak, GenericFutureListener gfl);
|
|
||||||
|
|
||||||
@Injector
|
@Injector
|
||||||
public void inject(ClassNode clazz, MethodNode main) {
|
public void inject(ClassNode clazz, MethodNode main) {
|
||||||
|
@ -93,12 +96,7 @@ public class PacketPatch {
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
is.add(new VarInsnNode(ALOAD, 1));
|
is.add(new VarInsnNode(ALOAD, 1));
|
||||||
is.add(new MethodInsnNode(
|
is.add(new MethodProxyInsnNode(INVOKESTATIC, pktOut()));
|
||||||
INVOKESTATIC,
|
|
||||||
"ftbsc/bscv/patches/PacketPatch",
|
|
||||||
"pktOut",
|
|
||||||
"(Lnet/minecraft/network/IPacket;)Z"
|
|
||||||
));
|
|
||||||
is.add(new JumpInsnNode(IFEQ, skip));
|
is.add(new JumpInsnNode(IFEQ, skip));
|
||||||
is.add(new InsnNode(RETURN));
|
is.add(new InsnNode(RETURN));
|
||||||
is.add(skip);
|
is.add(skip);
|
||||||
|
|
Loading…
Reference in a new issue