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"
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]

View file

@ -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);

View file

@ -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);

View file

@ -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();

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)
public abstract static class CommandsDispatcherCatcher implements Opcodes {
@Find(CommandsPatch.class)
MethodProxy 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")
abstract void handleCommands(SCommandListPacket pkt);

View file

@ -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);

View file

@ -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();

View file

@ -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();

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)
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<? extends Future<? super Void>> gfl);