    001    package net.minecraft.dispenser;
    002
    003    import net.minecraft.item.ItemMonsterPlacer;
    004    import net.minecraft.item.ItemStack;
    005    import net.minecraft.server.MinecraftServer;
    006    import net.minecraft.util.EnumFacing;
    007
    008    public class BehaviorMobEggDispense extends BehaviorDefaultDispenseItem
    009    {
    010        /** Reference to the MinecraftServer object. */
    011        final MinecraftServer mcServer;
    012
    013        public BehaviorMobEggDispense(MinecraftServer par1)
    014        {
    015            this.mcServer = par1;
    016        }
    017
    018        /**
    019         * Dispense the specified stack, play the dispense sound and spawn particles.
    020         */
    021        public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
    022        {
    023            EnumFacing var3 = EnumFacing.func_82600_a(par1IBlockSource.func_82620_h());
    024            double var4 = par1IBlockSource.getX() + (double)var3.func_82601_c();
    025            double var6 = (double)((float)par1IBlockSource.getYInt() + 0.2F);
    026            double var8 = par1IBlockSource.getZ() + (double)var3.func_82599_e();
    027            ItemMonsterPlacer.spawnCreature(par1IBlockSource.getWorld(), par2ItemStack.getItemDamage(), var4, var6, var8);
    028            par2ItemStack.splitStack(1);
    029            return par2ItemStack;
    030        }
    031
    032        /**
    033         * Play the dispense sound from the specified block.
    034         */
    035        protected void playDispenseSound(IBlockSource par1IBlockSource)
    036        {
    037            par1IBlockSource.getWorld().playAuxSFX(1002, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0);
    038        }
    039    }