Interface FluidManager


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

Coordinates are absolute block coordinates in the world identified by its key.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    fluidAt(Key world, int x, int y, int z)
    Returns the fluid held by a block, FluidState.empty() if the world is not loaded.
    void
    notifyBlockChanged(Key world, int x, int y, int z)
    Tells the simulation a block changed, so the fluids of it and its six neighbours update.
    boolean
    placeSource(Key world, int x, int y, int z, FluidType type)
    Places a fluid source and lets it spread.
    boolean
    removeFluid(Key world, int x, int y, int z)
    Removes the fluid of a block and lets the surroundings drain.
    void
    scheduleUpdate(Key world, int x, int y, int z)
    Schedules the next spreading step of the fluid at a block, if any.
  • Method Details

    • fluidAt

      FluidState fluidAt(Key world, int x, int y, int z)
      Returns the fluid held by a block, FluidState.empty() if the world is not loaded.
      Parameters:
      world - the world key
      x - the block X coordinate
      y - the block Y coordinate
      z - the block Z coordinate
      Returns:
      the fluid held by a block, FluidState.empty() if the world is not loaded
      Since:
      0.1.0
    • placeSource

      boolean placeSource(Key world, int x, int y, int z, FluidType type)
      Places a fluid source and lets it spread.
      Parameters:
      world - the world key
      x - the block X coordinate
      y - the block Y coordinate
      z - the block Z coordinate
      type - the fluid
      Returns:
      true if the source was placed
      Since:
      0.1.0
    • removeFluid

      boolean removeFluid(Key world, int x, int y, int z)
      Removes the fluid of a block and lets the surroundings drain.
      Parameters:
      world - the world key
      x - the block X coordinate
      y - the block Y coordinate
      z - the block Z coordinate
      Returns:
      true if the block held a fluid
      Since:
      0.1.0
    • scheduleUpdate

      void scheduleUpdate(Key world, int x, int y, int z)
      Schedules the next spreading step of the fluid at a block, if any.
      Parameters:
      world - the world key
      x - the block X coordinate
      y - the block Y coordinate
      z - the block Z coordinate
      Since:
      0.1.0
    • notifyBlockChanged

      void notifyBlockChanged(Key world, int x, int y, int z)
      Tells the simulation a block changed, so the fluids of it and its six neighbours update.
      Parameters:
      world - the world key
      x - the block X coordinate
      y - the block Y coordinate
      z - the block Z coordinate
      Since:
      0.1.0