/** * 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(S0BPacketAnimation 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.swingItem(); } 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 boolean interactFirst(EntityPlayer player) { if ((!this.worldObj.isRemote) && (getGrabbed()) && (getThrower() == player)) { if (player.isSneaking()) { return super.interactFirst(player); } setGrabbed(false); moveTowardsHeading(player); ItemStack stack = player.getCurrentEquippedItem(); if ((stack != null) && (stack.getItem() == PixelGalaxyItems.pixeltrix_EndermanDNA)) { stack.damageItem(1, player); } PixelGalaxyMod.sendPacketToAll(player, new S0BPacketAnimation(player, 0)); } return super.interactFirst(player); }
public void swingItem() { ItemStack stack = this.getHeldItem(); if (stack != null && stack.getItem() != null) { Item item = stack.getItem(); if (item.onEntitySwing(this, stack)) { return; } } if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) { this.swingProgressInt = -1; this.isSwingInProgress = true; if (this.worldObj instanceof WorldServer) { ((WorldServer)this.worldObj).getEntityTracker().func_151247_a(this, new S0BPacketAnimation(this, 0)); } } }
public void wakeUpPlayer(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { if (this.fauxSleeping && !this.sleeping) { return; // CraftBukkit - Can't leave bed if not in one! } if (this.isPlayerSleeping()) { this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(this, 2)); } super.wakeUpPlayer(p_70999_1_, p_70999_2_, p_70999_3_); if (this.playerNetServerHandler != null) { this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); } }
/** * Swings the item the player is holding. */ public void swingItem() { if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) { this.swingProgressInt = -1; this.isSwingInProgress = true; if (this.worldObj instanceof WorldServer) { ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new S0BPacketAnimation(this, 0)); } } }
/** * Wake up the player if they're sleeping. */ public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) { if (this.isPlayerSleeping()) { this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(this, 2)); } super.wakeUpPlayer(p_70999_1_, updateWorldFlag, setSpawn); if (this.playerNetServerHandler != null) { this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); } }
/** * sets the itemInUse when the use item button is clicked. Args: itemstack, int maxItemUseDuration */ public void setItemInUse(ItemStack stack, int duration) { super.setItemInUse(stack, duration); if (stack != null && stack.getItem() != null && stack.getItem().getItemUseAction(stack) == EnumAction.EAT) { this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(this, 3)); } }
/** * 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(S0BPacketAnimation 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.swingItem(); } 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); } } }
/** * Swings the item the player is holding. */ public void swingItem() { if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) { this.swingProgressInt = -1; this.isSwingInProgress = true; if (this.worldObj instanceof WorldServer) { ((WorldServer)this.worldObj).getEntityTracker().func_151247_a(this, new S0BPacketAnimation(this, 0)); } } }
/** * Wake up the player if they're sleeping. */ public void wakeUpPlayer(boolean par1, boolean par2, boolean par3) { if (this.isPlayerSleeping()) { this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(this, 2)); } super.wakeUpPlayer(par1, par2, par3); if (this.playerNetServerHandler != null) { this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); } }
/** * sets the itemInUse when the use item button is clicked. Args: itemstack, int maxItemUseDuration */ public void setItemInUse(ItemStack par1ItemStack, int par2) { super.setItemInUse(par1ItemStack, par2); if (par1ItemStack != null && par1ItemStack.getItem() != null && par1ItemStack.getItem().getItemUseAction(par1ItemStack) == EnumAction.eat) { this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(this, 3)); } }
/** * 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(S0BPacketAnimation p_147279_1_) { Entity var2 = this.clientWorldController.getEntityByID(p_147279_1_.func_148978_c()); if (var2 != null) { if (p_147279_1_.func_148977_d() == 0) { EntityLivingBase var3 = (EntityLivingBase)var2; var3.swingItem(); } else if (p_147279_1_.func_148977_d() == 1) { var2.performHurtAnimation(); } else if (p_147279_1_.func_148977_d() == 2) { EntityPlayer var4 = (EntityPlayer)var2; var4.wakeUpPlayer(false, false, false); } else if (p_147279_1_.func_148977_d() == 4) { this.gameController.effectRenderer.addEffect(new EntityCrit2FX(this.gameController.theWorld, var2)); } else if (p_147279_1_.func_148977_d() == 5) { EntityCrit2FX var5 = new EntityCrit2FX(this.gameController.theWorld, var2, "magicCrit"); this.gameController.effectRenderer.addEffect(var5); } } }
public void setItemInUse(ItemStack p_71008_1_, int p_71008_2_) { super.setItemInUse(p_71008_1_, p_71008_2_); if (p_71008_1_ != null && p_71008_1_.getItem() != null && p_71008_1_.getItem().getItemUseAction(p_71008_1_) == EnumAction.eat) { this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(this, 3)); } }
public void handleAnimation(S0BPacketAnimation p_147279_1_) { Entity entity = this.clientWorldController.getEntityByID(p_147279_1_.func_148978_c()); if (entity != null) { if (p_147279_1_.func_148977_d() == 0) { EntityLivingBase entitylivingbase = (EntityLivingBase)entity; entitylivingbase.swingItem(); } else if (p_147279_1_.func_148977_d() == 1) { entity.performHurtAnimation(); } else if (p_147279_1_.func_148977_d() == 2) { EntityPlayer entityplayer = (EntityPlayer)entity; entityplayer.wakeUpPlayer(false, false, false); } else if (p_147279_1_.func_148977_d() == 4) { this.gameController.effectRenderer.addEffect(new EntityCrit2FX(this.gameController.theWorld, entity)); } else if (p_147279_1_.func_148977_d() == 5) { EntityCrit2FX entitycrit2fx = new EntityCrit2FX(this.gameController.theWorld, entity, "magicCrit"); this.gameController.effectRenderer.addEffect(entitycrit2fx); } } }
public void wakeUpPlayer(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { if (this.isPlayerSleeping()) { this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(this, 2)); } super.wakeUpPlayer(p_70999_1_, p_70999_2_, p_70999_3_); if (this.playerNetServerHandler != null) { this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); } }
/** * Called when the player performs a critical hit on the Entity. Args: entity that was hit critically */ public void onCriticalHit(Entity entityHit) { this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(entityHit, 4)); }
public void onEnchantmentCritical(Entity entityHit) { this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(entityHit, 5)); }
/** * Called when the player performs a critical hit on the Entity. Args: entity that was hit critically */ public void onCriticalHit(Entity par1Entity) { this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(par1Entity, 4)); }
public void onEnchantmentCritical(Entity par1Entity) { this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(par1Entity, 5)); }