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: 'java'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: "com.palantir.git-version"
|
||||
|
@ -89,7 +90,11 @@ sourceSets.main.resources { srcDir 'src/generated/resources' }
|
|||
|
||||
dependencies {
|
||||
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 {
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
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.item.BoatEntity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
@ -36,14 +40,13 @@ public class BoatPatch {
|
|||
}
|
||||
}
|
||||
|
||||
public static class BoatControlOverride implements IInjector, Opcodes {
|
||||
public String name() { return "BoatControlOverride"; }
|
||||
public String reason() { return "add hook to cancel vanilla boat controls"; }
|
||||
public String targetClass() { return "net.minecraft.entity.item.BoatEntity"; }
|
||||
public String methodName() { return "func_184443_x"; } // void controlBoat()
|
||||
public String methodDesc() { return "()V"; }
|
||||
@Patch(value = BoatEntity.class, reason = "add hook to cancel vanilla boat controls")
|
||||
public abstract static class BoatControlOverride implements Opcodes {
|
||||
@Target
|
||||
public abstract void controlBoat();
|
||||
|
||||
public void inject(ClassNode clazz, MethodNode main) {
|
||||
@Injector
|
||||
public static void inject(ClassNode clazz, MethodNode main) {
|
||||
// Hook at method start
|
||||
LabelNode skip = new LabelNode();
|
||||
InsnSequence is = new InsnSequence();
|
||||
|
@ -61,14 +64,13 @@ public class BoatPatch {
|
|||
}
|
||||
}
|
||||
|
||||
public static class BoatClampOverride implements IInjector, Opcodes {
|
||||
public String name() { return "BoatClampOverride"; }
|
||||
public String reason() { return "add hook to cancel vanilla boat rotation clamping"; }
|
||||
public String targetClass() { return "net.minecraft.entity.item.BoatEntity"; }
|
||||
public String methodName() { return "func_184454_a"; } // void clampRotation(Entity e)
|
||||
public String methodDesc() { return "(Lnet/minecraft/entity/Entity;)V"; }
|
||||
@Patch(value = BoatEntity.class, reason = "add hook to cancel vanilla boat rotation clamping")
|
||||
public abstract static class BoatClampOverride implements Opcodes {
|
||||
@Target
|
||||
public abstract void clampRotation(Entity e);
|
||||
|
||||
public void inject(ClassNode clazz, MethodNode main) {
|
||||
@Injector
|
||||
public static void inject(ClassNode clazz, MethodNode main) {
|
||||
// Hook at method start
|
||||
LabelNode skip = new LabelNode();
|
||||
InsnSequence is = new InsnSequence();
|
||||
|
@ -86,14 +88,13 @@ public class BoatPatch {
|
|||
}
|
||||
}
|
||||
|
||||
public static class BoatGravityOverride implements IInjector, Opcodes {
|
||||
public String name() { return "BoatGravityOverride"; }
|
||||
public String reason() { return "add hook to alter vanilla boat gravity"; }
|
||||
public String targetClass() { return "net.minecraft.entity.Entity"; }
|
||||
public String methodName() { return "func_189652_ae"; } // boolean isNoGravity()
|
||||
public String methodDesc() { return "()Z"; }
|
||||
@Patch(value = Entity.class, reason = "add hook to alter vanilla boat gravity")
|
||||
public abstract static class BoatGravityOverride implements Opcodes {
|
||||
@Target
|
||||
public abstract boolean isNoGravity();
|
||||
|
||||
public void inject(ClassNode clazz, MethodNode main) {
|
||||
@Injector
|
||||
public static void inject(ClassNode clazz, MethodNode main) {
|
||||
// Hook at method start
|
||||
LabelNode skip = new LabelNode();
|
||||
InsnSequence is = new InsnSequence();
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
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.NetworkManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
@ -31,21 +37,14 @@ public class PacketPatch {
|
|||
}
|
||||
}
|
||||
|
||||
public static class IncomingPacketInterceptor implements IInjector, Opcodes {
|
||||
public String name() { return "IncomingPacketInterceptor"; }
|
||||
public String reason() { return "add hook to intercept and alter/cancel incoming packets"; }
|
||||
public String targetClass() { return "net.minecraft.network.NetworkManager"; }
|
||||
public String methodName() { return "channelRead0"; }
|
||||
public String methodDesc() {
|
||||
return
|
||||
new DescriptorBuilder()
|
||||
.setReturnType(void.class)
|
||||
.addParameter("io.netty.channel.ChannelHandlerContext")
|
||||
.addParameter("net.minecraft.network.IPacket")
|
||||
.build();
|
||||
}
|
||||
@Patch(value = NetworkManager.class, reason = "add hook to intercept and alter/cancel incoming packets")
|
||||
public abstract static class IncomingPacketInterceptor implements Opcodes {
|
||||
@Target
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract void channelRead0(ChannelHandlerContext ctx, IPacket pak);
|
||||
|
||||
public void inject(ClassNode clazz, MethodNode main) {
|
||||
@Injector
|
||||
public static void inject(ClassNode clazz, MethodNode main) {
|
||||
// ALOAD, GETFIELD, INVOKEINTERFACE, IFEQ
|
||||
AbstractInsnNode found = PatternMatcher.builder()
|
||||
.opcodes(ALOAD, GETFIELD, INVOKEINTERFACE, IFEQ)
|
||||
|
@ -73,21 +72,14 @@ public class PacketPatch {
|
|||
}
|
||||
}
|
||||
|
||||
public static class OutgoingPacketInterceptor implements IInjector, Opcodes {
|
||||
public String name() { return "OutgoingPacketInterceptor"; }
|
||||
public String reason() { return "add hook to intercept and alter/cancel outgoing packets"; }
|
||||
public String targetClass() { return "net.minecraft.network.NetworkManager"; }
|
||||
public String methodName() { return "func_150732_b"; }
|
||||
public String methodDesc() {
|
||||
return
|
||||
new DescriptorBuilder()
|
||||
.setReturnType(void.class)
|
||||
.addParameter("net.minecraft.network.IPacket")
|
||||
.addParameter("io.netty.util.concurrent.GenericFutureListener")
|
||||
.build();
|
||||
}
|
||||
@Patch(value = NetworkManager.class, reason = "add hook to intercept and alter/cancel outgoing packets")
|
||||
public abstract static class OutgoingPacketInterceptor implements Opcodes {
|
||||
@Target
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract void sendPacket(IPacket pak, GenericFutureListener gfl);
|
||||
|
||||
public void inject(ClassNode clazz, MethodNode main) {
|
||||
@Injector
|
||||
public static void inject(ClassNode clazz, MethodNode main) {
|
||||
// hook at the top
|
||||
LabelNode skip = new LabelNode();
|
||||
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