    001    package net.minecraft.dispenser;
    002
    003    import net.minecraft.block.BlockDispenser;
    004    import net.minecraft.entity.Entity;
    005    import net.minecraft.entity.IProjectile;
    006    import net.minecraft.item.ItemStack;
    007    import net.minecraft.util.EnumFacing;
    008    import net.minecraft.world.World;
    009
    010    public abstract class BehaviorProjectileDispense extends BehaviorDefaultDispenseItem
    011    {
    012        /**
    013         * Dispense the specified stack, play the dispense sound and spawn particles.
    014         */
    015        public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
    016        {
    017            World var3 = par1IBlockSource.getWorld();
    018            IPosition var4 = BlockDispenser.func_82525_a(par1IBlockSource);
    019            EnumFacing var5 = EnumFacing.func_82600_a(par1IBlockSource.func_82620_h());
    020            IProjectile var6 = this.getProjectileEntity(var3, var4);
    021            var6.setThrowableHeading((double)var5.func_82601_c(), 0.10000000149011612D, (double)var5.func_82599_e(), this.func_82500_b(), this.func_82498_a());
    022            var3.spawnEntityInWorld((Entity)var6);
    023            par2ItemStack.splitStack(1);
    024            return par2ItemStack;
    025        }
    026
    027        /**
    028         * Play the dispense sound from the specified block.
    029         */
    030        protected void playDispenseSound(IBlockSource par1IBlockSource)
    031        {
    032            par1IBlockSource.getWorld().playAuxSFX(1002, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0);
    033        }
    034
    035        /**
    036         * Return the projectile entity spawned by this dispense behavior.
    037         */
    038        protected abstract IProjectile getProjectileEntity(World var1, IPosition var2);
    039
    040        protected float func_82498_a()
    041        {
    042            return 6.0F;
    043        }
    044
    045        protected float func_82500_b()
    046        {
    047            return 1.1F;
    048        }
    049    }