chore: updated to 0.5.1, direct hook targeting

This commit is contained in:
zaaarf 2023-04-02 23:52:02 +02:00
parent d90f2ca4d9
commit 9c8a192866
No known key found for this signature in database
GPG key ID: 82240E075E31FA4C
9 changed files with 44 additions and 69 deletions

View file

@ -4,8 +4,8 @@ gitVersion = "0.13.0"
minecraft = "1.16.5" 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.4.0" lillero = "0.4.1"
lilleroProcessor = "0.5.0" lilleroProcessor = "0.5.1"
checkerFramework = "0.6.24" checkerFramework = "0.6.24"
[plugins] [plugins]

View file

@ -20,11 +20,6 @@ import org.objectweb.asm.tree.*;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
public class BackgroundPatch implements ICommons { public class BackgroundPatch implements ICommons {
public static boolean shouldDrawBackground(Screen screen) {
return MinecraftForge.EVENT_BUS.post(new RenderBackgroundEvent(screen));
}
@Cancelable @Cancelable
public static class RenderBackgroundEvent extends Event { public static class RenderBackgroundEvent extends Event {
public final Screen screen; public final Screen screen;
@ -40,7 +35,9 @@ public class BackgroundPatch implements ICommons {
MethodProxy shouldDrawBackground; MethodProxy shouldDrawBackground;
@Target(of = "shouldDrawBackground") @Target(of = "shouldDrawBackground")
abstract boolean shouldDrawBackground(Screen screen); public static boolean shouldDrawBackground(Screen screen) {
return MinecraftForge.EVENT_BUS.post(new RenderBackgroundEvent(screen));
}
@Target(of = "injectCancelBackgroundHook") @Target(of = "injectCancelBackgroundHook")
abstract void renderBackground(MatrixStack stack, int x); abstract void renderBackground(MatrixStack stack, int x);

View file

@ -20,17 +20,15 @@ public class BlockPushPatch {
@Cancelable @Cancelable
public static class PlayerBlockPushEvent extends Event {} public static class PlayerBlockPushEvent extends Event {}
public static boolean shouldCancelBlockCollisions() {
return MinecraftForge.EVENT_BUS.post(new PlayerBlockPushEvent());
}
@Patch(ClientPlayerEntity.class) @Patch(ClientPlayerEntity.class)
public abstract static class BlockCollisionsOverride implements Opcodes { public abstract static class BlockCollisionsOverride implements Opcodes {
@Find(BlockPushPatch.class) @Find(BlockPushPatch.class)
MethodProxy shouldCancelBlockCollisions; MethodProxy shouldCancelBlockCollisions;
@Target(of = "shouldCancelBlockCollisions") @Target(of = "shouldCancelBlockCollisions")
abstract boolean shouldCancelBlockCollisions(); public static boolean shouldCancelBlockCollisions() {
return MinecraftForge.EVENT_BUS.post(new PlayerBlockPushEvent());
}
@Target(of = "injectCancelCollisionsHook") @Target(of = "injectCancelCollisionsHook")
abstract void moveTowardsClosestSpace(double x, double z); abstract void moveTowardsClosestSpace(double x, double z);

View file

@ -30,28 +30,15 @@ public class BoatPatch implements ICommons {
public static class Gravity extends Event { } public static class Gravity extends Event { }
} }
public static boolean boatControl() {
return MinecraftForge.EVENT_BUS.post(new BoatEvent.Control());
}
public static boolean boatClampRotation() {
return MinecraftForge.EVENT_BUS.post(new BoatEvent.ClampRotation());
}
public static boolean boatGravityCheck(Entity entity) {
if (MC.player == null) return false;
if (MC.player.getVehicle() == null) return false;
if (MC.player.getVehicle() != entity) return false;
return MinecraftForge.EVENT_BUS.post(new BoatEvent.Gravity());
}
@Patch(BoatEntity.class) @Patch(BoatEntity.class)
public abstract static class BoatControlOverride implements Opcodes { public abstract static class BoatControlOverride implements Opcodes {
@Find(BoatPatch.class) @Find(BoatPatch.class)
MethodProxy boatControl; MethodProxy boatControl;
@Target(of = "boatControl") @Target(of = "boatControl")
abstract boolean boatControl(); public static boolean boatControl() {
return MinecraftForge.EVENT_BUS.post(new BoatEvent.Control());
}
@Target(of = "injectBoatControlHook") @Target(of = "injectBoatControlHook")
public abstract void controlBoat(); public abstract void controlBoat();
@ -76,7 +63,9 @@ public class BoatPatch implements ICommons {
MethodProxy boatClampRotation; MethodProxy boatClampRotation;
@Target(of = "boatClampRotation") @Target(of = "boatClampRotation")
abstract boolean boatClampRotation(); public static boolean boatClampRotation() {
return MinecraftForge.EVENT_BUS.post(new BoatEvent.ClampRotation());
}
@Target(of = "injectRotationClampingHook") @Target(of = "injectRotationClampingHook")
public abstract void clampRotation(Entity e); public abstract void clampRotation(Entity e);
@ -101,7 +90,12 @@ public class BoatPatch implements ICommons {
MethodProxy boatGravityCheck; MethodProxy boatGravityCheck;
@Target(of = "boatGravityCheck") @Target(of = "boatGravityCheck")
abstract boolean boatGravityCheck(Entity entity); public static boolean boatGravityCheck(Entity entity) {
if (MC.player == null) return false;
if (MC.player.getVehicle() == null) return false;
if (MC.player.getVehicle() != entity) return false;
return MinecraftForge.EVENT_BUS.post(new BoatEvent.Gravity());
}
@Target(of = "injectGravityHook") @Target(of = "injectGravityHook")
public abstract boolean isNoGravity(); public abstract boolean isNoGravity();

View file

@ -30,18 +30,15 @@ public class CommandsPatch {
} }
} }
public static void cmdBuilt(CommandDispatcher<CommandSource> dispatcher) {
MinecraftForge.EVENT_BUS.post(new CommandsBuiltEvent(dispatcher));
}
@Patch(ClientPlayNetHandler.class) @Patch(ClientPlayNetHandler.class)
public abstract static class CommandsDispatcherCatcher implements Opcodes { public abstract static class CommandsDispatcherCatcher implements Opcodes {
@Find(CommandsPatch.class) @Find(CommandsPatch.class)
MethodProxy cmdBuilt; MethodProxy cmdBuilt;
@Target(of = "cmdBuilt") @Target(of = "cmdBuilt")
abstract void cmdBuilt(CommandDispatcher<CommandSource> dispatcher); public static void cmdBuilt(CommandDispatcher<CommandSource> dispatcher) {
MinecraftForge.EVENT_BUS.post(new CommandsBuiltEvent(dispatcher));
}
@Target(of = "injectCommandHandler") @Target(of = "injectCommandHandler")
abstract void handleCommands(SCommandListPacket pkt); abstract void handleCommands(SCommandListPacket pkt);

View file

@ -21,20 +21,18 @@ public class EntityPushPatch implements ICommons {
@Cancelable @Cancelable
public static class PlayerEntityPushEvent extends Event {} public static class PlayerEntityPushEvent extends Event {}
public static boolean shouldCancelEntityCollisions(Entity e) {
if (e.equals(MC.player)) {
return MinecraftForge.EVENT_BUS.post(new PlayerEntityPushEvent());
}
return false;
}
@Patch(Entity.class) @Patch(Entity.class)
public abstract static class EntityCollisionsOverride implements Opcodes { public abstract static class EntityCollisionsOverride implements Opcodes {
@Find(EntityPushPatch.class) @Find(EntityPushPatch.class)
MethodProxy shouldCancelEntityCollisions; MethodProxy shouldCancelEntityCollisions;
@Target(of = "shouldCancelEntityCollisions") @Target(of = "shouldCancelEntityCollisions")
abstract boolean shouldCancelEntityCollisions(Entity e); public static boolean shouldCancelEntityCollisions(Entity e) {
if (e.equals(MC.player)) {
return MinecraftForge.EVENT_BUS.post(new PlayerEntityPushEvent());
}
return false;
}
@Target(of = "injectEntityCollisionHook") @Target(of = "injectEntityCollisionHook")
abstract void push(double x, double y, double z); abstract void push(double x, double y, double z);

View file

@ -21,20 +21,18 @@ public class LiquidPushPatch implements ICommons {
@Cancelable @Cancelable
public static class PlayerLiquidPushEvent extends Event {} public static class PlayerLiquidPushEvent extends Event {}
public static boolean shouldCancelLiquidCollisions(PlayerEntity player) {
if (player.equals(MC.player)) {
return MinecraftForge.EVENT_BUS.post(new PlayerLiquidPushEvent());
}
return false;
}
@Patch(PlayerEntity.class) @Patch(PlayerEntity.class)
public abstract static class LiquidCollisionsOverride implements Opcodes { public abstract static class LiquidCollisionsOverride implements Opcodes {
@Find(LiquidPushPatch.class) @Find(LiquidPushPatch.class)
MethodProxy shouldCancelLiquidCollisions; MethodProxy shouldCancelLiquidCollisions;
@Target(of = "shouldCancelLiquidCollisions") @Target(of = "shouldCancelLiquidCollisions")
abstract boolean shouldCancelLiquidCollisions(PlayerEntity player); public static boolean shouldCancelLiquidCollisions(PlayerEntity player) {
if (player.equals(MC.player)) {
return MinecraftForge.EVENT_BUS.post(new PlayerLiquidPushEvent());
}
return false;
}
@Target(of = "injectLiquidCollisionHook") @Target(of = "injectLiquidCollisionHook")
abstract boolean isPushedByFluid(); abstract boolean isPushedByFluid();

View file

@ -21,10 +21,6 @@ public class NoSlowPatch {
@Cancelable @Cancelable
public static class PlayerSlowDownEvent extends Event { } public static class PlayerSlowDownEvent extends Event { }
public static boolean shouldSlowPlayer() {
return MinecraftForge.EVENT_BUS.post(new PlayerSlowDownEvent());
}
@Patch(ClientPlayerEntity.class) @Patch(ClientPlayerEntity.class)
public abstract static class SlowDownOverride implements Opcodes { public abstract static class SlowDownOverride implements Opcodes {
@ -32,7 +28,9 @@ public class NoSlowPatch {
MethodProxy shouldSlowPlayer; MethodProxy shouldSlowPlayer;
@Target(of = "shouldSlowPlayer") @Target(of = "shouldSlowPlayer")
abstract boolean shouldSlowPlayer(); public static boolean shouldSlowPlayer() {
return MinecraftForge.EVENT_BUS.post(new PlayerSlowDownEvent());
}
@Target(of = "injectNoSlowHook") @Target(of = "injectNoSlowHook")
abstract void aiStep(); abstract void aiStep();

View file

@ -43,21 +43,15 @@ public class PacketPatch {
} }
} }
public static boolean pktIn(IPacket<?> pkt) {
return MinecraftForge.EVENT_BUS.post(new PacketEvent.Incoming(pkt));
}
public static boolean pktOut(IPacket<?> pkt) {
return MinecraftForge.EVENT_BUS.post(new PacketEvent.Outgoing(pkt));
}
@Patch(NetworkManager.class) @Patch(NetworkManager.class)
public abstract static class IncomingPacketInterceptor implements Opcodes { public abstract static class IncomingPacketInterceptor implements Opcodes {
@Find(PacketPatch.class) @Find(PacketPatch.class)
MethodProxy pktIn; MethodProxy pktIn;
@Target(of = "pktIn") @Target(of = "pktIn")
abstract boolean pktIn(IPacket<?> pkt); public static boolean pktIn(IPacket<?> pkt) {
return MinecraftForge.EVENT_BUS.post(new PacketEvent.Incoming(pkt));
}
@Target(of = "injectIncomingInterceptor") @Target(of = "injectIncomingInterceptor")
abstract void channelRead0(ChannelHandlerContext ctx, IPacket<?> pak); abstract void channelRead0(ChannelHandlerContext ctx, IPacket<?> pak);
@ -91,8 +85,9 @@ public class PacketPatch {
MethodProxy pktOut; MethodProxy pktOut;
@Target(of = "pktOut") @Target(of = "pktOut")
abstract boolean pktOut(IPacket<?> pkt); public static boolean pktOut(IPacket<?> pkt) {
return MinecraftForge.EVENT_BUS.post(new PacketEvent.Outgoing(pkt));
}
@Target(of = "injectOutgoingInterceptor") @Target(of = "injectOutgoingInterceptor")
public abstract void sendPacket(IPacket<?> pak, GenericFutureListener<? extends Future<? super Void>> gfl); public abstract void sendPacket(IPacket<?> pak, GenericFutureListener<? extends Future<? super Void>> gfl);