Class FluidVariantAttributes
java.lang.Object
net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariantAttributes
Common fluid variant attributes, accessible both client-side and server-side.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidEnable blue- and red-colored names for water and lava respectively.static net.minecraft.sounds.SoundEventgetEmptySound(FluidVariant variant) Return the sound corresponding to a container of this fluid variant being emptied if available, or the default (water) emptying sound otherwise.static net.minecraft.sounds.SoundEventgetFillSound(FluidVariant variant) Return the sound corresponding to a container of this fluid variant being filled if available, or the default (water) filling sound otherwise.static @Nullable FluidVariantAttributeHandlergetHandler(net.minecraft.world.level.material.Fluid fluid) Return the attribute handler for the passed fluid, if available, andnullotherwise.static FluidVariantAttributeHandlergetHandlerOrDefault(net.minecraft.world.level.material.Fluid fluid) Return the attribute handler for the passed fluid, if available, or the default instance otherwise.static intgetLuminance(FluidVariant variant) Return an integer in [0, 15]: the light level emitted by this fluid variant, or 0 if it doesn't naturally emit light.static net.minecraft.network.chat.ComponentgetName(FluidVariant variant) Return the name that should be used for the passed fluid variant.static intgetTemperature(FluidVariant variant) Return a non-negative integer, representing the temperature of this fluid in Kelvin.static intgetViscosity(FluidVariant variant, @Nullable net.minecraft.world.level.Level level) Return a positive integer, representing the viscosity of this fluid variant.static booleanisLighterThanAir(FluidVariant variant) Return true if this fluid is lighter than air.static voidregister(net.minecraft.world.level.material.Fluid fluid, FluidVariantAttributeHandler handler) Register an attribute handler for the passed fluid.
-
Method Details
-
register
public static void register(net.minecraft.world.level.material.Fluid fluid, FluidVariantAttributeHandler handler) Register an attribute handler for the passed fluid. -
enableColoredVanillaFluidNames
public static void enableColoredVanillaFluidNames()Enable blue- and red-colored names for water and lava respectively. -
getHandler
public static @Nullable FluidVariantAttributeHandler getHandler(net.minecraft.world.level.material.Fluid fluid) Return the attribute handler for the passed fluid, if available, andnullotherwise. -
getHandlerOrDefault
public static FluidVariantAttributeHandler getHandlerOrDefault(net.minecraft.world.level.material.Fluid fluid) Return the attribute handler for the passed fluid, if available, or the default instance otherwise. -
getName
Return the name that should be used for the passed fluid variant. -
getFillSound
Return the sound corresponding to a container of this fluid variant being filled if available, or the default (water) filling sound otherwise. -
getEmptySound
Return the sound corresponding to a container of this fluid variant being emptied if available, or the default (water) emptying sound otherwise. -
getLuminance
Return an integer in [0, 15]: the light level emitted by this fluid variant, or 0 if it doesn't naturally emit light. -
getTemperature
-
getViscosity
public static int getViscosity(FluidVariant variant, @Nullable net.minecraft.world.level.Level level) Return a positive integer, representing the viscosity of this fluid variant. Fluids with lower viscosity generally flow faster than fluids with higher viscosity.More precisely, viscosity should be 200 *
Fluid.getTickDelay(LevelReader)for flowing fluids. The reference values are 1000 for water, 2000 for lava in ultrawarm dimensions (such as the nether), and 6000 for lava in other dimensions.- Parameters:
level- Level if available, otherwise null.
-
isLighterThanAir
Return true if this fluid is lighter than air. Fluids that are lighter than air generally flow upwards.
-