Interface FluidManager


public interface FluidManager
The fluid simulation, registered as a service.

Changes are made on the thread of the region owning the block.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    fluidAt(World world, BlockPosition position)
    Returns the fluid held by a block.
    boolean
    placeSource(World world, BlockPosition position, TypedKey<Fluid> fluid)
    Places a source of fluid, which then spreads: the block it replaces breaks and drops what it would drop, unless it is air or the source fills a waterloggable block.
    boolean
    removeFluid(World world, BlockPosition position)
    Takes the fluid out of a block, the way a bucket does: a fluid block turns into air, a waterlogged block dries.
    void
    Schedules a tick for the fluid of a block, due as soon as that fluid ticks, if the block holds one.
  • Method Details

    • fluidAt

      FluidState fluidAt(World world, BlockPosition position)
      Returns the fluid held by a block.: the fluid of a fluid block, the water of a waterlogged block or of a block always under water; an empty state for any other block or one that is not loaded
      Parameters:
      world - the world
      position - the block
      Returns:
      the fluid held by a block
      Since:
      0.1.0
    • placeSource

      boolean placeSource(World world, BlockPosition position, TypedKey<Fluid> fluid)
      Places a source of fluid, which then spreads: the block it replaces breaks and drops what it would drop, unless it is air or the source fills a waterloggable block.
      Parameters:
      world - the world
      position - the block
      fluid - the fluid, FluidKeys.WATER or FluidKeys.LAVA
      Returns:
      true if the source was placed
      Throws:
      IllegalArgumentException - if the fluid is neither water nor lava
      Since:
      0.1.0
    • removeFluid

      boolean removeFluid(World world, BlockPosition position)
      Takes the fluid out of a block, the way a bucket does: a fluid block turns into air, a waterlogged block dries. The fluid around then drains.
      Parameters:
      world - the world
      position - the block
      Returns:
      true if the block held a fluid that could be taken
      Since:
      0.1.0
    • scheduleUpdate

      void scheduleUpdate(World world, BlockPosition position)
      Schedules a tick for the fluid of a block, due as soon as that fluid ticks, if the block holds one.
      Parameters:
      world - the world
      position - the block
      Since:
      0.1.0