    001    package net.minecraft.src;
    002
    003    import net.minecraft.server.MinecraftServer;
    004
    005    public class BehaviorBucketEmptyDispense extends BehaviorDefaultDispenseItem
    006    {
    007        private final BehaviorDefaultDispenseItem field_82497_c;
    008
    009        final MinecraftServer field_82496_b;
    010
    011        public BehaviorBucketEmptyDispense(MinecraftServer par1)
    012        {
    013            this.field_82496_b = par1;
    014            this.field_82497_c = new BehaviorDefaultDispenseItem();
    015        }
    016
    017        public ItemStack func_82487_b(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
    018        {
    019            EnumFacing var3 = EnumFacing.func_82600_a(par1IBlockSource.func_82620_h());
    020            World var4 = par1IBlockSource.func_82618_k();
    021            int var5 = par1IBlockSource.func_82623_d() + var3.func_82601_c();
    022            int var6 = par1IBlockSource.func_82622_e();
    023            int var7 = par1IBlockSource.func_82621_f() + var3.func_82599_e();
    024            Material var8 = var4.getBlockMaterial(var5, var6, var7);
    025            int var9 = var4.getBlockMetadata(var5, var6, var7);
    026            Item var10;
    027
    028            if (Material.water.equals(var8) && var9 == 0)
    029            {
    030                var10 = Item.bucketWater;
    031            }
    032            else
    033            {
    034                if (!Material.lava.equals(var8) || var9 != 0)
    035                {
    036                    return super.func_82487_b(par1IBlockSource, par2ItemStack);
    037                }
    038
    039                var10 = Item.bucketLava;
    040            }
    041
    042            var4.setBlockWithNotify(var5, var6, var7, 0);
    043
    044            if (--par2ItemStack.stackSize == 0)
    045            {
    046                par2ItemStack.itemID = var10.shiftedIndex;
    047                par2ItemStack.stackSize = 1;
    048            }
    049            else if (((TileEntityDispenser)par1IBlockSource.func_82619_j()).func_70360_a(new ItemStack(var10)) < 0)
    050            {
    051                this.field_82497_c.func_82482_a(par1IBlockSource, new ItemStack(var10));
    052            }
    053
    054            return par2ItemStack;
    055        }
    056    }