Interface IFluidStack

All Superinterfaces:
CommandStringDisplayable, ComponentAccess<IFluidStack>, net.minecraft.core.component.DataComponentHolder

@ZenRegister public interface IFluidStack extends CommandStringDisplayable, net.minecraft.core.component.DataComponentHolder, ComponentAccess<IFluidStack>
  • 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, net.minecraft.core.component.DataComponentPatch components)
    • 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, net.minecraft.core.component.DataComponentPatch components, 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, net.minecraft.core.component.DataComponentPatch components)
    • 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.
    • asFluidIngredient

      default CTFluidIngredient asFluidIngredient()
    • asList

      default CTFluidIngredient asList(CTFluidIngredient other)
    • asIData

      default IData asIData()
    • codec

      com.mojang.serialization.Codec<IFluidStack> codec()
    • getCommandString

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

      net.minecraft.core.component.PatchedDataComponentMap getComponents()
      Specified by:
      getComponents in interface net.minecraft.core.component.DataComponentHolder
    • with

      <T> IFluidStack with(net.minecraft.core.component.DataComponentType<T> type, T value)
    • without

      default <T> IFluidStack without(net.minecraft.core.component.DataComponentType<T> type)
    • withJsonComponent

      IFluidStack withJsonComponent(net.minecraft.core.component.DataComponentType type, IData value)
    • withJsonComponents

      IFluidStack withJsonComponents(IData value)
    • remove

      <T> IFluidStack remove(net.minecraft.core.component.DataComponentType<T> type)
    • update

      <T, U> IFluidStack update(net.minecraft.core.component.DataComponentType<T> type, T defaultValue, U data, BiFunction<T,U,T> operator)
    • update

      <T> IFluidStack update(net.minecraft.core.component.DataComponentType<T> type, T defaultValue, UnaryOperator<T> operator)
    • applyComponents

      IFluidStack applyComponents(net.minecraft.core.component.DataComponentMap map)
    • applyComponents

      IFluidStack applyComponents(net.minecraft.core.component.DataComponentPatch patch)
    • 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.
    • _without

      default <U> IFluidStack _without(net.minecraft.core.component.DataComponentType<U> componentType)
      Specified by:
      _without in interface ComponentAccess<IFluidStack>
    • _with

      default <U> IFluidStack _with(net.minecraft.core.component.DataComponentType<U> componentType, @Nullable U value)
      Specified by:
      _with in interface ComponentAccess<IFluidStack>
    • _get

      default <U> U _get(net.minecraft.core.component.DataComponentType<? extends U> componentType)
      Specified by:
      _get in interface ComponentAccess<IFluidStack>
    • _has

      default <U> boolean _has(net.minecraft.core.component.DataComponentType<U> componentType)
      Specified by:
      _has in interface ComponentAccess<IFluidStack>