diff --git a/src/main/java/ftbsc/bscv/BoSCoVicino.java b/src/main/java/ftbsc/bscv/BoSCoVicino.java index 60735c3..c5c397c 100644 --- a/src/main/java/ftbsc/bscv/BoSCoVicino.java +++ b/src/main/java/ftbsc/bscv/BoSCoVicino.java @@ -72,6 +72,7 @@ public class BoSCoVicino implements ICommons { BoSCoVicino.mods.add(new AutoFish(cfg, dp).done(cfg)); BoSCoVicino.mods.add(new AutoTool(cfg, dp).done(cfg)); BoSCoVicino.mods.add(new Freecam(cfg, dp).done(cfg)); + BoSCoVicino.mods.add(new BoatFly(cfg, dp).done(cfg)); BoSCoVicino.spec = cfg.build(); diff --git a/src/main/java/ftbsc/bscv/modules/motion/BoatFly.java b/src/main/java/ftbsc/bscv/modules/motion/BoatFly.java new file mode 100644 index 0000000..3724c72 --- /dev/null +++ b/src/main/java/ftbsc/bscv/modules/motion/BoatFly.java @@ -0,0 +1,59 @@ +package ftbsc.bscv.modules.motion; + +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.arguments.DoubleArgumentType; + +import ftbsc.bscv.ICommons; +import ftbsc.bscv.modules.Module; +import ftbsc.bscv.tools.Keyboard; +import net.minecraft.command.CommandSource; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.BoatEntity; +import net.minecraft.util.math.vector.Vector2f; +import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.event.TickEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; + +public class BoatFly extends Module implements ICommons { + + public final ForgeConfigSpec.ConfigValue speed; + public final ForgeConfigSpec.ConfigValue rise; + + public BoatFly(ForgeConfigSpec.Builder builder, CommandDispatcher dispatcher) { + super("BoatFly", Group.MOTION, builder, dispatcher); + + this.speed = this.option( + "speed", "magnitude of boat movement", 1., + DoubleArgumentType.doubleArg(), Double.class, + builder, dispatcher + ); + + this.rise = this.option( + "rise", "vertical speed", 0.5, + DoubleArgumentType.doubleArg(), Double.class, + builder, dispatcher + ); + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + // if (event.phase == Phase.END) return; + if (MC.player == null) { + this.disable(); + return; + } + Entity vehicle = MC.player.getVehicle(); + if (vehicle == null) return; + if (vehicle instanceof BoatEntity) { + + } + + if (Keyboard.isMoving()) { + Vector2f motion = MC.player.input.getMoveVector(); + double rise = MC.options.keyJump.isDown() ? this.rise.get() : 0.; + double speed = this.speed.get(); + vehicle.setDeltaMovement(motion.x * speed, rise, motion.y * speed); + } + } + +}