chore: converted patches to new system
This commit is contained in:
parent
385797718d
commit
de9f23e856
4 changed files with 52 additions and 59 deletions
|
@ -14,6 +14,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'net.minecraftforge.gradle'
|
apply plugin: 'net.minecraftforge.gradle'
|
||||||
|
apply plugin: 'java'
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: "com.palantir.git-version"
|
apply plugin: "com.palantir.git-version"
|
||||||
|
@ -89,7 +90,11 @@ sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}"
|
minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}"
|
||||||
implementation 'ftbsc:lll:0.1.2'
|
implementation 'ftbsc:lll:0.2.1'
|
||||||
|
implementation 'ftbsc.lll:processor:0.1.0'
|
||||||
|
annotationProcessor 'com.squareup:javapoet:1.13.0'
|
||||||
|
annotationProcessor 'ftbsc:lll:0.2.1'
|
||||||
|
annotationProcessor 'ftbsc.lll:processor:0.1.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package ftbsc.bscv.patches;
|
package ftbsc.bscv.patches;
|
||||||
|
|
||||||
|
import ftbsc.lll.processor.annotations.Injector;
|
||||||
|
import ftbsc.lll.processor.annotations.Patch;
|
||||||
|
import ftbsc.lll.processor.annotations.Target;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.item.BoatEntity;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
|
@ -36,14 +40,13 @@ public class BoatPatch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BoatControlOverride implements IInjector, Opcodes {
|
@Patch(value = BoatEntity.class, reason = "add hook to cancel vanilla boat controls")
|
||||||
public String name() { return "BoatControlOverride"; }
|
public abstract static class BoatControlOverride implements Opcodes {
|
||||||
public String reason() { return "add hook to cancel vanilla boat controls"; }
|
@Target
|
||||||
public String targetClass() { return "net.minecraft.entity.item.BoatEntity"; }
|
public abstract void controlBoat();
|
||||||
public String methodName() { return "func_184443_x"; } // void controlBoat()
|
|
||||||
public String methodDesc() { return "()V"; }
|
|
||||||
|
|
||||||
public void inject(ClassNode clazz, MethodNode main) {
|
@Injector
|
||||||
|
public static void inject(ClassNode clazz, MethodNode main) {
|
||||||
// Hook at method start
|
// Hook at method start
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
|
@ -61,14 +64,13 @@ public class BoatPatch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BoatClampOverride implements IInjector, Opcodes {
|
@Patch(value = BoatEntity.class, reason = "add hook to cancel vanilla boat rotation clamping")
|
||||||
public String name() { return "BoatClampOverride"; }
|
public abstract static class BoatClampOverride implements Opcodes {
|
||||||
public String reason() { return "add hook to cancel vanilla boat rotation clamping"; }
|
@Target
|
||||||
public String targetClass() { return "net.minecraft.entity.item.BoatEntity"; }
|
public abstract void clampRotation(Entity e);
|
||||||
public String methodName() { return "func_184454_a"; } // void clampRotation(Entity e)
|
|
||||||
public String methodDesc() { return "(Lnet/minecraft/entity/Entity;)V"; }
|
|
||||||
|
|
||||||
public void inject(ClassNode clazz, MethodNode main) {
|
@Injector
|
||||||
|
public static void inject(ClassNode clazz, MethodNode main) {
|
||||||
// Hook at method start
|
// Hook at method start
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
|
@ -86,14 +88,13 @@ public class BoatPatch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BoatGravityOverride implements IInjector, Opcodes {
|
@Patch(value = Entity.class, reason = "add hook to alter vanilla boat gravity")
|
||||||
public String name() { return "BoatGravityOverride"; }
|
public abstract static class BoatGravityOverride implements Opcodes {
|
||||||
public String reason() { return "add hook to alter vanilla boat gravity"; }
|
@Target
|
||||||
public String targetClass() { return "net.minecraft.entity.Entity"; }
|
public abstract boolean isNoGravity();
|
||||||
public String methodName() { return "func_189652_ae"; } // boolean isNoGravity()
|
|
||||||
public String methodDesc() { return "()Z"; }
|
|
||||||
|
|
||||||
public void inject(ClassNode clazz, MethodNode main) {
|
@Injector
|
||||||
|
public static void inject(ClassNode clazz, MethodNode main) {
|
||||||
// Hook at method start
|
// Hook at method start
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
package ftbsc.bscv.patches;
|
package ftbsc.bscv.patches;
|
||||||
|
|
||||||
|
import ftbsc.lll.processor.annotations.Injector;
|
||||||
|
import ftbsc.lll.processor.annotations.Patch;
|
||||||
|
import ftbsc.lll.processor.annotations.Target;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.util.concurrent.GenericFutureListener;
|
||||||
import net.minecraft.network.IPacket;
|
import net.minecraft.network.IPacket;
|
||||||
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
|
@ -31,21 +37,14 @@ public class PacketPatch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class IncomingPacketInterceptor implements IInjector, Opcodes {
|
@Patch(value = NetworkManager.class, reason = "add hook to intercept and alter/cancel incoming packets")
|
||||||
public String name() { return "IncomingPacketInterceptor"; }
|
public abstract static class IncomingPacketInterceptor implements Opcodes {
|
||||||
public String reason() { return "add hook to intercept and alter/cancel incoming packets"; }
|
@Target
|
||||||
public String targetClass() { return "net.minecraft.network.NetworkManager"; }
|
@SuppressWarnings("rawtypes")
|
||||||
public String methodName() { return "channelRead0"; }
|
public abstract void channelRead0(ChannelHandlerContext ctx, IPacket pak);
|
||||||
public String methodDesc() {
|
|
||||||
return
|
|
||||||
new DescriptorBuilder()
|
|
||||||
.setReturnType(void.class)
|
|
||||||
.addParameter("io.netty.channel.ChannelHandlerContext")
|
|
||||||
.addParameter("net.minecraft.network.IPacket")
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void inject(ClassNode clazz, MethodNode main) {
|
@Injector
|
||||||
|
public static void inject(ClassNode clazz, MethodNode main) {
|
||||||
// ALOAD, GETFIELD, INVOKEINTERFACE, IFEQ
|
// ALOAD, GETFIELD, INVOKEINTERFACE, IFEQ
|
||||||
AbstractInsnNode found = PatternMatcher.builder()
|
AbstractInsnNode found = PatternMatcher.builder()
|
||||||
.opcodes(ALOAD, GETFIELD, INVOKEINTERFACE, IFEQ)
|
.opcodes(ALOAD, GETFIELD, INVOKEINTERFACE, IFEQ)
|
||||||
|
@ -73,21 +72,14 @@ public class PacketPatch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class OutgoingPacketInterceptor implements IInjector, Opcodes {
|
@Patch(value = NetworkManager.class, reason = "add hook to intercept and alter/cancel outgoing packets")
|
||||||
public String name() { return "OutgoingPacketInterceptor"; }
|
public abstract static class OutgoingPacketInterceptor implements Opcodes {
|
||||||
public String reason() { return "add hook to intercept and alter/cancel outgoing packets"; }
|
@Target
|
||||||
public String targetClass() { return "net.minecraft.network.NetworkManager"; }
|
@SuppressWarnings("rawtypes")
|
||||||
public String methodName() { return "func_150732_b"; }
|
public abstract void sendPacket(IPacket pak, GenericFutureListener gfl);
|
||||||
public String methodDesc() {
|
|
||||||
return
|
|
||||||
new DescriptorBuilder()
|
|
||||||
.setReturnType(void.class)
|
|
||||||
.addParameter("net.minecraft.network.IPacket")
|
|
||||||
.addParameter("io.netty.util.concurrent.GenericFutureListener")
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void inject(ClassNode clazz, MethodNode main) {
|
@Injector
|
||||||
|
public static void inject(ClassNode clazz, MethodNode main) {
|
||||||
// hook at the top
|
// hook at the top
|
||||||
LabelNode skip = new LabelNode();
|
LabelNode skip = new LabelNode();
|
||||||
InsnSequence is = new InsnSequence();
|
InsnSequence is = new InsnSequence();
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
ftbsc.bscv.patches.PacketPatch$IncomingPacketInterceptor
|
|
||||||
ftbsc.bscv.patches.PacketPatch$OutgoingPacketInterceptor
|
|
||||||
ftbsc.bscv.patches.BoatPatch$BoatControlOverride
|
|
||||||
ftbsc.bscv.patches.BoatPatch$BoatClampOverride
|
|
||||||
ftbsc.bscv.patches.BoatPatch$BoatGravityOverride
|
|
Loading…
Reference in a new issue