001 package net.minecraft.dispenser; 002 003 import net.minecraft.entity.item.EntityFireworkRocket; 004 import net.minecraft.item.ItemStack; 005 import net.minecraft.server.MinecraftServer; 006 import net.minecraft.util.EnumFacing; 007 008 public 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.func_82600_a(par1IBlockSource.func_82620_h()); 023 double var4 = par1IBlockSource.getX() + (double)var3.func_82601_c(); 024 double var6 = (double)((float)par1IBlockSource.getYInt() + 0.2F); 025 double var8 = par1IBlockSource.getZ() + (double)var3.func_82599_e(); 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 }