Example usage for net.minecraftforge.fluids FluidStack getAmount

List of usage examples for net.minecraftforge.fluids FluidStack getAmount

Introduction

In this page you can find the example usage for net.minecraftforge.fluids FluidStack getAmount.

Prototype

public int getAmount() 

Source Link

Usage

From source file:com.teambrmodding.assistedprogression.common.item.PipetteItem.java

License:Creative Commons License

/**
 * allows items to add custom lines of information to the mouseover description
 *//*from www  . j a v a  2s .  c  o  m*/
@OnlyIn(Dist.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip,
        ITooltipFlag flagIn) {
    tooltip.add(new StringTextComponent(
            GuiColor.ORANGE + ClientUtils.translate("assistedprogression.text.pipette.fluidStored")));
    if (stack.hasTag()) {
        FluidStack currentStored = FluidUtil.getFluidContained(stack).orElse(null);
        if (currentStored == null)
            return;

        tooltip.add(new StringTextComponent("  "
                + ClientUtils.translate(currentStored.getFluid().getDefaultState().getBlockState().getBlock()
                        .getTranslationKey()) //TODO: Go back to fluid name when forge fixes
                + ": " + ClientUtils.formatNumber(currentStored.getAmount()) + " mb"));
    } else
        tooltip.add(new StringTextComponent(
                "  " + ChatFormatting.RED + ClientUtils.translate("assistedprogression.text.pipette.empty")));
}