Package forestry.api.core
Interface IFluidProduct
- All Known Implementing Classes:
FluidProduct
public interface IFluidProduct
A fluid analog of
IProduct. Represents a fluid output, for example, from the Squeezer.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<IFluidProduct> static final com.mojang.serialization.MapCodec<IFluidProduct> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, IFluidProduct> static final String -
Method Summary
Modifier and TypeMethodDescriptionnet.neoforged.neoforge.fluids.FluidStackCreates a new, non-random stack to represent this product in recipe viewers.default net.neoforged.neoforge.fluids.FluidStackcreateRandomFluidStack(net.minecraft.util.RandomSource random) Used to produce a fluid stack from this product, taking randomness into account.type()The type of this product, used to (de)serialize it viaCODEC.
-
Field Details
-
TYPE_KEY
- See Also:
-
MAP_CODEC
-
CODEC
-
STREAM_CODEC
static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,IFluidProduct> STREAM_CODEC
-
-
Method Details
-
createFluidStack
net.neoforged.neoforge.fluids.FluidStack createFluidStack()Creates a new, non-random stack to represent this product in recipe viewers.The fluid amount should be the MAXIMUM amount of fluid a stack returned by this product's
createRandomFluidStack(RandomSource)can have. For example, if your recipe produces 100-300 mB of some fluid, this method should return a stack with 300 mB of fluid. This ensures machines like the Squeezer know how much space must be available to fit this fluid product into the output tank.This can return empty, like in the case where the product is a modded fluid not present in the current instance. However, in these cases, your recipe should use the proper conditions to disable itself rather than relying on this behavior.
- Returns:
- A new stack representing this product. If your product is dynamic, return a "default" stack.
-
createRandomFluidStack
default net.neoforged.neoforge.fluids.FluidStack createRandomFluidStack(net.minecraft.util.RandomSource random) Used to produce a fluid stack from this product, taking randomness into account. This is the final result produced by machines.- Parameters:
random- The random source. If no randomness is desired, this defaults tocreateFluidStack().- Returns:
- A new stack for this cycle, possibly empty or smaller than the representative stack.
-
type
FluidProductType<?> type()The type of this product, used to (de)serialize it viaCODEC. PlainFluidProductinstances returnFluidProduct.TYPE, which the dispatch codec treats as the default: it serializes without a"type"key.- Returns:
- The type of this product.
-