Interface FluidVariant
- All Superinterfaces:
TransferVariant<net.minecraft.world.level.material.Fluid>
@NonExtendable
public interface FluidVariant
extends TransferVariant<net.minecraft.world.level.material.Fluid>
An immutable association of a still fluid and data components.
Do not extend this class. Use of(Fluid) and of(Fluid, DataComponentPatch) 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 components.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<FluidVariant> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, FluidVariant> -
Method Summary
Modifier and TypeMethodDescriptionstatic FluidVariantblank()Retrieve a blank FluidVariant.default net.minecraft.world.level.material.FluidgetFluid()Return the fluid of this variant.default net.minecraft.core.Holder<net.minecraft.world.level.material.Fluid> static FluidVariantof(net.minecraft.world.level.material.Fluid fluid) Retrieve a FluidVariant with a fluid, and anulltag.static FluidVariantof(net.minecraft.world.level.material.Fluid fluid, net.minecraft.core.component.DataComponentPatch components) Retrieve a FluidVariant with a fluid, and an optional tag.withComponentChanges(net.minecraft.core.component.DataComponentPatch changes) Creates a copy of this FluidVariant with the provided component changes applied.Methods inherited from interface net.fabricmc.fabric.api.transfer.v1.storage.TransferVariant
componentsMatch, getComponentMap, getComponents, getObject, hasComponents, isBlank, isOf
-
Field Details
-
CODEC
-
PACKET_CODEC
static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,FluidVariant> PACKET_CODEC
-
-
Method Details
-
blank
Retrieve a blank FluidVariant. -
of
Retrieve a FluidVariant with a fluid, and anulltag.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
static FluidVariant of(net.minecraft.world.level.material.Fluid fluid, net.minecraft.core.component.DataComponentPatch components) 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, ComponentChanges.EMPTY).getFluid() == Fluids.WATER. -
getFluid
default net.minecraft.world.level.material.Fluid getFluid()Return the fluid of this variant. -
getRegistryEntry
default net.minecraft.core.Holder<net.minecraft.world.level.material.Fluid> getRegistryEntry() -
withComponentChanges
Creates a copy of this FluidVariant with the provided component changes applied.- Specified by:
withComponentChangesin interfaceTransferVariant<net.minecraft.world.level.material.Fluid>- Parameters:
changes- the changes to apply- Returns:
- the new variant with the changes applied
-