public void dropPlayerItemWithRandomChoice(ItemStack itemstack, boolean flag) { if (itemstack == null) { return; } EntityItem entityitem = new EntityItem( worldObj, posX, (posY - 0.30000001192092896D) + (double) getEyeHeight(), posZ, itemstack); entityitem.delayBeforeCanPickup = 40; float f = 0.1F; if (flag) { float f2 = rand.nextFloat() * 0.5F; float f4 = rand.nextFloat() * 3.141593F * 2.0F; entityitem.motionX = -MathHelper.sin(f4) * f2; entityitem.motionZ = MathHelper.cos(f4) * f2; entityitem.motionY = 0.20000000298023224D; } else { float f1 = 0.3F; entityitem.motionX = -MathHelper.sin((rotationYaw / 180F) * 3.141593F) * MathHelper.cos((rotationPitch / 180F) * 3.141593F) * f1; entityitem.motionZ = MathHelper.cos((rotationYaw / 180F) * 3.141593F) * MathHelper.cos((rotationPitch / 180F) * 3.141593F) * f1; entityitem.motionY = -MathHelper.sin((rotationPitch / 180F) * 3.141593F) * f1 + 0.1F; f1 = 0.02F; float f3 = rand.nextFloat() * 3.141593F * 2.0F; f1 *= rand.nextFloat(); entityitem.motionX += Math.cos(f3) * (double) f1; entityitem.motionY += (rand.nextFloat() - rand.nextFloat()) * 0.1F; entityitem.motionZ += Math.sin(f3) * (double) f1; } joinEntityItemWithWorld(entityitem); addStat(StatList.dropStat, 1); }