Interface IFluidStack

All Superinterfaces:
CommandStringDisplayable
All Known Implementing Classes:
MCFluidStack, MCFluidStackMutable

@ZenRegister public interface IFluidStack extends CommandStringDisplayable
  • Method Summary

    Modifier and Type
    Method
    Description
     
    default IData
     
    default IFluidStack
     
     
    default IFluidStack
    Makes this stack mutable
    default IFluidStack
    Copies the stack.
    Gets the empty IFluidStack
    long
    Gets the fluid amount in MilliBuckets (mB).
    default String
    Returns the BEP to get this thingy
    net.minecraft.world.level.material.Fluid
    Retrieves this fluid stack's fluid.
    <T> T
    Gets a copy of the internal FluidStack that this IFluidStack is based on.
    <T> T
    Gets the internal FluidStack that this IFluidStack is based on.
    net.minecraft.nbt.CompoundTag
     
    default net.minecraft.resources.ResourceLocation
    Gets the registry name for the fluid this stack is representing.
    Returns the NBT tag attached to this FluidStack.
    boolean
    Returns true if this FluidStack has a Tag
    boolean
    Gets whether this fluid stack is empty.
    default boolean
     
    boolean
     
    default boolean
    Checks if this IFluidStack, matches the given IFluidStack by checking if the fluids are the same, and if this fluid's amount is bigger than the given fluid's amount
    of(net.minecraft.world.level.material.Fluid fluid, long amount)
     
    of(net.minecraft.world.level.material.Fluid fluid, long amount, boolean mutable)
     
    of(net.minecraft.world.level.material.Fluid fluid, long amount, @Nullable net.minecraft.nbt.CompoundTag tag)
     
    of(net.minecraft.world.level.material.Fluid fluid, long amount, @Nullable net.minecraft.nbt.CompoundTag tag, boolean mutable)
     
    static <T> IFluidStack
    of(T convertable)
    Gets an IFluidStack from the given T type.
    static <T> IFluidStack
    of(T convertable, boolean mutable)
    Gets an IFluidStack from the given T type.
    ofMutable(net.minecraft.world.level.material.Fluid fluid, long amount)
     
    ofMutable(net.minecraft.world.level.material.Fluid fluid, long amount, @Nullable net.minecraft.nbt.CompoundTag tag)
     
    static <T> IFluidStack
    ofMutable(T convertable)
    Gets a mutable IFluidStack from the given T type.
    setAmount(int amount)
    Sets the fluid amount in MilliBuckets (mB)
    Sets the tag for the FluidStack.
  • Method Details

    • empty

      static IFluidStack empty()
      Gets the empty IFluidStack
      Returns:
      The empty IFluidStack
    • of

      static <T> IFluidStack of(T convertable)
      Gets an IFluidStack from the given T type. On Forge, the only supported T type is net.minecraftforge.fluids.FluidStack. On Fabric, the only supported T type is com.blamejared.crafttweaker.impl.fluid.SimpleFluidStack
      Parameters:
      convertable - An instance of T to convert.
      Returns:
      An IFluidStack created from the given T.
      Throws:
      IllegalArgumentException - if convertable is not a known type that can be converted
    • of

      static IFluidStack of(net.minecraft.world.level.material.Fluid fluid, long amount)
    • of

      static IFluidStack of(net.minecraft.world.level.material.Fluid fluid, long amount, @Nullable @Nullable net.minecraft.nbt.CompoundTag tag)
    • of

      static <T> IFluidStack of(T convertable, boolean mutable)
      Gets an IFluidStack from the given T type. On Forge, the only supported T type is net.minecraftforge.fluids.FluidStack. On Fabric, the only supported T type is com.blamejared.crafttweaker.impl.fluid.SimpleFluidStack
      Parameters:
      convertable - An instance of T to convert.
      mutable - If the returned IFluidStack should be mutable or not
      Returns:
      A IFluidStack created from the given T.
      Throws:
      IllegalArgumentException - if convertable is not a known type that can be converted
    • of

      static IFluidStack of(net.minecraft.world.level.material.Fluid fluid, long amount, boolean mutable)
    • of

      static IFluidStack of(net.minecraft.world.level.material.Fluid fluid, long amount, @Nullable @Nullable net.minecraft.nbt.CompoundTag tag, boolean mutable)
    • ofMutable

      static <T> IFluidStack ofMutable(T convertable)
      Gets a mutable IFluidStack from the given T type. On Forge, the only supported T type is net.minecraftforge.fluids.FluidStack. On Fabric, the only supported T type is com.blamejared.crafttweaker.impl.fluid.SimpleFluidStack
      Parameters:
      convertable - An instance of T to convert.
      Returns:
      A mutable IFluidStack created from the given T.
      Throws:
      IllegalArgumentException - if convertable is not a known type that can be converted
    • ofMutable

      static IFluidStack ofMutable(net.minecraft.world.level.material.Fluid fluid, long amount)
    • ofMutable

      static IFluidStack ofMutable(net.minecraft.world.level.material.Fluid fluid, long amount, @Nullable @Nullable net.minecraft.nbt.CompoundTag tag)
    • getRegistryName

      default net.minecraft.resources.ResourceLocation getRegistryName()
      Gets the registry name for the fluid this stack is representing.
      Returns:
      A MCResourceLocation representing the registry name.
    • matches

      default boolean matches(IFluidStack other)
      Checks if this IFluidStack, matches the given IFluidStack by checking if the fluids are the same, and if this fluid's amount is bigger than the given fluid's amount
      Parameters:
      other - other IFluidStack to compare against
      Returns:
      true if this fluid contains the other fluid
    • isFluidEqual

      default boolean isFluidEqual(IFluidStack other)
    • isEmpty

      boolean isEmpty()
      Gets whether this fluid stack is empty.
      Returns:
      true if this stack is empty, false otherwise.
    • getAmount

      long getAmount()
      Gets the fluid amount in MilliBuckets (mB).
      Returns:
      The amount of this fluid
    • setAmount

      IFluidStack setAmount(int amount)
      Sets the fluid amount in MilliBuckets (mB)
      Parameters:
      amount - The amount to multiply this stack
      Returns:
      A new stack, or this stack, depending on if this stack is mutable
      DocParam:
      amount 1000
    • asMutable

      default IFluidStack asMutable()
      Makes this stack mutable
      Returns:
      A new Stack, that is mutable.
    • asImmutable

      default IFluidStack asImmutable()
    • isImmutable

      boolean isImmutable()
    • copy

      default IFluidStack copy()
      Copies the stack. Only needed when mutable stacks are involved.
      Returns:
      A new stack, that contains the same info as this one
    • getFluid

      net.minecraft.world.level.material.Fluid getFluid()
      Retrieves this fluid stack's fluid.
      Returns:
      The fluid.
    • getTag

      IData getTag()
      Returns the NBT tag attached to this FluidStack.
      Returns:
      MapData of the FluidStack's NBT Tag, null if it doesn't exist.
    • withTag

      IFluidStack withTag(IData tag)
      Sets the tag for the FluidStack.
      Parameters:
      tag - The tag to set.
      Returns:
      This FluidStack if it is mutable, a new one with the changed property otherwise
      DocParam:
      tag {Display: {lore: ["Hello"]}}
    • hasTag

      boolean hasTag()
      Returns true if this FluidStack has a Tag
      Returns:
      true if tag is present.
    • asFluidIngredient

      default CTFluidIngredient asFluidIngredient()
    • asList

      default CTFluidIngredient asList(CTFluidIngredient other)
    • asIData

      default IData asIData()
    • getCommandString

      default String getCommandString()
      Description copied from interface: CommandStringDisplayable
      Returns the BEP to get this thingy
      Specified by:
      getCommandString in interface CommandStringDisplayable
    • getInternalTag

      net.minecraft.nbt.CompoundTag getInternalTag()
    • getInternal

      <T> T getInternal()
      Gets the internal FluidStack that this IFluidStack is based on. On Forge, this will be a net.minecraftforge.fluids.FluidStack. On Fabric, this will be a com.blamejared.crafttweaker.impl.fluid.SimpleFluidStack You may need to specify the type in the call itself at times, like so iFluidStack.<FluidStack>getInternal().getFluid() or iFluidStack.<SimpleFluidStack>getInternal().fluid()
      Returns:
      The internal FluidStack that this IFluidStack is based on.
    • getImmutableInternal

      <T> T getImmutableInternal()
      Gets a copy of the internal FluidStack that this IFluidStack is based on. On Forge, this will be a net.minecraftforge.fluids.FluidStack. On Fabric, this will be a com.blamejared.crafttweaker.impl.fluid.SimpleFluidStack You may need to specify the type in the call itself at times, like so iFluidStack.<FluidStack>getInternal().getFluid() or iFluidStack.<SimpleFluidStack>getInternal().fluid()
      Returns:
      A copy of the FluidStack that this IFluidStack is based on.