    001    package net.minecraft.dispenser;
    002
    003    import net.minecraft.item.Item;
    004    import net.minecraft.item.ItemBucket;
    005    import net.minecraft.item.ItemStack;
    006    import net.minecraft.server.MinecraftServer;
    007    import net.minecraft.util.EnumFacing;
    008
    009    public class BehaviorBucketFullDispense extends BehaviorDefaultDispenseItem
    010    {
    011        /** Reference to the BehaviorDefaultDispenseItem object. */
    012        private final BehaviorDefaultDispenseItem defaultItemDispenseBehavior;
    013
    014        /** Reference to the MinecraftServer object. */
    015        final MinecraftServer mcServer;
    016
    017        public BehaviorBucketFullDispense(MinecraftServer par1)
    018        {
    019            this.mcServer = par1;
    020            this.defaultItemDispenseBehavior = new BehaviorDefaultDispenseItem();
    021        }
    022
    023        /**
    024         * Dispense the specified stack, play the dispense sound and spawn particles.
    025         */
    026        public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
    027        {
    028            ItemBucket var3 = (ItemBucket)par2ItemStack.getItem();
    029            int var4 = par1IBlockSource.getXInt();
    030            int var5 = par1IBlockSource.getYInt();
    031            int var6 = par1IBlockSource.getZInt();
    032            EnumFacing var7 = EnumFacing.func_82600_a(par1IBlockSource.func_82620_h());
    033
    034            if (var3.tryPlaceContainedLiquid(par1IBlockSource.getWorld(), (double)var4, (double)var5, (double)var6, var4 + var7.func_82601_c(), var5, var6 + var7.func_82599_e()))
    035            {
    036                par2ItemStack.itemID = Item.bucketEmpty.shiftedIndex;
    037                par2ItemStack.stackSize = 1;
    038                return par2ItemStack;
    039            }
    040            else
    041            {
    042                return this.defaultItemDispenseBehavior.dispense(par1IBlockSource, par2ItemStack);
    043            }
    044        }
    045    }