    001    package net.minecraft.src;
    002
    003    public class BehaviorDefaultDispenseItem implements IBehaviorDispenseItem
    004    {
    005        public final ItemStack func_82482_a(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
    006        {
    007            ItemStack var3 = this.func_82487_b(par1IBlockSource, par2ItemStack);
    008            this.func_82485_a(par1IBlockSource);
    009            this.func_82489_a(par1IBlockSource, EnumFacing.func_82600_a(par1IBlockSource.func_82620_h()));
    010            return var3;
    011        }
    012
    013        protected ItemStack func_82487_b(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
    014        {
    015            EnumFacing var3 = EnumFacing.func_82600_a(par1IBlockSource.func_82620_h());
    016            IPosition var4 = BlockDispenser.func_82525_a(par1IBlockSource);
    017            ItemStack var5 = par2ItemStack.splitStack(1);
    018            func_82486_a(par1IBlockSource.func_82618_k(), var5, 6, var3, var4);
    019            return par2ItemStack;
    020        }
    021
    022        public static void func_82486_a(World par0World, ItemStack par1ItemStack, int par2, EnumFacing par3EnumFacing, IPosition par4IPosition)
    023        {
    024            double var5 = par4IPosition.func_82615_a();
    025            double var7 = par4IPosition.func_82617_b();
    026            double var9 = par4IPosition.func_82616_c();
    027            EntityItem var11 = new EntityItem(par0World, var5, var7 - 0.3D, var9, par1ItemStack);
    028            double var12 = par0World.rand.nextDouble() * 0.1D + 0.2D;
    029            var11.motionX = (double)par3EnumFacing.func_82601_c() * var12;
    030            var11.motionY = 0.20000000298023224D;
    031            var11.motionZ = (double)par3EnumFacing.func_82599_e() * var12;
    032            var11.motionX += par0World.rand.nextGaussian() * 0.007499999832361937D * (double)par2;
    033            var11.motionY += par0World.rand.nextGaussian() * 0.007499999832361937D * (double)par2;
    034            var11.motionZ += par0World.rand.nextGaussian() * 0.007499999832361937D * (double)par2;
    035            par0World.spawnEntityInWorld(var11);
    036        }
    037
    038        protected void func_82485_a(IBlockSource par1IBlockSource)
    039        {
    040            par1IBlockSource.func_82618_k().playAuxSFX(1000, par1IBlockSource.func_82623_d(), par1IBlockSource.func_82622_e(), par1IBlockSource.func_82621_f(), 0);
    041        }
    042
    043        protected void func_82489_a(IBlockSource par1IBlockSource, EnumFacing par2EnumFacing)
    044        {
    045            par1IBlockSource.func_82618_k().playAuxSFX(2000, par1IBlockSource.func_82623_d(), par1IBlockSource.func_82622_e(), par1IBlockSource.func_82621_f(), this.func_82488_a(par2EnumFacing));
    046        }
    047
    048        private int func_82488_a(EnumFacing par1EnumFacing)
    049        {
    050            return par1EnumFacing.func_82601_c() + 1 + (par1EnumFacing.func_82599_e() + 1) * 3;
    051        }
    052    }