Interface FluidVariantAttributeHandler


@Experimental public interface FluidVariantAttributeHandler
Defines the common attributes of fluid variants of a given Fluid. Register with FluidVariantAttributes.register(net.minecraft.fluid.Fluid, net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariantAttributeHandler).

Experimental feature, we reserve the right to remove or change it without further notice. The transfer API is a complex addition, and we want to be able to correct possible design mistakes.

  • Method Details

    • getName

      default Text getName(FluidVariant fluidVariant)
      Return the name that should be used for the passed fluid variant.
    • getFillSound

      default Optional<SoundEvent> getFillSound(FluidVariant variant)
      Return the sound corresponding to this fluid being filled, or none if no sound is available.

      If a non-empty sound event is returned, Fluid.getBucketFillSound() will return that sound.

    • getEmptySound

      default Optional<SoundEvent> getEmptySound(FluidVariant variant)
      Return the sound corresponding to this fluid being emptied, or none if no sound is available.

      If a non-empty sound event is returned, BucketItem.playEmptyingSound(net.minecraft.entity.player.PlayerEntity, net.minecraft.world.WorldAccess, net.minecraft.util.math.BlockPos) will play that sound.

    • getLuminance

      default int getLuminance(FluidVariant variant)
      Return an integer in [0, 15]: the light level emitted by this fluid, or 0 if it doesn't naturally emit light.
    • getTemperature

      default int getTemperature(FluidVariant variant)
      Return a non-negative integer, representing the temperature of this fluid in Kelvin. The reference values are 300 for water, and 1300 for lava.
    • getViscosity

      default int getViscosity(FluidVariant variant, @Nullable @Nullable World world)
      Return a positive integer, representing the viscosity of this fluid. Fluids with lower viscosity generally flow faster than fluids with higher viscosity.

      More precisely, viscosity should be 200 * FlowableFluid.getFlowSpeed(net.minecraft.world.WorldView) for flowable 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:
      world - World if available, otherwise null.
    • isLighterThanAir

      default boolean isLighterThanAir(FluidVariant variant)
      Return true if this fluid is lighter than air. Fluids that are lighter than air generally flow upwards.