    001package net.minecraft.dispenser;
    002
    003import net.minecraft.entity.item.EntityFireworkRocket;
    004import net.minecraft.item.ItemStack;
    005import net.minecraft.server.MinecraftServer;
    006import net.minecraft.util.EnumFacing;
    007
    008public class BehaviorDispenseFirework extends BehaviorDefaultDispenseItem
    009{
    010    final MinecraftServer mcServer;
    011
    012    public BehaviorDispenseFirework(MinecraftServer par1MinecraftServer)
    013    {
    014        this.mcServer = par1MinecraftServer;
    015    }
    016
    017    /**
    018     * Dispense the specified stack, play the dispense sound and spawn particles.
    019     */
    020    public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
    021    {
    022        EnumFacing var3 = EnumFacing.getFront(par1IBlockSource.func_82620_h());
    023        double var4 = par1IBlockSource.getX() + (double)var3.getFrontOffsetX();
    024        double var6 = (double)((float)par1IBlockSource.getYInt() + 0.2F);
    025        double var8 = par1IBlockSource.getZ() + (double)var3.getFrontOffsetZ();
    026        EntityFireworkRocket var10 = new EntityFireworkRocket(par1IBlockSource.getWorld(), var4, var6, var8, par2ItemStack);
    027        par1IBlockSource.getWorld().spawnEntityInWorld(var10);
    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}