Interface FluidVariant
- All Superinterfaces:
TransferVariant<Fluid>
Do not extend this class. Use of(Fluid)
and of(Fluid, NbtCompound)
to create instances.
FluidVariantRendering
can be used for client-side rendering of fluid variants.
Fluid variants must always be compared with equals
, never by reference!
hashCode
is guaranteed to be correct and constant time independently of the size of the NBT.
-
Method Summary
Modifier and TypeMethodDescriptionstatic FluidVariant
blank()
Retrieve a blank FluidVariant.static FluidVariant
fromNbt
(NbtCompound nbt) Deserialize a variant from an NBT compound tag, assuming it was serialized usingTransferVariant.toNbt()
.static FluidVariant
fromPacket
(PacketByteBuf buf) Read a variant from a packet byte buffer, assuming it was serialized usingTransferVariant.toPacket(net.minecraft.network.PacketByteBuf)
.default Fluid
getFluid()
Return the fluid of this variant.static FluidVariant
Retrieve a FluidVariant with a fluid, and anull
tag.static FluidVariant
of
(Fluid fluid, @Nullable NbtCompound nbt) Retrieve a FluidVariant with a fluid, and an optional tag.Methods inherited from interface net.fabricmc.fabric.api.transfer.v1.storage.TransferVariant
copyNbt, copyOrCreateNbt, getNbt, getObject, hasNbt, isBlank, isOf, nbtMatches, toNbt, toPacket
-
Method Details
-
blank
Retrieve a blank FluidVariant. -
of
Retrieve a FluidVariant with a fluid, and anull
tag.The flowing and still variations of flowable fluids are normalized to always refer to the still variant. For example,
FluidVariant.of(Fluids.FLOWING_WATER).getFluid() == Fluids.WATER
. -
of
Retrieve a FluidVariant with a fluid, and an optional tag.The flowing and still variations of flowable fluids are normalized to always refer to the still fluid. For example,
FluidVariant.of(Fluids.FLOWING_WATER, nbt).getFluid() == Fluids.WATER
. -
getFluid
Return the fluid of this variant. -
fromNbt
Deserialize a variant from an NBT compound tag, assuming it was serialized usingTransferVariant.toNbt()
.If an error occurs during deserialization, it will be logged with the DEBUG level, and a blank variant will be returned.
-
fromPacket
Read a variant from a packet byte buffer, assuming it was serialized usingTransferVariant.toPacket(net.minecraft.network.PacketByteBuf)
.
-