diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/ftbsc/bscv/events/BoatEvent.java | 4 | ||||
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/motion/BoatFly.java | 8 | ||||
-rw-r--r-- | src/main/java/ftbsc/bscv/patches/BoatPatch.java | 9 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/main/java/ftbsc/bscv/events/BoatEvent.java b/src/main/java/ftbsc/bscv/events/BoatEvent.java index 32eeb37..3633bdc 100644 --- a/src/main/java/ftbsc/bscv/events/BoatEvent.java +++ b/src/main/java/ftbsc/bscv/events/BoatEvent.java @@ -6,7 +6,7 @@ import net.minecraftforge.eventbus.api.Event; public class BoatEvent { @Cancelable - public class Control extends Event { - public Control() {} + public static class Control extends Event { + public Control() { super(); } } } diff --git a/src/main/java/ftbsc/bscv/modules/motion/BoatFly.java b/src/main/java/ftbsc/bscv/modules/motion/BoatFly.java index 3724c72..9506e5a 100644 --- a/src/main/java/ftbsc/bscv/modules/motion/BoatFly.java +++ b/src/main/java/ftbsc/bscv/modules/motion/BoatFly.java @@ -4,6 +4,7 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.DoubleArgumentType; import ftbsc.bscv.ICommons; +import ftbsc.bscv.events.BoatEvent; import ftbsc.bscv.modules.Module; import ftbsc.bscv.tools.Keyboard; import net.minecraft.command.CommandSource; @@ -36,6 +37,13 @@ public class BoatFly extends Module implements ICommons { } @SubscribeEvent + public void onBoatControl(BoatEvent.Control event) { + if (MC.player != null && MC.player.getVehicle() != null) { + event.setCanceled(true); + } + } + + @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { // if (event.phase == Phase.END) return; if (MC.player == null) { diff --git a/src/main/java/ftbsc/bscv/patches/BoatPatch.java b/src/main/java/ftbsc/bscv/patches/BoatPatch.java index 3d7f13d..09478f6 100644 --- a/src/main/java/ftbsc/bscv/patches/BoatPatch.java +++ b/src/main/java/ftbsc/bscv/patches/BoatPatch.java @@ -4,7 +4,6 @@ import net.minecraft.network.IPacket; import net.minecraftforge.common.MinecraftForge; import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.InsnNode; import org.objectweb.asm.tree.JumpInsnNode; @@ -14,10 +13,8 @@ import org.objectweb.asm.tree.MethodNode; import org.objectweb.asm.tree.VarInsnNode; import ftbsc.bscv.events.BoatEvent; -import ftbsc.bscv.events.PacketEvent; import ftbsc.lll.IInjector; import ftbsc.lll.tools.InsnSequence; -import ftbsc.lll.tools.PatternMatcher; public class BoatPatch { @@ -25,10 +22,6 @@ public class BoatPatch { public static boolean boatControl(IPacket<?> pkt) { return MinecraftForge.EVENT_BUS.post(new BoatEvent.Control()); } - - public static boolean pktOut(IPacket<?> pkt) { - return MinecraftForge.EVENT_BUS.post(new PacketEvent(pkt, true)); - } } public static class BoatControlOverride implements IInjector, Opcodes { @@ -47,7 +40,7 @@ public class BoatPatch { INVOKESTATIC, "ftbsc/bscv/patches/BoatPatch$BoatHook", "boatControl", - "(Lnet/minecraft/network/IPacket;)Z" + "()Z" )); is.add(new JumpInsnNode(IFEQ, skip)); is.add(new InsnNode(RETURN)); |