public static ItemStack setLiquid(ItemStack bucket, FluidStack liquid) { if (LiquidRegistry.getName(liquid) != null) { bucket.stackSize = 1; bucket.setItemDamage(LiquidRegistry.getID(liquid)); } 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); }