use of mathax.client.eventbus.EventHandler in project Client by MatHax.
the class Gravity method onTick.
@EventHandler
private void onTick(final TickEvent.Post event) {
if (mc.options.sneakKey.isPressed())
return;
Vec3d velocity = mc.player.getVelocity();
((IVec3d) velocity).set(velocity.x, velocity.y + 0.0568000030517578, velocity.z);
}
use of mathax.client.eventbus.EventHandler in project Client by MatHax.
the class BoatFly method onBoatMove.
@EventHandler
private void onBoatMove(BoatMoveEvent event) {
if (event.boat.getPrimaryPassenger() != mc.player)
return;
event.boat.setYaw(mc.player.getYaw());
Vec3d vel = PlayerUtils.getHorizontalVelocity(speed.get());
double velX = vel.getX();
double velY = 0;
double velZ = vel.getZ();
if (mc.options.jumpKey.isPressed())
velY += verticalSpeed.get() / 20;
if (mc.options.sprintKey.isPressed())
velY -= verticalSpeed.get() / 20;
else
velY -= fallSpeed.get() / 20;
((IVec3d) event.boat.getVelocity()).set(velX, velY, velZ);
}
use of mathax.client.eventbus.EventHandler in project Client by MatHax.
the class Phase method onTick.
@EventHandler
public void onTick(TickEvent.Pre event) {
if (mode.get() != Mode.No_NCP)
return;
double blocks = clipDistance.get();
if (!mc.player.isOnGround())
return;
if (mc.options.forwardKey.isPressed()) {
Vec3d forward = Vec3d.fromPolar(0, mc.player.getYaw());
mc.player.updatePosition(mc.player.getX() + forward.x * blocks, mc.player.getY(), mc.player.getZ() + forward.z * blocks);
}
if (mc.options.backKey.isPressed()) {
Vec3d forward = Vec3d.fromPolar(0, mc.player.getYaw() - 180);
mc.player.updatePosition(mc.player.getX() + forward.x * blocks, mc.player.getY(), mc.player.getZ() + forward.z * blocks);
}
if (mc.options.leftKey.isPressed()) {
Vec3d forward = Vec3d.fromPolar(0, mc.player.getYaw() - 90);
mc.player.updatePosition(mc.player.getX() + forward.x * blocks, mc.player.getY(), mc.player.getZ() + forward.z * blocks);
}
if (mc.options.rightKey.isPressed()) {
Vec3d forward = Vec3d.fromPolar(0, mc.player.getYaw() - 270);
mc.player.updatePosition(mc.player.getX() + forward.x * blocks, mc.player.getY(), mc.player.getZ() + forward.z * blocks);
}
if (mc.options.jumpKey.isPressed())
mc.player.updatePosition(mc.player.getX(), mc.player.getY() + 0.05, mc.player.getZ());
if (mc.options.sneakKey.isPressed())
mc.player.updatePosition(mc.player.getX(), mc.player.getY() - 0.05, mc.player.getZ());
}
use of mathax.client.eventbus.EventHandler in project Client by MatHax.
the class Phase method onTick.
@EventHandler
private void onTick(TickEvent.Post event) {
if (mode.get() == Mode.Collision_Shape || mode.get() == Mode.No_NCP)
return;
if (mc.player == null)
return;
if (Double.isNaN(prevX) || Double.isNaN(prevZ))
setPos();
Vec3d yawForward = Vec3d.fromPolar(0.0f, mc.player.getYaw());
Vec3d yawBack = Vec3d.fromPolar(0.0f, mc.player.getYaw() - 180f);
Vec3d yawLeft = Vec3d.fromPolar(0.0f, mc.player.getYaw() - 90f);
Vec3d yawRight = Vec3d.fromPolar(0.0f, mc.player.getYaw() - 270f);
if (mode.get() == Mode.Normal) {
if (mc.options.forwardKey.isPressed())
mc.player.setPos(mc.player.getX() + yawForward.x * distance.get(), mc.player.getY(), mc.player.getZ() + yawForward.z * distance.get());
if (mc.options.backKey.isPressed())
mc.player.setPos(mc.player.getX() + yawBack.x * distance.get(), mc.player.getY(), mc.player.getZ() + yawBack.z * distance.get());
if (mc.options.leftKey.isPressed())
mc.player.setPos(mc.player.getX() + yawLeft.x * distance.get(), mc.player.getY(), mc.player.getZ() + yawLeft.z * distance.get());
if (mc.options.rightKey.isPressed())
mc.player.setPos(mc.player.getX() + yawRight.x * distance.get(), mc.player.getY(), mc.player.getZ() + yawRight.z * distance.get());
} else if (mode.get() == Mode.NRNB) {
if (mc.options.forwardKey.isPressed()) {
prevX += yawForward.x * distance.get();
prevZ += yawForward.z * distance.get();
mc.player.setPos(prevX, mc.player.getY(), prevZ);
}
if (mc.options.backKey.isPressed()) {
prevX += yawBack.x * distance.get();
prevZ += yawBack.z * distance.get();
mc.player.setPos(prevX, mc.player.getY(), prevZ);
}
if (mc.options.leftKey.isPressed()) {
prevX += yawLeft.x * distance.get();
prevZ += yawLeft.z * distance.get();
mc.player.setPos(prevX, mc.player.getY(), prevZ);
}
if (mc.options.rightKey.isPressed()) {
prevX += yawRight.x * distance.get();
prevZ += yawRight.z * distance.get();
mc.player.setPos(prevX, mc.player.getY(), prevZ);
}
}
}
use of mathax.client.eventbus.EventHandler in project Client by MatHax.
the class EChestMemory method onOpenScreenEvent.
@EventHandler
private static void onOpenScreenEvent(OpenScreenEvent event) {
if (echestOpenedState == 1 && event.screen instanceof GenericContainerScreen) {
echestOpenedState = 2;
return;
}
if (echestOpenedState == 0)
return;
if (!(mc.currentScreen instanceof GenericContainerScreen))
return;
GenericContainerScreenHandler container = ((GenericContainerScreen) mc.currentScreen).getScreenHandler();
if (container == null)
return;
Inventory inv = container.getInventory();
for (int i = 0; i < 27; i++) {
ITEMS.set(i, inv.getStack(i));
}
echestOpenedState = 0;
}
Aggregations