fix: working boat event
This commit is contained in:
parent
ac4a18a428
commit
eb9e15e004
3 changed files with 11 additions and 10 deletions
|
@ -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(); }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -35,6 +36,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;
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue