    001    package net.minecraft.src;
    002
    003    import java.util.Random;
    004    import net.minecraft.server.MinecraftServer;
    005
    006    public class BehaviorDispenseFireball extends BehaviorDefaultDispenseItem
    007    {
    008        final MinecraftServer mcServer;
    009
    010        public BehaviorDispenseFireball(MinecraftServer par1MinecraftServer)
    011        {
    012            this.mcServer = par1MinecraftServer;
    013        }
    014
    015        /**
    016         * Dispense the specified stack, play the dispense sound and spawn particles.
    017         */
    018        public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
    019        {
    020            EnumFacing var3 = EnumFacing.func_82600_a(par1IBlockSource.func_82620_h());
    021            IPosition var4 = BlockDispenser.func_82525_a(par1IBlockSource);
    022            double var5 = var4.getX() + (double)((float)var3.func_82601_c() * 0.3F);
    023            double var7 = var4.getY();
    024            double var9 = var4.getZ() + (double)((float)var3.func_82599_e() * 0.3F);
    025            World var11 = par1IBlockSource.getWorld();
    026            Random var12 = var11.rand;
    027            double var13 = var12.nextGaussian() * 0.05D + (double)var3.func_82601_c();
    028            double var15 = var12.nextGaussian() * 0.05D;
    029            double var17 = var12.nextGaussian() * 0.05D + (double)var3.func_82599_e();
    030            var11.spawnEntityInWorld(new EntitySmallFireball(var11, var5, var7, var9, var13, var15, var17));
    031            par2ItemStack.splitStack(1);
    032            return par2ItemStack;
    033        }
    034
    035        /**
    036         * Play the dispense sound from the specified block.
    037         */
    038        protected void playDispenseSound(IBlockSource par1IBlockSource)
    039        {
    040            par1IBlockSource.getWorld().playAuxSFX(1009, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0);
    041        }
    042    }