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