Class WorldEditBatch

java.lang.Object
net.risingworld.api.world.batch.WorldEditBatch

public class WorldEditBatch extends Object
Perform multiple world/terrain edits at once. This is a lot more performant compared to individual terrain edits. This object is reusable, i.e you can use it multiple times.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new world edit batch with an initial size of 32.
    WorldEditBatch(int initialCapacity)
    Creates a new world edit batch with the given initial size.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(int terrainID, int cx, int cy, int cz, int bx, int by, int bz)
    Adds a new entry to the world edit batch.
    void
    Clears the batch.
    int
    Gets the current number of world edit entries in this batch.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WorldEditBatch

      public WorldEditBatch()
      Creates a new world edit batch with an initial size of 32.
    • WorldEditBatch

      public WorldEditBatch(int initialCapacity)
      Creates a new world edit batch with the given initial size. When adding more entries, the batch increases automatically.
      Parameters:
      initialCapacity - the inital capacity. The batch resizes automatically if the capacity is exceeded.
  • Method Details

    • add

      public void add(int terrainID, int cx, int cy, int cz, int bx, int by, int bz)
      Adds a new entry to the world edit batch. The position is determined by a chunk and block index. Providing a block position outside of chunk bounds (i.e < 0 and >= Chunk.SIZE_X) is valid (the game automatically recalculates the chunk and block position then).
      Parameters:
      terrainID - the new terrain ID you want to add.
      cx - the chunk x position you want to modify.
      cy - the chunk y position you want to modify.
      cz - the chunk z position you want to modify.
      bx - the block x position within the chunk. Providing a block position outside of chunk bounds is supported.
      by - the block y position within the chunk. Providing a block position outside of chunk bounds is supported.
      bz - the block z position within the chunk. Providing a block position outside of chunk bounds is supported.
    • count

      public int count()
      Gets the current number of world edit entries in this batch.
      Returns:
      the number of entries.
    • clear

      public void clear()
      Clears the batch.