Interface IFluidStack
- All Superinterfaces:
CommandStringDisplayable
- All Known Implementing Classes:
MCFluidStack,MCFluidStackMutable
-
Method Summary
Modifier and TypeMethodDescriptiondefault CTFluidIngredientdefault IDataasIData()default IFluidStackdefault CTFluidIngredientasList(CTFluidIngredient other) default IFluidStackMakes this stack mutabledefault IFluidStackcopy()Copies the stack.static IFluidStackempty()Gets the empty IFluidStacklongGets the fluid amount in MilliBuckets (mB).default StringReturns the BEP to get this thingynet.minecraft.world.level.material.FluidgetFluid()Retrieves this fluid stack's fluid.<T> TGets a copy of the internal FluidStack that this IFluidStack is based on.<T> TGets the internal FluidStack that this IFluidStack is based on.net.minecraft.nbt.CompoundTagdefault net.minecraft.resources.ResourceLocationGets the registry name for the fluid this stack is representing.getTag()Returns the NBT tag attached to this FluidStack.booleanhasTag()Returns true if this FluidStack has a TagbooleanisEmpty()Gets whether this fluid stack is empty.default booleanisFluidEqual(IFluidStack other) booleandefault booleanmatches(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 amountstatic IFluidStackof(net.minecraft.world.level.material.Fluid fluid, long amount) static IFluidStackof(net.minecraft.world.level.material.Fluid fluid, long amount, boolean mutable) static IFluidStackof(net.minecraft.world.level.material.Fluid fluid, long amount, @Nullable net.minecraft.nbt.CompoundTag tag) static IFluidStackof(net.minecraft.world.level.material.Fluid fluid, long amount, @Nullable net.minecraft.nbt.CompoundTag tag, boolean mutable) static <T> IFluidStackof(T convertable) Gets an IFluidStack from the given T type.static <T> IFluidStackof(T convertable, boolean mutable) Gets an IFluidStack from the given T type.static IFluidStackofMutable(net.minecraft.world.level.material.Fluid fluid, long amount) static IFluidStackofMutable(net.minecraft.world.level.material.Fluid fluid, long amount, @Nullable net.minecraft.nbt.CompoundTag tag) static <T> IFluidStackofMutable(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
Gets the empty IFluidStack- Returns:
- The empty IFluidStack
-
of
Gets an IFluidStack from the given T type. On Forge, the only supported T type isnet.minecraftforge.fluids.FluidStack. On Fabric, the only supported T type iscom.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
-
of
static IFluidStack of(net.minecraft.world.level.material.Fluid fluid, long amount, @Nullable @Nullable net.minecraft.nbt.CompoundTag tag) -
of
Gets an IFluidStack from the given T type. On Forge, the only supported T type isnet.minecraftforge.fluids.FluidStack. On Fabric, the only supported T type iscom.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
-
of
static IFluidStack of(net.minecraft.world.level.material.Fluid fluid, long amount, @Nullable @Nullable net.minecraft.nbt.CompoundTag tag, boolean mutable) -
ofMutable
Gets a mutable IFluidStack from the given T type. On Forge, the only supported T type isnet.minecraftforge.fluids.FluidStack. On Fabric, the only supported T type iscom.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
-
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
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
-
isEmpty
boolean isEmpty()Gets whether this fluid stack is empty.- Returns:
trueif this stack is empty,falseotherwise.
-
getAmount
long getAmount()Gets the fluid amount in MilliBuckets (mB).- Returns:
- The amount of this fluid
-
setAmount
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
Makes this stack mutable- Returns:
- A new Stack, that is mutable.
-
asImmutable
-
isImmutable
boolean isImmutable() -
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
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
-
asList
-
asIData
-
getCommandString
Description copied from interface:CommandStringDisplayableReturns the BEP to get this thingy- Specified by:
getCommandStringin interfaceCommandStringDisplayable
-
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 anet.minecraftforge.fluids.FluidStack. On Fabric, this will be acom.blamejared.crafttweaker.impl.fluid.SimpleFluidStackYou may need to specify the type in the call itself at times, like soiFluidStack.<FluidStack>getInternal().getFluid()oriFluidStack.<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 anet.minecraftforge.fluids.FluidStack. On Fabric, this will be acom.blamejared.crafttweaker.impl.fluid.SimpleFluidStackYou may need to specify the type in the call itself at times, like soiFluidStack.<FluidStack>getInternal().getFluid()oriFluidStack.<SimpleFluidStack>getInternal().fluid()- Returns:
- A copy of the FluidStack that this IFluidStack is based on.
-