Class PreviewSnapshot

java.lang.Object
de.eldoria.schematicbrush.rendering.PreviewSnapshot

public final class PreviewSnapshot extends Object
The blocks of a brush preview, grouped by the 16x16x16 section they lie in.

A snapshot is immutable. Only blocks that differ from the world at capture time are contained.

  • Method Details

    • empty

      public static PreviewSnapshot empty()
      A snapshot without blocks.
      Returns:
      the empty snapshot
    • builder

      public static PreviewSnapshot.Builder builder(Location origin)
      Creates a builder for a snapshot.
      Parameters:
      origin - the location the preview is rendered at
      Returns:
      new builder
    • origin

      @Nullable public @Nullable Location origin()
      The location the preview is rendered at.
      Returns:
      the origin or null if the snapshot is empty
    • world

      @Nullable public @Nullable UUID world()
      The id of the world the preview belongs to.
      Returns:
      the world id or null if the snapshot is empty
    • sections

      public Set<Long> sections()
      The keys of all sections holding preview blocks.
      Returns:
      section keys as created by BlockKey.section(long)
    • section

      public Map<Long, BlockData> section(long sectionKey)
      The preview blocks of a section.
      Parameters:
      sectionKey - section key
      Returns:
      map of block key to block data, empty if the section holds no preview blocks
    • size

      public int size()
      The amount of preview blocks.
      Returns:
      block count
    • isEmpty

      public boolean isEmpty()
      Checks whether the snapshot holds no blocks.
      Returns:
      true if no blocks are contained