public void swingArm(EnumHand hand) { ItemStack stack = this.getHeldItem(hand); if (stack != null && stack.getItem() != null) { if (stack.getItem().onEntitySwing(this, stack)) return; } if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) { this.swingProgressInt = -1; this.isSwingInProgress = true; this.swingingHand = hand; if (this.worldObj instanceof WorldServer) { ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new SPacketAnimation(this, hand == EnumHand.MAIN_HAND ? 0 : 3)); } } }
/** * Wake up the player if they're sleeping. */ public void wakeUpPlayer(boolean immediately, boolean updateWorldFlag, boolean setSpawn) { if (this.isPlayerSleeping()) { this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(this, 2)); } super.wakeUpPlayer(immediately, updateWorldFlag, setSpawn); if (this.connection != null) { this.connection.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); } }
/** * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt * or receiving a critical hit by normal or magical means */ public void handleAnimation(SPacketAnimation packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID()); if (entity != null) { if (packetIn.getAnimationType() == 0) { EntityLivingBase entitylivingbase = (EntityLivingBase)entity; entitylivingbase.swingArm(EnumHand.MAIN_HAND); } else if (packetIn.getAnimationType() == 3) { EntityLivingBase entitylivingbase1 = (EntityLivingBase)entity; entitylivingbase1.swingArm(EnumHand.OFF_HAND); } else if (packetIn.getAnimationType() == 1) { entity.performHurtAnimation(); } else if (packetIn.getAnimationType() == 2) { EntityPlayer entityplayer = (EntityPlayer)entity; entityplayer.wakeUpPlayer(false, false, false); } else if (packetIn.getAnimationType() == 4) { this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT); } else if (packetIn.getAnimationType() == 5) { this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT_MAGIC); } } }
public void swingArm(EnumHand hand) { if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) { this.swingProgressInt = -1; this.isSwingInProgress = true; this.swingingHand = hand; if (this.world instanceof WorldServer) { ((WorldServer)this.world).getEntityTracker().sendToAllTrackingEntity(this, new SPacketAnimation(this, hand == EnumHand.MAIN_HAND ? 0 : 3)); } } }
public void onCriticalHit(Entity entityHit) { if(this.getWorld().isRemote) { Minecraft.getMinecraft().effectRenderer.emitParticleAtEntity(entityHit, EnumParticleTypes.CRIT); } else { WorldServer server = this.getServerWorld(); if(server != null) { server.getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 4)); } } }
public void onEnchantmentCritical(Entity entityHit) { if(this.getWorld().isRemote) { Minecraft.getMinecraft().effectRenderer.emitParticleAtEntity(entityHit, EnumParticleTypes.CRIT_MAGIC); } else { WorldServer server = this.getServerWorld(); if (server != null) { server.getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 5)); } } }
@Override public void swingArm(EnumHand hand) { // play eating sound playSound(getSoundManager().getAttackSound(), 1, 0.7f); // play attack animation if (worldObj instanceof WorldServer) { ((WorldServer) worldObj).getEntityTracker().sendToAllTrackingEntity( this, new SPacketAnimation(this, 0)); } }
/** * Called when the entity is dealt a critical hit. */ public void onCriticalHit(Entity entityHit) { this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 4)); }
public void onEnchantmentCritical(Entity entityHit) { this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 5)); }
/** * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt * or receiving a critical hit by normal or magical means */ void handleAnimation(SPacketAnimation packetIn);