protected void updateItemUse(Entity pEntity, int par2) { if (itemInUse.getItemUseAction() == EnumAction.DRINK) { pEntity.playSound("random.drink", 0.5F, pEntity.worldObj.rand.nextFloat() * 0.1F + 0.9F); } Random rand = new Random(); if (itemInUse.getItemUseAction() == EnumAction.EAT) { for (int var3 = 0; var3 < par2; ++var3) { /* Vec3 var4 = new Vec3(((double)rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); var4.rotateAroundX(-pEntity.rotationPitch * (float)Math.PI / 180.0F); var4.rotateAroundY(-pEntity.rotationYaw * (float)Math.PI / 180.0F); Vec3 var5 = new Vec3((double)rand.nextFloat() - 0.5D) * 0.3D, (double)(-rand.nextFloat()) * 0.6D - 0.3D, 0.6D); var5.rotateAroundX(-pEntity.rotationPitch * (float)Math.PI / 180.0F); var5.rotateAroundY(-pEntity.rotationYaw * (float)Math.PI / 180.0F); var5 = var5.addVector(pEntity.posX, pEntity.posY + (double)pEntity.getEyeHeight(), pEntity.posZ); */ pEntity.worldObj.spawnParticle( EnumParticleTypes.ITEM_CRACK, pEntity.posX, pEntity.posY, pEntity.posZ, (rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); } pEntity.playSound( "random.eat", 0.5F + 0.5F * rand.nextInt(2), (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F); } }
public void func_151367_b(EntityLivingBase p_151367_1_, Entity p_151367_2_, int p_151367_3_) { Random random = p_151367_1_.getRNG(); ItemStack itemstack = EnchantmentHelper.func_92099_a(Enchantment.thorns, p_151367_1_); if (func_92094_a(p_151367_3_, random)) { p_151367_2_.attackEntityFrom( DamageSource.causeThornsDamage(p_151367_1_), (float) func_92095_b(p_151367_3_, random)); p_151367_2_.playSound("damage.thorns", 0.5F, 1.0F); if (itemstack != null) { itemstack.damageItem(3, p_151367_1_); } } else if (itemstack != null) { itemstack.damageItem(1, p_151367_1_); } }
public static void func_92096_a( Entity par0Entity, EntityLivingBase par1EntityLivingBase, Random par2Random) { int i = EnchantmentHelper.func_92098_i(par1EntityLivingBase); ItemStack itemstack = EnchantmentHelper.func_92099_a(Enchantment.thorns, par1EntityLivingBase); if (func_92094_a(i, par2Random)) { par0Entity.attackEntityFrom( DamageSource.causeThornsDamage(par1EntityLivingBase), (float) func_92095_b(i, par2Random)); par0Entity.playSound("damage.thorns", 0.5F, 1.0F); if (itemstack != null) { itemstack.damageItem(3, par1EntityLivingBase); } } else if (itemstack != null) { itemstack.damageItem(1, par1EntityLivingBase); } }