@Override public void onDisable() { wurst.events.remove(UpdateListener.class, this); wurst.events.remove(PostUpdateListener.class, this); switch(mode.getSelected()) { case 0: WConnection.sendPacket(new CPacketEntityAction( WMinecraft.getPlayer(), Action.STOP_SNEAKING)); break; case 1: mc.gameSettings.keyBindSneak.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindSneak); break; } }
@Override public void onUpdate() { switch(mode.getSelected()) { case 0: WConnection.sendPacket(new CPacketEntityAction( WMinecraft.getPlayer(), Action.START_SNEAKING)); WConnection.sendPacket(new CPacketEntityAction( WMinecraft.getPlayer(), Action.STOP_SNEAKING)); break; case 1: mc.gameSettings.keyBindSneak.pressed = true; break; } }
@Override public void onUpdate() { mode = Client.getValueManager().getValueByName("DerpLegit").getValueBoolean(); Random rand = new Random(); int yaw = rand.nextInt((1000 - 0) + 1) + 0; int pitch = rand.nextInt((1000 - 0) + 1) + 0; if(mode){ mc.thePlayer.rotationYaw = yaw; mc.thePlayer.rotationPitch = pitch; KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), false); KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), true); }else{ mc.thePlayer.sendQueue.addToSendQueue(new C05PacketPlayerLook(yaw, pitch, mc.thePlayer.onGround)); mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, Action.STOP_SNEAKING)); mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, Action.START_SNEAKING)); } }
@Hook("net.minecraft.network.NetHandlerPlayServer#func_147357_a") public static Hook.Result processEntityAction(NetHandlerPlayServer handler, CPacketEntityAction action) { if (action.getAction() == Action.START_FALL_FLYING) { PacketThreadUtil.checkThreadAndEnqueue(action, handler, handler.player.getServerWorld()); handler.player.markPlayerActive(); if (!handler.player.onGround && handler.player.motionY < 0.0D && !handler.player.isElytraFlying() && !handler.player.isInWater()) { ItemStack item = getFormLiving0(handler.player); if (item.getItem() == Items.ELYTRA && ItemElytra.isUsable(item)) handler.player.setElytraFlying(); } else handler.player.clearElytraFlying(); return Hook.Result.NULL; } return Hook.Result.VOID; }
@SubscribeEvent public void onLocalPlayerUpdate(LocalPlayerUpdateEvent event) { try { double[] dir = moveLooking(0); double xDir = dir[0]; double zDir = dir[1]; if ((MC.gameSettings.keyBindForward.isKeyDown() || MC.gameSettings.keyBindLeft.isKeyDown() || MC.gameSettings.keyBindRight.isKeyDown() || MC.gameSettings.keyBindBack.isKeyDown()) && !MC.gameSettings.keyBindJump.isKeyDown()) { MC.player.motionX = xDir * 0.26; MC.player.motionZ = zDir * 0.26; } double posX = MC.player.posX + MC.player.motionX; double posY = MC.player.posY + (MC.gameSettings.keyBindJump.isKeyDown() ? (zoomies ? 0.0625 : 0.0624) : 0.00000001) - (MC.gameSettings.keyBindSneak.isKeyDown() ? (zoomies ? 0.0625 : 0.0624) : 0.00000002); double posZ = MC.player.posZ + MC.player.motionX; getNetworkManager().sendPacket(new CPacketPlayer.PositionRotation(MC.player.posX + MC.player.motionX, MC.player.posY + (MC.gameSettings.keyBindJump.isKeyDown() ? (zoomies ? 0.0625 : 0.0624) : 0.00000001) - (MC.gameSettings.keyBindSneak.isKeyDown() ? (zoomies ? 0.0625 : 0.0624) : 0.00000002), MC.player.posZ + MC.player.motionZ, MC.player.rotationYaw, MC.player.rotationPitch, false)); getNetworkManager().sendPacket(new CPacketPlayer.PositionRotation(MC.player.posX + MC.player.motionX, 1337 + MC.player.posY, MC.player.posZ + MC.player.motionZ, MC.player.rotationYaw, MC.player.rotationPitch, true)); getNetworkManager().sendPacket(new CPacketEntityAction(MC.player, Action.START_FALL_FLYING)); MC.player.setPosition(posX, posY, posZ); zoomies = !zoomies; MC.player.motionX = 0; MC.player.motionY = 0; MC.player.motionZ = 0; MC.player.noClip = true; } catch (Exception e) { Helper.printStackTrace(e); } }
@Override protected void onEnabled() { if(fly_on_enable.get()) MC.addScheduledTask(() -> { if(getLocalPlayer() != null && !getLocalPlayer().isElytraFlying()) getNetworkManager().sendPacket(new CPacketEntityAction(getLocalPlayer(), Action.START_FALL_FLYING)); }); }
@Override public void onDisabled() { // Are we still here? if (getLocalPlayer() != null) { // Disable creativeflight. getLocalPlayer().capabilities.isFlying = false; // Ensure the player starts flying again. getNetworkManager().sendPacket(new CPacketEntityAction(getLocalPlayer(), Action.START_FALL_FLYING)); } }
@Override public void afterUpdate() { if(mode.getSelected() == 1) return; WConnection.sendPacket(new CPacketEntityAction(WMinecraft.getPlayer(), Action.STOP_SNEAKING)); WConnection.sendPacket(new CPacketEntityAction(WMinecraft.getPlayer(), Action.START_SNEAKING)); }
@Override public void onUpdate() { legit = Client.getValueManager().getValueByName("SneakLegit").getValueBoolean(); if(legit){ KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), true); }else{ mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, CPacketEntityAction.Action.START_SNEAKING)); } }
@Override public void onUpdate() { legit = Client.getValueManager().getValueByName("SprintLegit").getValueBoolean(); if(legit){ if (canSprint()) { mc.thePlayer.setSprinting(true); }else{ mc.thePlayer.setSprinting(false); } }else{ mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, CPacketEntityAction.Action.START_SPRINTING)); } }
@Override public void onDisable() { if(mc.inGameHasFocus){ mc.thePlayer.setSprinting(false); mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, CPacketEntityAction.Action.START_SPRINTING)); } }
@Hook(value = "net.minecraft.client.entity.EntityPlayerSP#func_70636_d", type = Type.TAIL) public static void onLivingUpdate_tail(EntityPlayerSP player) { ItemStack item = getFormLiving0(player); KeyBinding jump = Minecraft.getMinecraft().gameSettings.keyBindJump; boolean flag = Keyboard.isKeyDown(jump.getKeyCode()); if (item.getItem() == Items.ELYTRA) { if (flag && jump.getKeyConflictContext().isActive() && !HookClient.flag && player.motionY < 0.0D && !player.isElytraFlying() && !player.capabilities.isFlying) if (ItemElytra.isUsable(item)) player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.START_FALL_FLYING)); } HookClient.flag = flag; }
/** * @reason In addition to firing pre and post events, we also want to override some position values (prefixed with p). * @author Brady */ @Overwrite private void onUpdateWalkingPlayer() { EntityPlayerSP _this = (EntityPlayerSP) (Object) this; MotionUpdateEvent pre = new MotionUpdateEvent(EventState.PRE); ClientAPI.EVENT_BUS.post(pre); boolean clientSprintState = this.isSprinting(); if (clientSprintState != this.serverSprintState) { this.connection.sendPacket(new CPacketEntityAction(_this, clientSprintState ? CPacketEntityAction.Action.START_SPRINTING : CPacketEntityAction.Action.STOP_SPRINTING)); this.serverSprintState = clientSprintState; } boolean clientSneakState = this.isSneaking(); if (clientSneakState != this.serverSneakState) { this.connection.sendPacket(new CPacketEntityAction(_this, clientSneakState ? CPacketEntityAction.Action.START_SNEAKING : CPacketEntityAction.Action.STOP_SNEAKING)); this.serverSneakState = clientSneakState; } if (this.isCurrentViewEntity()) { // Override vanilla defaults of this.posX, this.posY, etc. // This is why we need to overwrite the method body. double pX = pre.getX(); double pY = pre.getY(); double pZ = pre.getZ(); float pYaw = pre.getYaw(); float pPitch = pre.getPitch(); boolean pGround = pre.isOnGround(); double d0 = pX - this.lastReportedPosX; double d1 = pY - this.lastReportedPosY; double d2 = pZ - this.lastReportedPosZ; double d3 = pYaw - this.lastReportedYaw; double d4 = pPitch - this.lastReportedPitch; boolean position = d0 * d0 + d1 * d1 + d2 * d2 > 9.0E-4D || ++this.positionUpdateTicks >= 20; boolean rotation = d3 != 0.0D || d4 != 0.0D; if (this.isRiding()) { this.connection.sendPacket(new CPacketPlayer.PositionRotation(this.motionX, -999.0D, this.motionZ, this.rotationYaw, this.rotationPitch, this.onGround)); position = false; } else if (position && rotation) { this.connection.sendPacket(new CPacketPlayer.PositionRotation(pX, pY, pZ, pYaw, pPitch, pGround)); } else if (position) { this.connection.sendPacket(new CPacketPlayer.Position(pX, pY, pZ, pGround)); } else if (rotation) { this.connection.sendPacket(new CPacketPlayer.Rotation(pYaw, pPitch, pGround)); } else if (this.prevOnGround != pGround) { this.connection.sendPacket(new CPacketPlayer(pGround)); } if (position) { this.lastReportedPosX = pX; this.lastReportedPosY = pY; this.lastReportedPosZ = pZ; this.positionUpdateTicks = 0; } if (rotation) { this.lastReportedYaw = pYaw; this.lastReportedPitch = pPitch; } this.prevOnGround = pGround; this.autoJumpEnabled = this.mc.gameSettings.autoJump; } ClientAPI.EVENT_BUS.post(new MotionUpdateEvent(EventState.POST)); }
protected void sendHorseJump() { this.connection.sendPacket(new CPacketEntityAction(this, CPacketEntityAction.Action.START_RIDING_JUMP, MathHelper.floor(this.getHorseJumpPower() * 100.0F))); }
public void sendHorseInventory() { this.connection.sendPacket(new CPacketEntityAction(this, CPacketEntityAction.Action.OPEN_INVENTORY)); }
private void wakeFromSleep() { NetHandlerPlayClient nethandlerplayclient = this.mc.player.connection; nethandlerplayclient.sendPacket(new CPacketEntityAction(this.mc.player, CPacketEntityAction.Action.STOP_SLEEPING)); }
/** * Processes a range of action-types: sneaking, sprinting, waking from sleep, opening the inventory or setting jump * height of the horse the player is riding */ public void processEntityAction(CPacketEntityAction packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld()); this.playerEntity.markPlayerActive(); switch (packetIn.getAction()) { case START_SNEAKING: this.playerEntity.setSneaking(true); break; case STOP_SNEAKING: this.playerEntity.setSneaking(false); break; case START_SPRINTING: this.playerEntity.setSprinting(true); break; case STOP_SPRINTING: this.playerEntity.setSprinting(false); break; case STOP_SLEEPING: this.playerEntity.wakeUpPlayer(false, true, true); this.targetPos = new Vec3d(this.playerEntity.posX, this.playerEntity.posY, this.playerEntity.posZ); break; case START_RIDING_JUMP: if (this.playerEntity.getRidingEntity() instanceof IJumpingMount) { IJumpingMount ijumpingmount1 = (IJumpingMount)this.playerEntity.getRidingEntity(); int i = packetIn.getAuxData(); if (ijumpingmount1.canJump() && i > 0) { ijumpingmount1.handleStartJump(i); } } break; case STOP_RIDING_JUMP: if (this.playerEntity.getRidingEntity() instanceof IJumpingMount) { IJumpingMount ijumpingmount = (IJumpingMount)this.playerEntity.getRidingEntity(); ijumpingmount.handleStopJump(); } break; case OPEN_INVENTORY: if (this.playerEntity.getRidingEntity() instanceof EntityHorse) { ((EntityHorse)this.playerEntity.getRidingEntity()).openGUI(this.playerEntity); } break; case START_FALL_FLYING: if (!this.playerEntity.onGround && this.playerEntity.motionY < 0.0D && !this.playerEntity.isElytraFlying() && !this.playerEntity.isInWater()) { ItemStack itemstack = this.playerEntity.getItemStackFromSlot(EntityEquipmentSlot.CHEST); if (itemstack != null && itemstack.getItem() == Items.ELYTRA && ItemElytra.isBroken(itemstack)) { this.playerEntity.setElytraFlying(); } } else { this.playerEntity.clearElytraFlying(); } break; default: throw new IllegalArgumentException("Invalid client command!"); } }
protected void sendHorseJump() { this.connection.sendPacket(new CPacketEntityAction(this, CPacketEntityAction.Action.START_RIDING_JUMP, MathHelper.floor_float(this.getHorseJumpPower() * 100.0F))); }
private void wakeFromSleep() { NetHandlerPlayClient nethandlerplayclient = this.mc.thePlayer.connection; nethandlerplayclient.sendPacket(new CPacketEntityAction(this.mc.thePlayer, CPacketEntityAction.Action.STOP_SLEEPING)); }
@Override public void processEntityAction(CPacketEntityAction p_147357_1_) { }
@Override public void onDisable() { KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), false); mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, CPacketEntityAction.Action.STOP_SNEAKING)); }
@Override public void processEntityAction(@Nonnull CPacketEntityAction p_147357_1_) { }
@Override public void processEntityAction(CPacketEntityAction packetIn) { }
/** * Processes a range of action-types: sneaking, sprinting, waking from sleep, opening the inventory or setting jump * height of the horse the player is riding */ void processEntityAction(CPacketEntityAction packetIn);