Record Class FluidIngredientType<T extends FluidIngredient>
java.lang.Object
java.lang.Record
net.neoforged.neoforge.fluids.crafting.FluidIngredientType<T>
- Type Parameters:
T- The type of fluid ingredient
public record FluidIngredientType<T extends FluidIngredient>(com.mojang.serialization.MapCodec<T extends FluidIngredient> codec, StreamCodec<? super RegistryFriendlyByteBuf,T extends FluidIngredient> streamCodec)
extends Record
This represents the "type" of a
FluidIngredient, providing means of serializing
and deserializing the ingredient over both JSON and network, using the codec
and streamCodec, respectively.
Note that the streamCodec() is only used if FluidIngredient.isSimple() returns false,
as otherwise its contents are synchronized directly to the network.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.mojang.serialization.MapCodec<T> The field for thecodecrecord component.private final StreamCodec<? super RegistryFriendlyByteBuf, T> The field for thestreamCodecrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionFluidIngredientType(com.mojang.serialization.MapCodec<T> mapCodec) FluidIngredientType(com.mojang.serialization.MapCodec<T> codec, StreamCodec<? super RegistryFriendlyByteBuf, T> streamCodec) Creates an instance of aFluidIngredientTyperecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<T> codec()Returns the value of thecodecrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.StreamCodec<? super RegistryFriendlyByteBuf, T> Returns the value of thestreamCodecrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
codec
The field for thecodecrecord component. -
streamCodec
The field for thestreamCodecrecord component.
-
-
Constructor Details
-
FluidIngredientType
-
FluidIngredientType
public FluidIngredientType(com.mojang.serialization.MapCodec<T> codec, StreamCodec<? super RegistryFriendlyByteBuf, T> streamCodec) Creates an instance of aFluidIngredientTyperecord class.- Parameters:
codec- the value for thecodecrecord componentstreamCodec- the value for thestreamCodecrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
codec
Returns the value of thecodecrecord component.- Returns:
- the value of the
codecrecord component
-
streamCodec
Returns the value of thestreamCodecrecord component.- Returns:
- the value of the
streamCodecrecord component
-