    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        final MinecraftServer mcServer;
    015
    016        public BehaviorBucketFullDispense(MinecraftServer par1)
    017        {
    018            this.mcServer = par1;
    019            this.defaultItemDispenseBehavior = new BehaviorDefaultDispenseItem();
    020        }
    021
    022        /**
    023         * Dispense the specified stack, play the dispense sound and spawn particles.
    024         */
    025        public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
    026        {
    027            ItemBucket var3 = (ItemBucket)par2ItemStack.getItem();
    028            int var4 = par1IBlockSource.getXInt();
    029            int var5 = par1IBlockSource.getYInt();
    030            int var6 = par1IBlockSource.getZInt();
    031            EnumFacing var7 = EnumFacing.func_82600_a(par1IBlockSource.func_82620_h());
    032
    033            if (var3.tryPlaceContainedLiquid(par1IBlockSource.getWorld(), (double)var4, (double)var5, (double)var6, var4 + var7.func_82601_c(), var5, var6 + var7.func_82599_e()))
    034            {
    035                par2ItemStack.itemID = Item.bucketEmpty.shiftedIndex;
    036                par2ItemStack.stackSize = 1;
    037                return par2ItemStack;
    038            }
    039            else
    040            {
    041                return this.defaultItemDispenseBehavior.dispense(par1IBlockSource, par2ItemStack);
    042            }
    043        }
    044    }