use of net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket in project BleachHack by BleachDrinker420.
the class PacketFly method onTick.
@BleachSubscribe
public void onTick(EventTick event) {
if (!mc.player.isAlive())
return;
double hspeed = getSetting(1).asSlider().getValue();
double vspeed = getSetting(2).asSlider().getValue();
timer++;
Vec3d forward = new Vec3d(0, 0, hspeed).rotateY(-(float) Math.toRadians(mc.player.getYaw()));
Vec3d moveVec = Vec3d.ZERO;
if (mc.player.input.pressingForward) {
moveVec = moveVec.add(forward);
}
if (mc.player.input.pressingBack) {
moveVec = moveVec.add(forward.negate());
}
if (mc.player.input.jumping) {
moveVec = moveVec.add(0, vspeed, 0);
}
if (mc.player.input.sneaking) {
moveVec = moveVec.add(0, -vspeed, 0);
}
if (mc.player.input.pressingLeft) {
moveVec = moveVec.add(forward.rotateY((float) Math.toRadians(90)));
}
if (mc.player.input.pressingRight) {
moveVec = moveVec.add(forward.rotateY((float) -Math.toRadians(90)));
}
Entity target = mc.player.getRootVehicle();
if (getSetting(0).asMode().getMode() == 0) {
if (timer > getSetting(3).asSlider().getValue()) {
moveVec = moveVec.add(0, -vspeed, 0);
timer = 0;
}
cachedPos = cachedPos.add(moveVec);
// target.noClip = true;
target.updatePositionAndAngles(cachedPos.x, cachedPos.y, cachedPos.z, mc.player.getYaw(), mc.player.getPitch());
if (target != mc.player) {
mc.player.networkHandler.sendPacket(new VehicleMoveC2SPacket(target));
} else {
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(cachedPos.x, cachedPos.y, cachedPos.z, false));
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(cachedPos.x, cachedPos.y - 0.01, cachedPos.z, true));
}
} else if (getSetting(0).asMode().getMode() == 1) {
if (timer > getSetting(3).asSlider().getValue()) {
moveVec = new Vec3d(0, -vspeed, 0);
timer = 0;
}
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX() + moveVec.x, mc.player.getY() + moveVec.y, mc.player.getZ() + moveVec.z, false));
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX() + moveVec.x, mc.player.getY() - 420.69, mc.player.getZ() + moveVec.z, true));
}
}
use of net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket in project BleachHack by BleachDrinker420.
the class Solidify method onSendPacket.
@BleachSubscribe
public void onSendPacket(EventPacket.Send event) {
if (getSetting(7).asToggle().getState()) {
if (event.getPacket() instanceof VehicleMoveC2SPacket) {
VehicleMoveC2SPacket packet = (VehicleMoveC2SPacket) event.getPacket();
if (!mc.world.getChunkManager().isChunkLoaded((int) packet.getX() >> 4, (int) packet.getZ() >> 4)) {
mc.player.getVehicle().updatePosition(mc.player.getVehicle().prevX, mc.player.getVehicle().prevY, mc.player.getVehicle().prevZ);
event.setCancelled(true);
}
} else if (event.getPacket() instanceof PlayerMoveC2SPacket) {
PlayerMoveC2SPacket packet = (PlayerMoveC2SPacket) event.getPacket();
if (!mc.world.getChunkManager().isChunkLoaded((int) packet.getX(mc.player.getX()) >> 4, (int) packet.getZ(mc.player.getZ()) >> 4)) {
event.setCancelled(true);
}
}
}
}
use of net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket in project BleachHack by BleachDrinker420.
the class EntityControl method onSendPacket.
@BleachSubscribe
public void onSendPacket(EventPacket.Send event) {
if (getSetting(6).asToggle().getState()) {
if (event.getPacket() instanceof VehicleMoveC2SPacket) {
VehicleMoveC2SPacket packet = (VehicleMoveC2SPacket) event.getPacket();
packet.yaw = getSetting(6).asToggle().getChild(0).asSlider().getValueFloat();
packet.pitch = getSetting(6).asToggle().getChild(1).asSlider().getValueFloat();
} else if (event.getPacket() instanceof PlayerMoveC2SPacket && mc.player.hasVehicle() && getSetting(6).asToggle().getChild(2).asToggle().getState()) {
PlayerMoveC2SPacket packet = (PlayerMoveC2SPacket) event.getPacket();
packet.yaw = getSetting(6).asToggle().getChild(0).asSlider().getValueFloat();
packet.pitch = getSetting(6).asToggle().getChild(1).asSlider().getValueFloat();
}
}
if (getSetting(7).asToggle().getState() && event.getPacket() instanceof VehicleMoveC2SPacket && mc.player.hasVehicle()) {
mc.interactionManager.interactEntity(mc.player, mc.player.getVehicle(), Hand.MAIN_HAND);
}
}
use of net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket in project meteor-crash-addon by AntiCope.
the class EntityCrash method onTick.
@EventHandler
public void onTick(TickEvent.Post event) {
Entity entity = mc.player.getVehicle();
for (int i = 0; i < amount.get(); i++) {
Vec3d v = entity.getPos();
entity.setPos(v.x, v.y + speed.get(), v.z);
VehicleMoveC2SPacket packet = new VehicleMoveC2SPacket(entity);
mc.getNetworkHandler().sendPacket(packet);
}
}
use of net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket in project Hypnotic-Client by Hypnotic-Development.
the class EntityDesync method onTick.
@Override
public void onTick() {
if (ridingEntity == null)
return;
// mc.player.setOnGround(true);
ridingEntity.setPos(mc.player.getX(), mc.player.getY(), mc.player.getZ());
mc.player.networkHandler.sendPacket(new VehicleMoveC2SPacket(ridingEntity));
super.onTick();
}
Aggregations