Interface MachineWorld


@NonExtendable public interface MachineWorld
What a machine can see and do in the world around it (MachineContext.world()). Every call happens at once, on the owner thread; positions of blocks owned by another thread (Folia: another region) or not loaded read as empty and are never changed.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable net.kyori.adventure.key.Key
    blockAt(@NotNull BlockPosition position)
    The block at position: a CraftEngine block's id, or a vanilla block's (e.g.
    float
    blockHardness(@NotNull BlockPosition position)
    How hard the block at position is to break (vanilla hardness); -1 if unbreakable or unknown.
    boolean
    breakBlock(@NotNull BlockPosition position)
    Breaks the block at position, its drops falling as items; false if it could not.
    collectItems(@NotNull BlockPosition position)
    Takes the dropped items lying in the block at position (e.g.
    @Nullable WorldFluid
    fluidAt(@NotNull BlockPosition position)
    The fluid in the block at position, or null if there is none, or it is not loaded or owned.
    void
    particleLine(@NotNull BlockPosition to, int color)
    Draws particles from the machine to to (a beam), e.g.
    boolean
    placeBlock(@NotNull BlockPosition position, @NotNull net.kyori.adventure.key.Key block)
    Places the vanilla block block (e.g.
    boolean
    placeFluid(@NotNull BlockPosition position, @NotNull net.kyori.adventure.key.Key fluid)
    Places a source block of the platform's fluid (e.g.
    void
    playSound(@NotNull net.kyori.adventure.key.Key sound, float volume, float pitch)
    Plays the platform's sound at the machine.
    int
    The redstone signal this machine's block receives (0 to 15).
    void
    setBlockProperty(@NotNull String property, @NotNull String value)
    Shows a state of the machine on its block: sets the block property property (e.g.
    boolean
    takeFluid(@NotNull BlockPosition position)
    Removes the fluid source block at position; false if there is none or it is not owned.
  • Method Details

    • blockAt

      @Nullable @Nullable net.kyori.adventure.key.Key blockAt(@NotNull @NotNull BlockPosition position)
      The block at position: a CraftEngine block's id, or a vanilla block's (e.g. minecraft:air); null if not loaded or not owned by this thread.
    • fluidAt

      @Nullable @Nullable WorldFluid fluidAt(@NotNull @NotNull BlockPosition position)
      The fluid in the block at position, or null if there is none, or it is not loaded or owned.
    • blockHardness

      float blockHardness(@NotNull @NotNull BlockPosition position)
      How hard the block at position is to break (vanilla hardness); -1 if unbreakable or unknown.
    • redstonePower

      int redstonePower()
      The redstone signal this machine's block receives (0 to 15).
    • placeFluid

      boolean placeFluid(@NotNull @NotNull BlockPosition position, @NotNull @NotNull net.kyori.adventure.key.Key fluid)
      Places a source block of the platform's fluid (e.g. minecraft:water) where there is air or flowing fluid.
    • takeFluid

      boolean takeFluid(@NotNull @NotNull BlockPosition position)
      Removes the fluid source block at position; false if there is none or it is not owned.
    • placeBlock

      boolean placeBlock(@NotNull @NotNull BlockPosition position, @NotNull @NotNull net.kyori.adventure.key.Key block)
      Places the vanilla block block (e.g. minecraft:stone) where there is air or a fluid.
    • breakBlock

      boolean breakBlock(@NotNull @NotNull BlockPosition position)
      Breaks the block at position, its drops falling as items; false if it could not. Machines and transports are never broken.
    • collectItems

      @NotNull @NotNull List<ResourceStack> collectItems(@NotNull @NotNull BlockPosition position)
      Takes the dropped items lying in the block at position (e.g. a tractor beam), as resources.
    • setBlockProperty

      void setBlockProperty(@NotNull @NotNull String property, @NotNull @NotNull String value)
      Shows a state of the machine on its block: sets the block property property (e.g. a valve's mode) to value, if the block has it and allows that value.
    • playSound

      void playSound(@NotNull @NotNull net.kyori.adventure.key.Key sound, float volume, float pitch)
      Plays the platform's sound at the machine.
    • particleLine

      void particleLine(@NotNull @NotNull BlockPosition to, int color)
      Draws particles from the machine to to (a beam), e.g. minecraft:dust in color (RGB).