Package mcp.mobius.waila.api.data
Class FluidData
java.lang.Object
mcp.mobius.waila.api.data.FluidData
- All Implemented Interfaces:
IData
- Direct Known Subclasses:
FluidData.PlatformDependant
Adds fluid information to an object.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
FluidData.FluidDescriptionContext<T extends Fluid>
static interface
FluidData.FluidDescriptor<T extends Fluid>
static class
static interface
static enum
Nested classes/interfaces inherited from interface mcp.mobius.waila.api.IData
IData.Type<D extends IData>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ResourceLocation
static final ResourceLocation
static final IData.Type
<FluidData> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(Fluid fluid, net.minecraft.core.component.DataComponentPatch data, double stored, double capacity) Adds a fluid entry.static void
describeCauldron
(Class<? extends Block> clazz, FluidData.CauldronDescriptor descriptor) Describes what fluids are contained in the specified cauldron-like block type that store fluid on its block state.static void
describeCauldron
(Block block, FluidData.CauldronDescriptor descriptor) Describes what fluids are contained in the specified cauldron-like block that store fluid on its block state.static <T extends Fluid>
voiddescribeFluid
(Class<T> clazz, FluidData.FluidDescriptor<T> descriptor) Describes how the fluids of the specified type will be shown in the client.static <T extends Fluid>
voiddescribeFluid
(T fluid, FluidData.FluidDescriptor<T> descriptor) Describes how the specific fluid will be shown in the client.static <S> FluidData.PlatformDependant
<S> of
(FluidData.PlatformTranslator<S> translator) Creates a fluid data with platform-specific translator.static <S> FluidData.PlatformDependant
<S> of
(FluidData.PlatformTranslator<S> translator, int slotCountHint) Creates a fluid data with platform-specific translator.static FluidData
of
(FluidData.Unit unit) Creates a fluid data.static FluidData
of
(FluidData.Unit unit, int slotCountHint) Creates a fluid data.
-
Field Details
-
ID
-
TYPE
-
CONFIG_DISPLAY_UNIT
-
-
Constructor Details
-
FluidData
public FluidData()
-
-
Method Details
-
describeFluid
@ClientOnly public static <T extends Fluid> void describeFluid(T fluid, FluidData.FluidDescriptor<T> descriptor) Describes how the specific fluid will be shown in the client.Most platforms likely has API to do this already, so user might not need to register their own implementation here.
-
On Forge,
FluidType
will be used for fluid name andIClientFluidTypeExtensions
for fluid sprite. -
On Fabric,
FluidVariantAttributeHandler
will be used for fluid name andFluidVariantRenderHandler
for fluid sprite.
- Throws:
IllegalArgumentException
- if the fluid is aFlowingFluid
and is not the source fluid instance
-
On Forge,
-
describeFluid
@ClientOnly public static <T extends Fluid> void describeFluid(Class<T> clazz, FluidData.FluidDescriptor<T> descriptor) Describes how the fluids of the specified type will be shown in the client.Most platforms likely has API to do this already, so user might not need to register their own implementation here.
-
On Forge,
FluidType
will be used for fluid name andIClientFluidTypeExtensions
for fluid sprite. -
On Fabric,
FluidVariantAttributeHandler
will be used for fluid name andFluidVariantRenderHandler
for fluid sprite.
-
On Forge,
-
describeCauldron
Describes what fluids are contained in the specified cauldron-like block that store fluid on its block state.Some platforms have API to attach this information, so user might not need to register their own implementation here.
-
On Fabric,
CauldronFluidContent
is used to get the information.
-
On Fabric,
-
describeCauldron
public static void describeCauldron(Class<? extends Block> clazz, FluidData.CauldronDescriptor descriptor) Describes what fluids are contained in the specified cauldron-like block type that store fluid on its block state.Some platforms have API to attach this information, so user might not need to register their own implementation here.
-
On Fabric,
CauldronFluidContent
is used to get the information.
-
On Fabric,
-
of
Creates a fluid data.- Parameters:
unit
- the fluid unit of measurement- See Also:
-
of
Creates a fluid data.- Parameters:
unit
- the fluid unit of measurementslotCountHint
- hint of how many the slots probably are to minimize growing the list more than necessary, the user can calladd(net.minecraft.world.level.material.Fluid, net.minecraft.core.component.DataComponentPatch, double, double)
more than the specified count- See Also:
-
of
Creates a fluid data with platform-specific translator.Use the helper methods from the platform specific API package.
- Parameters:
translator
- the translator that gets the fluid, nbt, and (optionally) amount from a platform-specific object- See Also:
-
of
public static <S> FluidData.PlatformDependant<S> of(FluidData.PlatformTranslator<S> translator, int slotCountHint) Creates a fluid data with platform-specific translator.Use the helper methods from the platform specific API package.
- Parameters:
translator
- the translator that gets the fluid, nbt, and (optionally) amount from a platform-specific objectslotCountHint
- hint of how many the slots probably are to minimize growing the list more than necessary, the user can calladd(net.minecraft.world.level.material.Fluid, net.minecraft.core.component.DataComponentPatch, double, double)
more than the specified count- See Also:
-
add
public FluidData add(Fluid fluid, net.minecraft.core.component.DataComponentPatch data, double stored, double capacity) Adds a fluid entry.- Parameters:
fluid
- the fluid instance, will be normalized as the source fluid if it is aFlowingFluid
data
- the fluid's NBT data, will NOT be modified so it safe to not copy itstored
- the stored amount of the fluid, in the specified unitcapacity
- the maximum capacity of this slot, in the specified unit
-