public static ItemStack setLiquid(ItemStack bucket, FluidStack liquid) {
   if (LiquidRegistry.getName(liquid) != null) {
     bucket.stackSize = 1;
     bucket.setItemDamage(LiquidRegistry.getID(liquid));
   }
   return bucket;
 }
 public ItemStack tryPlaceContainedLiquid(
     World world, ItemStack bucket, int x, int y, int z, int side) {
   if (world.isRemote) return bucket;
   CarbonContainer item = (CarbonContainer) bucket.getItem();
   int id = bucket.getItemDamage();
   if (id != 0) {
     if (!item.canPlaceInWorld) return bucket;
     FluidStack liquid = LiquidRegistry.getLiquid(id);
     if (world.setBlock(x, y, z, liquid.getFluid().getBlock(), 0, 3))
       return item.getContainerItem(bucket);
     return bucket;
   }
   if (!item.canBeFilledFromWorld) return bucket;
   Block block = world.getBlock(x, y, z);
   if (block instanceof IFluidBlock) {
     FluidStack liquid = ((IFluidBlock) block).drain(world, x, y, z, false);
     if (liquid != null && FluidRegistry.isFluidRegistered(liquid.getFluid())) {
       ItemStack r = FluidContainerRegistry.fillFluidContainer(liquid, bucket);
       if (r != null && FluidContainerRegistry.isFilledContainer(r)) {
         ((IFluidBlock) block).drain(world, x, y, z, true);
         return r;
       }
     }
   }
   return bucket;
 }
 public static void registerAsContainer(Fluid fluid) {
   FluidStack stack =
       FluidRegistry.getFluidStack(fluid.getName(), FluidContainerRegistry.BUCKET_VOLUME);
   stack = stack.copy();
   stack.amount = cell.volume;
   FluidContainerRegistry.registerFluidContainer(
       new FluidContainerData(
           stack, new ItemStack(cell, 1, LiquidRegistry.getID(stack)), new ItemStack(cell, 1, 0)));
 }
 @SuppressWarnings("unchecked")
 @Override
 @SideOnly(Side.CLIENT)
 public void getSubItems(
     Item par1, CreativeTabs par2CreativeTabs, @SuppressWarnings("rawtypes") List par3List) {
   if (par1.equals(emptyItem)) par3List.add(new ItemStack(par1, 1, 0));
   if (par1.equals(filledItem))
     for (int i = 0, e = LiquidRegistry.getRegisteredLiquidCount(); i++ < e; )
       par3List.add(new ItemStack(par1, 1, i));
 }
 public ItemStack setLiquid(ItemStack bucket, FluidStack liquid, EntityPlayer par3EntityPlayer) {
   CarbonContainer item = (CarbonContainer) bucket.getItem();
   if (liquid == null || liquid.amount < item.volume) return bucket;
   int id = LiquidRegistry.getID(liquid);
   if (--bucket.stackSize <= 0) {
     bucket = new ItemStack(item.filledItem, 1, id);
   } else {
     ItemStack bucket2 = new ItemStack(item.filledItem, 1, id);
     if (!par3EntityPlayer.inventory.addItemStackToInventory(bucket2))
       par3EntityPlayer.func_146097_a(bucket2, false, true);
   }
   liquid.amount -= item.volume;
   return bucket;
 }
 @Override
 public String getItemStackDisplayName(ItemStack item) {
   int id = item.getItemDamage();
   if (id != 0) {
     String ret = LiquidRegistry.getName(id), t = getLocalizedName(ret);
     if (t != null && !t.isEmpty()) return EnumChatFormatting.RESET + t + EnumChatFormatting.RESET;
     Fluid liquid = FluidRegistry.getFluid(ret);
     if (liquid != null) ret = liquid.getLocalizedName();
     _prefix = true;
     t = super.getItemStackDisplayName(item);
     _prefix = false;
     t = t != null ? t.trim() : "";
     ret = (t.isEmpty() ? "" : t + " ") + ret;
     t = super.getItemStackDisplayName(item);
     t = t != null ? t.trim() : "";
     ret += t.isEmpty() ? " " + getTranslatedBucketName() : " " + t;
     return ret;
   }
   return super.getItemStackDisplayName(item);
 }
 public FluidStack getLiquid(ItemStack bucket) {
   CarbonContainer item = (CarbonContainer) bucket.getItem();
   return LiquidRegistry.getLiquid(bucket.getItemDamage(), item.volume);
 }