@EventTarget(value=0) private void onUpdate(UpdateEvent event) { if (event.state == Event.State.PRE) { if (this.spinny) { this.serverYaw += this.increment; event.yaw = (float)this.serverYaw; } if (this.headless) { event.pitch = 180.0f; } if (!this.headless && !this.spinny) { event.yaw = (float)(Math.random() * 360.0); event.pitch = (float)(Math.random() * 360.0); this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C0APacketAnimation()); } } }
private void swingItem() { if (this.noSwing) { this.mc.thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation()); } else { this.mc.thePlayer.swingItem(); } }
@EventTarget private void onPacketSend(PacketSendEvent event) { if (event.packet instanceof C0BPacketEntityAction || event.packet instanceof C03PacketPlayer || event.packet instanceof C02PacketUseEntity || event.packet instanceof C0APacketAnimation || event.packet instanceof C08PacketPlayerBlockPlacement) { this.packetList.add(event.packet); event.setCancelled(true); } }
/** * Processes the player swinging its held item */ public void processAnimation(C0APacketAnimation p_147350_1_) { this.playerEntity.func_143004_u(); if (p_147350_1_.func_149421_d() == 1) { this.playerEntity.swingItem(); } }
public void processAnimation(C0APacketAnimation p_147350_1_) { this.playerEntity.func_143004_u(); if (p_147350_1_.func_149421_d() == 1) { this.playerEntity.swingItem(); } }
public void handleAnimation(C0APacketAnimation packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); this.playerEntity.markPlayerActive(); this.playerEntity.swingItem(); }
/** * Swings the item the player is holding. */ public void swingItem() { super.swingItem(); this.sendQueue.addToSendQueue(new C0APacketAnimation()); }
@Override public void onUpdate() { shouldRenderESP = false; BlockPos newPos = find(); if (newPos == null) { if (oldSlot != -1) { Minecraft.getMinecraft().thePlayer.inventory.currentItem = oldSlot; oldSlot = -1; } return; } if (pos == null || !pos.equals(newPos)) currentDamage = 0; pos = newPos; currentBlock = Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock(); if (blockHitDelay > 0) { blockHitDelay--; return; } BlockUtils.faceBlockClient(pos); if (currentDamage == 0) { Minecraft.getMinecraft().thePlayer.sendQueue .addToSendQueue(new C07PacketPlayerDigging(Action.START_DESTROY_BLOCK, pos, side)); if (WurstClient.INSTANCE.mods.getModByClass(AutoToolMod.class).isActive() && oldSlot == -1) { oldSlot = Minecraft.getMinecraft().thePlayer.inventory.currentItem; } if (Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode || currentBlock .getPlayerRelativeBlockHardness(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, pos) >= 1) { currentDamage = 0; shouldRenderESP = true; Minecraft.getMinecraft().thePlayer.swingItem(); Minecraft.getMinecraft().playerController.onPlayerDestroyBlock(pos, side); blockHitDelay = (byte) 4; return; } } if (WurstClient.INSTANCE.mods.getModByClass(AutoToolMod.class).isActive()) AutoToolMod.setSlot(pos); Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation()); shouldRenderESP = true; currentDamage += currentBlock .getPlayerRelativeBlockHardness(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, pos); Minecraft.getMinecraft().theWorld.sendBlockBreakProgress(Minecraft.getMinecraft().thePlayer.getEntityId(), pos, (int) (currentDamage * 10.0F) - 1); if (currentDamage >= 1) { Minecraft.getMinecraft().thePlayer.sendQueue .addToSendQueue(new C07PacketPlayerDigging(Action.STOP_DESTROY_BLOCK, pos, side)); Minecraft.getMinecraft().playerController.onPlayerDestroyBlock(pos, side); blockHitDelay = (byte) 4; currentDamage = 0; } }
@Override public void onUpdate() { if (WurstClient.INSTANCE.mods.getModByClass(YesCheatMod.class).isActive()) { realRange = yesCheatRange; } else { realRange = normalRange; } shouldRenderESP = false; BlockPos newPos = find(); if (newPos == null) { if (oldSlot != -1) { Minecraft.getMinecraft().thePlayer.inventory.currentItem = oldSlot; oldSlot = -1; } return; } if (pos == null || !pos.equals(newPos)) currentDamage = 0; pos = newPos; currentBlock = Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock(); if (blockHitDelay > 0) { blockHitDelay--; return; } BlockUtils.faceBlockPacket(pos); if (currentDamage == 0) { Minecraft.getMinecraft().thePlayer.sendQueue .addToSendQueue(new C07PacketPlayerDigging(Action.START_DESTROY_BLOCK, pos, side)); if (WurstClient.INSTANCE.mods.getModByClass(AutoToolMod.class).isActive() && oldSlot == -1) { oldSlot = Minecraft.getMinecraft().thePlayer.inventory.currentItem; } if (Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode || currentBlock .getPlayerRelativeBlockHardness(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, pos) >= 1) { currentDamage = 0; if (Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode && !WurstClient.INSTANCE.mods.getModByClass(YesCheatMod.class).isActive()) { nukeAll(); } else { shouldRenderESP = true; Minecraft.getMinecraft().thePlayer.swingItem(); Minecraft.getMinecraft().playerController.onPlayerDestroyBlock(pos, side); } return; } } if (WurstClient.INSTANCE.mods.getModByClass(AutoToolMod.class).isActive()) AutoToolMod.setSlot(pos); Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation()); shouldRenderESP = true; BlockUtils.faceBlockPacket(pos); currentDamage += currentBlock .getPlayerRelativeBlockHardness(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, pos) * (WurstClient.INSTANCE.mods.getModByClass(FastBreakMod.class).isActive() && WurstClient.INSTANCE.options.fastbreakMode == 0 ? (WurstClient.INSTANCE.mods.getModByClass(FastBreakMod.class)).speed : 1); Minecraft.getMinecraft().theWorld.sendBlockBreakProgress(Minecraft.getMinecraft().thePlayer.getEntityId(), pos, (int) (currentDamage * 10.0F) - 1); if (currentDamage >= 1) { Minecraft.getMinecraft().thePlayer.sendQueue .addToSendQueue(new C07PacketPlayerDigging(Action.STOP_DESTROY_BLOCK, pos, side)); Minecraft.getMinecraft().playerController.onPlayerDestroyBlock(pos, side); blockHitDelay = (byte) 4; currentDamage = 0; } else if (WurstClient.INSTANCE.mods.getModByClass(FastBreakMod.class).isActive() && WurstClient.INSTANCE.options.fastbreakMode == 1) { Minecraft.getMinecraft().thePlayer.sendQueue .addToSendQueue(new C07PacketPlayerDigging(Action.STOP_DESTROY_BLOCK, pos, side)); } }
@Override public void onUpdate() { shouldRenderESP = false; BlockPos newPos = find(); if (newPos == null) { if (oldSlot != -1) { Minecraft.getMinecraft().thePlayer.inventory.currentItem = oldSlot; oldSlot = -1; } return; } if (pos == null || !pos.equals(newPos)) currentDamage = 0; pos = newPos; currentBlock = Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock(); if (blockHitDelay > 0) { blockHitDelay--; return; } BlockUtils.faceBlockPacket(pos); if (currentDamage == 0) { Minecraft.getMinecraft().thePlayer.sendQueue .addToSendQueue(new C07PacketPlayerDigging(Action.START_DESTROY_BLOCK, pos, side)); if (WurstClient.INSTANCE.mods.getModByClass(AutoToolMod.class).isActive() && oldSlot == -1) { oldSlot = Minecraft.getMinecraft().thePlayer.inventory.currentItem; } if (Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode || currentBlock .getPlayerRelativeBlockHardness(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, pos) >= 1) { currentDamage = 0; if (Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode && !WurstClient.INSTANCE.mods.getModByClass(YesCheatMod.class).isActive()) { nukeAll(); } else { shouldRenderESP = true; Minecraft.getMinecraft().thePlayer.swingItem(); Minecraft.getMinecraft().playerController.onPlayerDestroyBlock(pos, side); } return; } } if (WurstClient.INSTANCE.mods.getModByClass(AutoToolMod.class).isActive()) AutoToolMod.setSlot(pos); Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation()); shouldRenderESP = true; BlockUtils.faceBlockPacket(pos); currentDamage += currentBlock .getPlayerRelativeBlockHardness(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, pos) * (WurstClient.INSTANCE.mods.getModByClass(FastBreakMod.class).isActive() && WurstClient.INSTANCE.options.fastbreakMode == 0 ? (WurstClient.INSTANCE.mods.getModByClass(FastBreakMod.class)).speed : 1); Minecraft.getMinecraft().theWorld.sendBlockBreakProgress(Minecraft.getMinecraft().thePlayer.getEntityId(), pos, (int) (currentDamage * 10.0F) - 1); if (currentDamage >= 1) { Minecraft.getMinecraft().thePlayer.sendQueue .addToSendQueue(new C07PacketPlayerDigging(Action.STOP_DESTROY_BLOCK, pos, side)); Minecraft.getMinecraft().playerController.onPlayerDestroyBlock(pos, side); blockHitDelay = (byte) 4; currentDamage = 0; } else if (WurstClient.INSTANCE.mods.getModByClass(FastBreakMod.class).isActive() && WurstClient.INSTANCE.options.fastbreakMode == 1) { Minecraft.getMinecraft().thePlayer.sendQueue .addToSendQueue(new C07PacketPlayerDigging(Action.STOP_DESTROY_BLOCK, pos, side)); } }
/** * Swings the item the player is holding. */ public void swingItem() { super.swingItem(); this.sendQueue.addToSendQueue(new C0APacketAnimation(this, 1)); }
@Override public void processAnimation(C0APacketAnimation p_147350_1_) { }
public void processAnimation(C0APacketAnimation p_147350_1_) { if (this.playerEntity.isDead) { return; // CraftBukkit } this.playerEntity.func_143004_u(); if (p_147350_1_.func_149421_d() == 1) { // CraftBukkit start - Raytrace to look for 'rogue armswings' float f = 1.0F; float f1 = this.playerEntity.prevRotationPitch + (this.playerEntity.rotationPitch - this.playerEntity.prevRotationPitch) * f; float f2 = this.playerEntity.prevRotationYaw + (this.playerEntity.rotationYaw - this.playerEntity.prevRotationYaw) * f; double d0 = this.playerEntity.prevPosX + (this.playerEntity.posX - this.playerEntity.prevPosX) * (double) f; double d1 = this.playerEntity.prevPosY + (this.playerEntity.posY - this.playerEntity.prevPosY) * (double) f + 1.62D - (double) this.playerEntity.yOffset; double d2 = this.playerEntity.prevPosZ + (this.playerEntity.posZ - this.playerEntity.prevPosZ) * (double) f; Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI); float f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI); float f5 = -MathHelper.cos(-f1 * 0.017453292F); float f6 = MathHelper.sin(-f1 * 0.017453292F); float f7 = f4 * f5; float f8 = f3 * f5; double d3 = 5.0D; Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); MovingObjectPosition movingobjectposition = this.playerEntity.worldObj.rayTraceBlocks(vec3, vec31, true); boolean valid = false; if (movingobjectposition == null || movingobjectposition.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) { valid = true; } else { Block block = this.playerEntity.worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); if (!block.isOpaqueCube()) // Should be isBreakable? { valid = true; } } if (valid) { CraftEventFactory.callPlayerInteractEvent(this.playerEntity, Action.LEFT_CLICK_AIR, this.playerEntity.inventory.getCurrentItem()); } // Arm swing animation PlayerAnimationEvent event = new PlayerAnimationEvent(this.getPlayerB()); this.server.getPluginManager().callEvent(event); if (event.isCancelled()) { return; } // CraftBukkit end this.playerEntity.swingItem(); } }
public void swingItem() { super.swingItem(); this.sendQueue.addToSendQueue(new C0APacketAnimation(this, 1)); }
/** * Processes the player swinging its held item */ void processAnimation(C0APacketAnimation var1);
void handleAnimation(C0APacketAnimation packetIn);
void processAnimation(C0APacketAnimation p_147350_1_);