fix: moved util out
This commit is contained in:
parent
de9f23e856
commit
cc1ef1452d
2 changed files with 24 additions and 7 deletions
|
@ -52,6 +52,15 @@ public class BoatFly extends Module implements ICommons {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onRender(RenderWorldLastEvent event) {
|
||||||
|
if (!this.rotation.get()) return;
|
||||||
|
if (MC.player == null) return;
|
||||||
|
Entity vehicle = MC.player.getVehicle();
|
||||||
|
if (vehicle == null) return;
|
||||||
|
vehicle.yRot = MC.player.yRot;
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onBoatClampRotation(BoatEvent.ClampRotation event) {
|
public void onBoatClampRotation(BoatEvent.ClampRotation event) {
|
||||||
if (MC.player != null && MC.player.getVehicle() != null) {
|
if (MC.player != null && MC.player.getVehicle() != null) {
|
||||||
|
@ -69,20 +78,20 @@ public class BoatFly extends Module implements ICommons {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTick(TickEvent.ClientTickEvent event) {
|
public void onTick(TickEvent.ClientTickEvent event) {
|
||||||
if (event.phase == Phase.END) return;
|
if (event.phase == Phase.END) return;
|
||||||
if (MC.player == null) {
|
if (MC.player == null) return;
|
||||||
this.disable();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Entity vehicle = MC.player.getVehicle();
|
Entity vehicle = MC.player.getVehicle();
|
||||||
if (vehicle == null) return;
|
if (vehicle == null) return;
|
||||||
|
|
||||||
vehicle.yRot = MC.player.yRot;
|
vehicle.yRot = MC.player.yRot;
|
||||||
|
|
||||||
if (Keyboard.isMoving()) {
|
if (Keyboard.isMoving()) {
|
||||||
Vector2f motion = MC.player.input.getMoveVector();
|
|
||||||
double speed = this.speed.get();
|
double speed = this.speed.get();
|
||||||
Vector3d delta = new Vector3d(motion.x * speed, MC.options.keyJump.isDown() ? this.rise.get() : 0., motion.y * speed);
|
if (this.sprint.get() && !MC.player.isSprinting()) speed /= 2.;
|
||||||
vehicle.setDeltaMovement(delta.yRot((float) -(MC.player.yRot * (Math.PI / 180F))));
|
vehicle.setDeltaMovement(
|
||||||
|
Keyboard.getMotion().multiply(speed, this.rise.get(), speed)
|
||||||
|
);
|
||||||
|
} else if (!this.drift.get()) {
|
||||||
|
vehicle.setDeltaMovement(0., 0., 0.);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package ftbsc.bscv.tools;
|
package ftbsc.bscv.tools;
|
||||||
|
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
|
import net.minecraft.util.math.vector.Vector2f;
|
||||||
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
public class Keyboard implements ICommons {
|
public class Keyboard implements ICommons {
|
||||||
|
|
||||||
|
@ -16,4 +18,10 @@ public class Keyboard implements ICommons {
|
||||||
|| MC.options.keyJump.isDown()
|
|| MC.options.keyJump.isDown()
|
||||||
|| MC.options.keySprint.isDown();
|
|| MC.options.keySprint.isDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Vector3d getMotion() {
|
||||||
|
Vector2f motion = MC.player.input.getMoveVector();
|
||||||
|
double vertical = MC.options.keyJump.isDown() ? 1.0 : (MC.options.keySprint.isDown() ? -1.0 : 0.0);
|
||||||
|
return new Vector3d(motion.x, vertical, motion.y).yRot((float) -(MC.player.yRot * (Math.PI / 180F)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue