Interface PlacementContext<C>

Type Parameters:
C - the feature's configuration type

@NullMarked @AsOf("2.3.0") public interface PlacementContext<C>
The placement surface handed to a CustomFeature during world generation.
Since:
2.3.0
  • Field Details

  • Method Details

    • config

      @AsOf("2.3.0") C config()
      The feature's configuration.
      Returns:
      the config instance
      Since:
      2.3.0
    • random

      @AsOf("2.3.0") Random random()
      A random source seeded for this placement.
      Returns:
      a view of the world generation random
      Since:
      2.3.0
    • origin

      @AsOf("2.3.0") BlockVector origin()
      The world origin of this feature placement.
      Returns:
      the origin as a BlockVector
      Since:
      2.3.0
    • setBlock

      @AsOf("2.3.0") void setBlock(BlockVector position, BlockData data)
      Sets a block at the given absolute world position.
      Parameters:
      position - the absolute world position
      data - the block data to place
      Since:
      2.3.0
    • getBlock

      @AsOf("2.3.0") BlockData getBlock(BlockVector position)
      Gets the block data at the given absolute world position.
      Parameters:
      position - the absolute world position
      Returns:
      the block data currently at that position
      Since:
      2.3.0
    • removeBlock

      @AsOf("2.3.0") boolean removeBlock(BlockVector position, boolean movedByPiston)
      Removes a block at the given absolute world position.
      Parameters:
      position - the absolute world position
      movedByPiston - whether the block was moved by a piston
      Returns:
      whether the block was removed
      Since:
      2.3.0
    • removeBlock

      @AsOf("2.3.0") default boolean removeBlock(BlockVector position)
      Removes a block at the given absolute world position.
      Parameters:
      position - the absolute world position
      Returns:
      whether the block was removed
      Since:
      2.3.0
    • destroyBlock

      @AsOf("2.3.0") boolean destroyBlock(BlockVector position, boolean dropResources, @Nullable Entity breaker, int updateLimit)
      Destroys a block at the given absolute world position.
      Parameters:
      position - the absolute world position
      dropResources - whether to drop resources
      breaker - the entity that broke the block, if any
      updateLimit - the maximum number of blocks to update
      Returns:
      whether the block was destroyed
      Since:
      2.3.0
    • destroyBlock

      @AsOf("2.3.0") default boolean destroyBlock(BlockVector position, boolean dropResources, @Nullable Entity breaker)
      Destroys a block at the given absolute world position.
      Parameters:
      position - the absolute world position
      dropResources - whether to drop resources
      breaker - the entity that broke the block, if any
      Returns:
      whether the block was destroyed
      Since:
      2.3.0
    • destroyBlock

      @AsOf("2.3.0") default boolean destroyBlock(BlockVector position, boolean dropResources)
      Destroys a block at the given absolute world position.
      Parameters:
      position - the absolute world position
      dropResources - whether to drop resources
      Returns:
      whether the block was destroyed
      Since:
      2.3.0
    • addFreshEntity

      @AsOf("2.3.0") boolean addFreshEntity(Entity entity, @Nullable CreatureSpawnEvent.SpawnReason reason)
      Adds a new entity to the world.
      Parameters:
      entity - the entity to add
      reason - the reason the entity was spawned
      Returns:
      whether the entity was added successfully
      Since:
      2.3.0
    • addFreshEntity

      @AsOf("2.3.0") default boolean addFreshEntity(Entity entity)
      Adds a new entity to the world.
      Parameters:
      entity - the entity to add
      Returns:
      whether the entity was added successfully
      Since:
      2.3.0