use of net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket in project Wurst7 by Wurst-Imperium.
the class ExtraElytraHack method sendStartStopPacket.
private void sendStartStopPacket() {
ClientCommandC2SPacket packet = new ClientCommandC2SPacket(MC.player, ClientCommandC2SPacket.Mode.START_FALL_FLYING);
MC.player.networkHandler.sendPacket(packet);
}
use of net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket in project Wurst7 by Wurst-Imperium.
the class SneakHack method sendSneakPacket.
private void sendSneakPacket(Mode mode) {
ClientPlayerEntity player = MC.player;
ClientCommandC2SPacket packet = new ClientCommandC2SPacket(player, mode);
player.networkHandler.sendPacket(packet);
}
use of net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket in project Hypnotic-Client by Hypnotic-Development.
the class EntityDesync method entityEvent.
@EventTarget
public void entityEvent(EventReceivePacket event) {
if (event.getPacket() instanceof ClientCommandC2SPacket) {
ClientCommandC2SPacket packet = (ClientCommandC2SPacket) event.getPacket();
if (packet.getMode() == Mode.PRESS_SHIFT_KEY) {
ChatUtils.tellPlayer("Dismounted");
this.toggle();
}
}
}
use of net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket in project JexClient by DustinRepo.
the class MixinClientPlayerEntity method tickMovePre.
@Inject(method = "tickMovement", at = @At("HEAD"), cancellable = true)
public void tickMovePre(CallbackInfo ci) {
new EventPlayerUpdates(EventPlayerUpdates.Mode.PRE).run();
++this.ticksSinceSprintingChanged;
if (this.ticksLeftToDoubleTapSprint > 0) {
--this.ticksLeftToDoubleTapSprint;
}
this.updateNausea();
boolean bl = this.input.jumping;
boolean bl2 = this.input.sneaking;
boolean bl3 = this.isWalking();
this.inSneakingPose = !this.getAbilities().flying && !this.isSwimming() && this.wouldPoseNotCollide(EntityPose.CROUCHING) && (this.isSneaking() || !this.isSleeping() && !this.wouldPoseNotCollide(EntityPose.STANDING));
this.input.tick(this.shouldSlowDown());
this.client.getTutorialManager().onMovement(this.input);
if ((this.isUsingItem() || AutoEat.isEating) && !this.hasVehicle()) {
EventSlowdown eventSlowdown = new EventSlowdown(EventSlowdown.State.USE_ITEM).run();
if (!eventSlowdown.isCancelled()) {
Input var10000 = this.input;
var10000.movementSideways *= 0.2F;
var10000 = this.input;
var10000.movementForward *= 0.2F;
this.ticksLeftToDoubleTapSprint = 0;
}
}
boolean bl4 = false;
if (this.ticksToNextAutojump > 0) {
--this.ticksToNextAutojump;
bl4 = true;
this.input.jumping = true;
}
if (!this.noClip) {
this.pushOutOfBlocks(this.getX() - (double) this.getWidth() * 0.35D, this.getZ() + (double) this.getWidth() * 0.35D);
this.pushOutOfBlocks(this.getX() - (double) this.getWidth() * 0.35D, this.getZ() - (double) this.getWidth() * 0.35D);
this.pushOutOfBlocks(this.getX() + (double) this.getWidth() * 0.35D, this.getZ() - (double) this.getWidth() * 0.35D);
this.pushOutOfBlocks(this.getX() + (double) this.getWidth() * 0.35D, this.getZ() + (double) this.getWidth() * 0.35D);
}
if (bl2) {
this.ticksLeftToDoubleTapSprint = 0;
}
boolean bl5 = (float) this.getHungerManager().getFoodLevel() > 6.0F || this.getAbilities().allowFlying;
if ((this.onGround || this.isSubmergedInWater()) && !bl2 && !bl3 && this.isWalking() && !this.isSprinting() && bl5 && !this.isUsingItem() && !this.hasStatusEffect(StatusEffects.BLINDNESS)) {
if (this.ticksLeftToDoubleTapSprint <= 0 && !this.client.options.sprintKey.isPressed()) {
this.ticksLeftToDoubleTapSprint = 7;
} else {
this.setSprinting(true);
}
}
if (!this.isSprinting() && (!this.isTouchingWater() || this.isSubmergedInWater()) && this.isWalking() && bl5 && !this.isUsingItem() && !this.hasStatusEffect(StatusEffects.BLINDNESS) && this.client.options.sprintKey.isPressed()) {
this.setSprinting(true);
}
boolean bl8;
if (this.isSprinting()) {
bl8 = !this.input.hasForwardMovement() || !bl5;
boolean bl7 = bl8 || this.horizontalCollision || this.isTouchingWater() && !this.isSubmergedInWater();
if (this.isSwimming()) {
if (!this.onGround && !this.input.sneaking && bl8 || !this.isTouchingWater()) {
this.setSprinting(false);
}
} else if (bl7) {
this.setSprinting(false);
}
}
bl8 = false;
if (this.getAbilities().allowFlying) {
if (this.client.interactionManager.isFlyingLocked()) {
if (!this.getAbilities().flying) {
this.getAbilities().flying = true;
bl8 = true;
this.sendAbilitiesUpdate();
}
} else if (!bl && this.input.jumping && !bl4) {
if (this.abilityResyncCountdown == 0) {
this.abilityResyncCountdown = 7;
} else if (!this.isSwimming()) {
this.getAbilities().flying = !this.getAbilities().flying;
bl8 = true;
this.sendAbilitiesUpdate();
this.abilityResyncCountdown = 0;
}
}
}
if (this.input.jumping && !bl8 && !bl && !this.getAbilities().flying && !this.hasVehicle() && !this.isClimbing()) {
ItemStack itemStack = this.getEquippedStack(EquipmentSlot.CHEST);
if (itemStack.getItem() == Items.ELYTRA && ElytraItem.isUsable(itemStack) && this.checkFallFlying()) {
this.networkHandler.sendPacket(new ClientCommandC2SPacket(this, ClientCommandC2SPacket.Mode.START_FALL_FLYING));
}
}
this.falling = this.isFallFlying();
if (this.isTouchingWater() && this.input.sneaking && this.shouldSwimInFluids()) {
this.knockDownwards();
}
int j;
if (this.isSubmergedIn(FluidTags.WATER)) {
j = this.isSpectator() ? 10 : 1;
this.underwaterVisibilityTicks = MathHelper.clamp(this.underwaterVisibilityTicks + j, 0, 600);
} else if (this.underwaterVisibilityTicks > 0) {
this.isSubmergedIn(FluidTags.WATER);
this.underwaterVisibilityTicks = MathHelper.clamp(this.underwaterVisibilityTicks - 10, 0, 600);
}
if (this.getAbilities().flying && this.isCamera()) {
j = 0;
if (this.input.sneaking) {
--j;
}
if (this.input.jumping) {
++j;
}
if (j != 0) {
this.setVelocity(this.getVelocity().add(0.0D, (double) ((float) j * this.getAbilities().getFlySpeed() * 3.0F), 0.0D));
}
}
if (this.hasJumpingMount()) {
JumpingMount jumpingMount = (JumpingMount) this.getVehicle();
if (this.field_3938 < 0) {
++this.field_3938;
if (this.field_3938 == 0) {
this.mountJumpStrength = 0.0F;
}
}
if (bl && !this.input.jumping) {
this.field_3938 = -10;
jumpingMount.setJumpStrength(MathHelper.floor(this.getMountJumpStrength() * 100.0F));
this.startRidingJump();
} else if (!bl && this.input.jumping) {
this.field_3938 = 0;
this.mountJumpStrength = 0.0F;
} else if (bl) {
++this.field_3938;
if (this.field_3938 < 10) {
this.mountJumpStrength = (float) this.field_3938 * 0.1F;
} else {
this.mountJumpStrength = 0.8F + 2.0F / (float) (this.field_3938 - 9) * 0.1F;
}
}
} else {
this.mountJumpStrength = 0.0F;
}
super.tickMovement();
if (this.onGround && this.getAbilities().flying && !this.client.interactionManager.isFlyingLocked()) {
this.getAbilities().flying = false;
this.sendAbilitiesUpdate();
}
new EventPlayerUpdates(EventPlayerUpdates.Mode.POST).run();
ci.cancel();
}
use of net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket in project Client by MatHax.
the class AutoMountBypassDupe method onTick.
@EventHandler
private void onTick(TickEvent.Post event) {
if (GLFW.glfwGetKey(mc.getWindow().getHandle(), GLFW.GLFW_KEY_ESCAPE) == GLFW.GLFW_PRESS) {
toggle();
mc.player.closeHandledScreen();
return;
}
if (timer <= 0)
timer = delay.get();
else {
timer--;
return;
}
int slots = getInvSize(mc.player.getVehicle());
for (Entity e : mc.world.getEntities()) {
if (e.distanceTo(mc.player) < 5 && e instanceof AbstractDonkeyEntity && ((AbstractDonkeyEntity) e).isTame())
entity = (AbstractDonkeyEntity) e;
}
if (entity == null)
return;
if (sneak) {
mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.RELEASE_SHIFT_KEY));
mc.player.setSneaking(false);
sneak = false;
return;
}
if (slots == -1) {
if (entity.hasChest() || mc.player.getMainHandStack().getItem() == Items.CHEST) {
mc.player.networkHandler.sendPacket(PlayerInteractEntityC2SPacket.interact(entity, mc.player.isSneaking(), Hand.MAIN_HAND));
} else {
int slot = InvUtils.findInHotbar(Items.CHEST).slot();
if (!InvUtils.swap(slot, true)) {
error("Cannot find chest in your hotbar, disabling...");
toggle();
}
}
} else if (slots == 0) {
if (isDupeTime()) {
if (!slotsToThrow.isEmpty()) {
if (faceDown.get())
Rotations.rotate(mc.player.getYaw(), 90, 99, this::drop);
else
drop();
} else {
for (int i = 2; i < getDupeSize() + 1; i++) {
slotsToThrow.add(i);
}
}
} else {
mc.player.closeHandledScreen();
mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.PRESS_SHIFT_KEY));
mc.player.setSneaking(true);
sneak = true;
}
} else if (!(mc.currentScreen instanceof HorseScreen))
mc.player.openRidingInventory();
else if (slots > 0) {
if (slotsToMove.isEmpty()) {
boolean empty = true;
for (int i = 2; i <= slots; i++) {
if (!(mc.player.currentScreenHandler.getStacks().get(i).isEmpty())) {
empty = false;
break;
}
}
if (empty) {
for (int i = slots + 2; i < mc.player.currentScreenHandler.getStacks().size(); i++) {
if (!(mc.player.currentScreenHandler.getStacks().get(i).isEmpty())) {
if (mc.player.currentScreenHandler.getSlot(i).getStack().getItem() == Items.CHEST)
continue;
if (!(mc.player.currentScreenHandler.getSlot(i).getStack().getItem() instanceof BlockItem && ((BlockItem) mc.player.currentScreenHandler.getSlot(i).getStack().getItem()).getBlock() instanceof ShulkerBoxBlock) && shulkersOnly.get())
continue;
slotsToMove.add(i);
if (slotsToMove.size() >= slots)
break;
}
}
} else {
noCancel = true;
mc.player.networkHandler.sendPacket(PlayerInteractEntityC2SPacket.interact(entity, mc.player.isSneaking(), Hand.MAIN_HAND));
noCancel = false;
return;
}
}
if (!slotsToMove.isEmpty()) {
for (int i : slotsToMove) {
InvUtils.quickMove().from(i).to(0);
}
slotsToMove.clear();
}
}
}
Aggregations