diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 52b0807..beaeb09 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,8 +4,8 @@ gitVersion = "0.13.0" minecraft = "1.16.5" forge = "1.16.5-36.2.34" autoService = "1.0.1" -lillero = "0.4.0" -lilleroProcessor = "0.5.0" +lillero = "0.4.1" +lilleroProcessor = "0.5.1" checkerFramework = "0.6.24" [plugins] diff --git a/src/main/java/ftbsc/bscv/patches/BackgroundPatch.java b/src/main/java/ftbsc/bscv/patches/BackgroundPatch.java index c60ff0f..92b6710 100644 --- a/src/main/java/ftbsc/bscv/patches/BackgroundPatch.java +++ b/src/main/java/ftbsc/bscv/patches/BackgroundPatch.java @@ -20,11 +20,6 @@ import org.objectweb.asm.tree.*; import com.mojang.blaze3d.matrix.MatrixStack; public class BackgroundPatch implements ICommons { - - public static boolean shouldDrawBackground(Screen screen) { - return MinecraftForge.EVENT_BUS.post(new RenderBackgroundEvent(screen)); - } - @Cancelable public static class RenderBackgroundEvent extends Event { public final Screen screen; @@ -40,7 +35,9 @@ public class BackgroundPatch implements ICommons { MethodProxy 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") abstract void renderBackground(MatrixStack stack, int x); diff --git a/src/main/java/ftbsc/bscv/patches/BlockPushPatch.java b/src/main/java/ftbsc/bscv/patches/BlockPushPatch.java index b9d2075..cc35eda 100644 --- a/src/main/java/ftbsc/bscv/patches/BlockPushPatch.java +++ b/src/main/java/ftbsc/bscv/patches/BlockPushPatch.java @@ -20,17 +20,15 @@ public class BlockPushPatch { @Cancelable public static class PlayerBlockPushEvent extends Event {} - public static boolean shouldCancelBlockCollisions() { - return MinecraftForge.EVENT_BUS.post(new PlayerBlockPushEvent()); - } - @Patch(ClientPlayerEntity.class) public abstract static class BlockCollisionsOverride implements Opcodes { @Find(BlockPushPatch.class) MethodProxy shouldCancelBlockCollisions; @Target(of = "shouldCancelBlockCollisions") - abstract boolean shouldCancelBlockCollisions(); + public static boolean shouldCancelBlockCollisions() { + return MinecraftForge.EVENT_BUS.post(new PlayerBlockPushEvent()); + } @Target(of = "injectCancelCollisionsHook") abstract void moveTowardsClosestSpace(double x, double z); diff --git a/src/main/java/ftbsc/bscv/patches/BoatPatch.java b/src/main/java/ftbsc/bscv/patches/BoatPatch.java index b8a31fe..ef00f2d 100644 --- a/src/main/java/ftbsc/bscv/patches/BoatPatch.java +++ b/src/main/java/ftbsc/bscv/patches/BoatPatch.java @@ -30,28 +30,15 @@ public class BoatPatch implements ICommons { 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) public abstract static class BoatControlOverride implements Opcodes { @Find(BoatPatch.class) MethodProxy boatControl; @Target(of = "boatControl") - abstract boolean boatControl(); + public static boolean boatControl() { + return MinecraftForge.EVENT_BUS.post(new BoatEvent.Control()); + } @Target(of = "injectBoatControlHook") public abstract void controlBoat(); @@ -76,7 +63,9 @@ public class BoatPatch implements ICommons { MethodProxy boatClampRotation; @Target(of = "boatClampRotation") - abstract boolean boatClampRotation(); + public static boolean boatClampRotation() { + return MinecraftForge.EVENT_BUS.post(new BoatEvent.ClampRotation()); + } @Target(of = "injectRotationClampingHook") public abstract void clampRotation(Entity e); @@ -101,7 +90,12 @@ public class BoatPatch implements ICommons { MethodProxy 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") public abstract boolean isNoGravity(); diff --git a/src/main/java/ftbsc/bscv/patches/CommandsPatch.java b/src/main/java/ftbsc/bscv/patches/CommandsPatch.java index a7474a0..4f45b42 100644 --- a/src/main/java/ftbsc/bscv/patches/CommandsPatch.java +++ b/src/main/java/ftbsc/bscv/patches/CommandsPatch.java @@ -30,18 +30,15 @@ public class CommandsPatch { } } - public static void cmdBuilt(CommandDispatcher dispatcher) { - MinecraftForge.EVENT_BUS.post(new CommandsBuiltEvent(dispatcher)); - } - @Patch(ClientPlayNetHandler.class) public abstract static class CommandsDispatcherCatcher implements Opcodes { @Find(CommandsPatch.class) MethodProxy cmdBuilt; - @Target(of = "cmdBuilt") - abstract void cmdBuilt(CommandDispatcher dispatcher); + public static void cmdBuilt(CommandDispatcher dispatcher) { + MinecraftForge.EVENT_BUS.post(new CommandsBuiltEvent(dispatcher)); + } @Target(of = "injectCommandHandler") abstract void handleCommands(SCommandListPacket pkt); diff --git a/src/main/java/ftbsc/bscv/patches/EntityPushPatch.java b/src/main/java/ftbsc/bscv/patches/EntityPushPatch.java index d425987..c40062f 100644 --- a/src/main/java/ftbsc/bscv/patches/EntityPushPatch.java +++ b/src/main/java/ftbsc/bscv/patches/EntityPushPatch.java @@ -21,20 +21,18 @@ public class EntityPushPatch implements ICommons { @Cancelable 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) public abstract static class EntityCollisionsOverride implements Opcodes { @Find(EntityPushPatch.class) MethodProxy 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") abstract void push(double x, double y, double z); diff --git a/src/main/java/ftbsc/bscv/patches/LiquidPushPatch.java b/src/main/java/ftbsc/bscv/patches/LiquidPushPatch.java index af8ccc1..2db811e 100644 --- a/src/main/java/ftbsc/bscv/patches/LiquidPushPatch.java +++ b/src/main/java/ftbsc/bscv/patches/LiquidPushPatch.java @@ -21,20 +21,18 @@ public class LiquidPushPatch implements ICommons { @Cancelable 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) public abstract static class LiquidCollisionsOverride implements Opcodes { @Find(LiquidPushPatch.class) MethodProxy 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") abstract boolean isPushedByFluid(); diff --git a/src/main/java/ftbsc/bscv/patches/NoSlowPatch.java b/src/main/java/ftbsc/bscv/patches/NoSlowPatch.java index f0e2c21..a100108 100644 --- a/src/main/java/ftbsc/bscv/patches/NoSlowPatch.java +++ b/src/main/java/ftbsc/bscv/patches/NoSlowPatch.java @@ -21,10 +21,6 @@ public class NoSlowPatch { @Cancelable public static class PlayerSlowDownEvent extends Event { } - public static boolean shouldSlowPlayer() { - return MinecraftForge.EVENT_BUS.post(new PlayerSlowDownEvent()); - } - @Patch(ClientPlayerEntity.class) public abstract static class SlowDownOverride implements Opcodes { @@ -32,7 +28,9 @@ public class NoSlowPatch { MethodProxy shouldSlowPlayer; @Target(of = "shouldSlowPlayer") - abstract boolean shouldSlowPlayer(); + public static boolean shouldSlowPlayer() { + return MinecraftForge.EVENT_BUS.post(new PlayerSlowDownEvent()); + } @Target(of = "injectNoSlowHook") abstract void aiStep(); diff --git a/src/main/java/ftbsc/bscv/patches/PacketPatch.java b/src/main/java/ftbsc/bscv/patches/PacketPatch.java index fbf5889..bc9b835 100644 --- a/src/main/java/ftbsc/bscv/patches/PacketPatch.java +++ b/src/main/java/ftbsc/bscv/patches/PacketPatch.java @@ -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) public abstract static class IncomingPacketInterceptor implements Opcodes { @Find(PacketPatch.class) MethodProxy 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") abstract void channelRead0(ChannelHandlerContext ctx, IPacket pak); @@ -91,8 +85,9 @@ public class PacketPatch { MethodProxy 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") public abstract void sendPacket(IPacket pak, GenericFutureListener> gfl);