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
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interfaceFluidData.FluidDescriptionContext<T extends Fluid>static interfaceFluidData.FluidDescriptor<T extends Fluid>static classstatic interfacestatic enumNested classes/interfaces inherited from interface mcp.mobius.waila.api.IData
IData.Type<D extends IData> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Identifierstatic final Identifierstatic final IData.Type<FluidData> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(Fluid fluid, net.minecraft.core.component.DataComponentPatch data, double stored, double capacity) Adds a fluid entry.static voiddescribeCauldron(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 voiddescribeCauldron(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 FluidDataof(FluidData.Unit unit) Creates a fluid data.static FluidDataof(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,
FluidTypewill be used for fluid name andIClientFluidTypeExtensionsfor fluid sprite. -
On Fabric,
FluidVariantAttributeHandlerwill be used for fluid name andFluidVariantRenderHandlerfor fluid sprite.
- Throws:
IllegalArgumentException- if the fluid is aFlowingFluidand 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,
FluidTypewill be used for fluid name andIClientFluidTypeExtensionsfor fluid sprite. -
On Fabric,
FluidVariantAttributeHandlerwill be used for fluid name andFluidVariantRenderHandlerfor 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,
CauldronFluidContentis 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,
CauldronFluidContentis 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 aFlowingFluiddata- 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
-