Class SizedFluidIngredient
java.lang.Object
net.neoforged.neoforge.fluids.crafting.SizedFluidIngredient
Standard implementation for a FluidIngredient with an amount.
FluidIngredient
, like its item counterpart, explicitly does not perform count checks,
so this class is used to (a) wrap a standard FluidIngredient with an amount and (b) provide a
standard serialization format for mods to use.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
static final com.mojang.serialization.Codec
<SizedFluidIngredient> The codec forSizedFluidIngredient
.private final FluidIngredient
static final net.minecraft.network.codec.StreamCodec
<net.minecraft.network.RegistryFriendlyByteBuf, SizedFluidIngredient> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
amount()
boolean
int
hashCode()
static SizedFluidIngredient
of
(net.minecraft.world.level.material.Fluid fluid, int amount) boolean
test
(FluidStack stack) Performs a size-sensitive test on the given stack.toString()
-
Field Details
-
CODEC
The codec forSizedFluidIngredient
.With this codec, the amount is serialized separately from the ingredient itself, for example:
{ "ingredient": "minecraft:lava", "amount": 1000 }
or for custom ingredients:
{ "ingredient": { "neoforge:type": "neoforge:intersection", "children": [ "#example:tag1", "#example:tag2" ], }, "amount": 4711 }
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,SizedFluidIngredient> STREAM_CODEC -
ingredient
-
amount
private final int amount
-
-
Constructor Details
-
SizedFluidIngredient
-
-
Method Details
-
of
-
ingredient
-
amount
public int amount() -
test
Performs a size-sensitive test on the given stack.- Returns:
true
if the stack matches the ingredient and has at least the required amount.
-
equals
-
hashCode
public int hashCode() -
toString
-