Interface FluidState

All Superinterfaces:
Wrapper

@NullMarked @AsOf("3.0.0") public interface FluidState extends Wrapper
Wraps a fluid in a specific state of data. There are no Bukkit or Paper API equivalents for this wrapper. FluidData is tied to worlds.
Since:
3.0.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Builder for FluidState.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Range(from=1L,to=8L) int
    The amount of fluid held by this state, from 1 to 8.
    Creates a new fluid state builder.
    static FluidState
    decode(Object minecraftState)
    Reads a Minecraft fluid state into a wrapper.
    static FluidState
    The empty fluid state, holding no fluid.
    boolean
    Whether the fluid in this state is falling.
    static FluidState
    flowing(FluidType fluid, int amount)
    Creates a non-falling flowing state of the given fluid.
    static FluidState
    flowing(FluidType fluid, int amount, boolean falling)
    Creates a flowing state of the given fluid.
    The fluid this state belongs to.
    default boolean
    Whether this state holds no fluid at all.
    boolean
    Whether this state is a source block.
    default float
    The height of the fluid in this state within its own block, from 0.0 to 1.0, matching net.minecraft.world.level.material.FluidState#getOwnHeight, which is defined as amount / 9f.
    static FluidState
    Creates a source state of the given fluid.
    static FluidState
    source(FluidType fluid, boolean falling)
    Creates a source state of the given fluid.
    Converts this fluid state into a builder.

    Methods inherited from interface Wrapper

    asHandle, toMinecraft, unwrap
  • Method Details

    • fluid

      @AsOf("3.0.0") FluidType fluid()
      The fluid this state belongs to.
      Returns:
      the fluid this state belongs to
      Since:
      3.0.0
    • amount

      @AsOf("3.0.0") @Range(from=1L,to=8L) int amount()
      The amount of fluid held by this state, from 1 to 8.
      Returns:
      the amount of fluid held by this state
      Since:
      3.0.0
    • isSource

      @AsOf("3.0.0") boolean isSource()
      Whether this state is a source block.
      Returns:
      true if this state is a source block
      Since:
      3.0.0
    • falling

      @AsOf("3.0.0") boolean falling()
      Whether the fluid in this state is falling. Falling fluids occupy the full block height regardless of amount().
      Returns:
      true if the fluid in this state is falling
      Since:
      3.0.0
    • isEmpty

      @AsOf("3.0.0") default boolean isEmpty()
      Whether this state holds no fluid at all.
      Returns:
      true if this state holds no fluid
      Since:
      3.0.0
    • ownHeight

      @AsOf("3.0.0") default float ownHeight()
      The height of the fluid in this state within its own block, from 0.0 to 1.0, matching net.minecraft.world.level.material.FluidState#getOwnHeight, which is defined as amount / 9f.
      Returns:
      the height of the fluid in this state within its own block
      Since:
      3.0.0
    • source

      @AsOf("3.0.0") static FluidState source(FluidType fluid)
      Creates a source state of the given fluid.
      Parameters:
      fluid - the fluid
      Returns:
      a source state of the given fluid
      Since:
      3.0.0
    • source

      @AsOf("3.0.0") static FluidState source(FluidType fluid, boolean falling)
      Creates a source state of the given fluid.
      Parameters:
      fluid - the fluid
      falling - whether the fluid is falling
      Returns:
      a source state of the given fluid
      Since:
      3.0.0
    • flowing

      @AsOf("3.0.0") static FluidState flowing(FluidType fluid, int amount)
      Creates a non-falling flowing state of the given fluid.
      Parameters:
      fluid - the fluid
      amount - the amount of fluid, from 1 to 8
      Returns:
      a flowing state of the given fluid
      Since:
      3.0.0
    • flowing

      @AsOf("3.0.0") static FluidState flowing(FluidType fluid, int amount, boolean falling)
      Creates a flowing state of the given fluid.
      Parameters:
      fluid - the fluid
      amount - the amount of fluid, from 1 to 8
      falling - whether the fluid is falling
      Returns:
      a flowing state of the given fluid
      Since:
      3.0.0
    • empty

      @AsOf("3.0.0") static FluidState empty()
      The empty fluid state, holding no fluid.
      Returns:
      the empty fluid state
      Since:
      3.0.0
    • builder

      @AsOf("3.0.0") static FluidState.Builder builder()
      Creates a new fluid state builder.
      Returns:
      a new fluid state builder
      Since:
      3.0.0
    • toBuilder

      @AsOf("3.0.0") default FluidState.Builder toBuilder()
      Converts this fluid state into a builder.
      Returns:
      a builder containing the same data as this fluid state
      Since:
      3.0.0
    • decode

      @AsOf("3.3.0") static FluidState decode(Object minecraftState)
      Reads a Minecraft fluid state into a wrapper.
      Parameters:
      minecraftState - the Minecraft fluid state to read
      Returns:
      the wrapper for the fluid state
      Since:
      3.3.0