Record Class SnapshotImpl.Chunk

java.lang.Object
java.lang.Record
net.minestom.server.snapshot.SnapshotImpl.Chunk
All Implemented Interfaces:
Block.Getter, ChunkSnapshot, Snapshot, TagReadable, Biome.Getter
Enclosing class:
SnapshotImpl

public static record SnapshotImpl.Chunk(int minSection, int chunkX, int chunkZ, Section[] sections, it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<Block> blockEntries, int[] entitiesIds, AtomicReference<InstanceSnapshot> instanceRef, TagReadable tagReadable) extends Record implements ChunkSnapshot
  • Constructor Details

    • Chunk

      public Chunk(int minSection, int chunkX, int chunkZ, Section[] sections, it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<Block> blockEntries, int[] entitiesIds, AtomicReference<InstanceSnapshot> instanceRef, TagReadable tagReadable)
      Creates an instance of a Chunk record class.
      Parameters:
      minSection - the value for the minSection record component
      chunkX - the value for the chunkX record component
      chunkZ - the value for the chunkZ record component
      sections - the value for the sections record component
      blockEntries - the value for the blockEntries record component
      entitiesIds - the value for the entitiesIds record component
      instanceRef - the value for the instanceRef record component
      tagReadable - the value for the tagReadable record component
  • Method Details

    • getBlock

      public @UnknownNullability Block getBlock(int x, int y, int z, @NotNull @NotNull Block.Getter.Condition condition)
      Specified by:
      getBlock in interface Block.Getter
    • getBiome

      @NotNull public @NotNull Biome getBiome(int x, int y, int z)
      Specified by:
      getBiome in interface Biome.Getter
    • getTag

      public <T> @UnknownNullability T getTag(@NotNull @NotNull Tag<T> tag)
      Description copied from interface: TagReadable
      Reads the specified tag.
      Specified by:
      getTag in interface TagReadable
      Type Parameters:
      T - the tag type
      Parameters:
      tag - the tag to read
      Returns:
      the read tag, null if not present
    • instance

      @NotNull public @NotNull InstanceSnapshot instance()
      Specified by:
      instance in interface ChunkSnapshot
    • entities

      @NotNull public @NotNull Collection<@NotNull EntitySnapshot> entities()
      Specified by:
      entities in interface ChunkSnapshot
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • minSection

      public int minSection()
      Returns the value of the minSection record component.
      Returns:
      the value of the minSection record component
    • chunkX

      public int chunkX()
      Returns the value of the chunkX record component.
      Specified by:
      chunkX in interface ChunkSnapshot
      Returns:
      the value of the chunkX record component
    • chunkZ

      public int chunkZ()
      Returns the value of the chunkZ record component.
      Specified by:
      chunkZ in interface ChunkSnapshot
      Returns:
      the value of the chunkZ record component
    • sections

      public Section[] sections()
      Returns the value of the sections record component.
      Returns:
      the value of the sections record component
    • blockEntries

      public it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<Block> blockEntries()
      Returns the value of the blockEntries record component.
      Returns:
      the value of the blockEntries record component
    • entitiesIds

      public int[] entitiesIds()
      Returns the value of the entitiesIds record component.
      Returns:
      the value of the entitiesIds record component
    • instanceRef

      public AtomicReference<InstanceSnapshot> instanceRef()
      Returns the value of the instanceRef record component.
      Returns:
      the value of the instanceRef record component
    • tagReadable

      public TagReadable tagReadable()
      Returns the value of the tagReadable record component.
      Returns:
      the value of the tagReadable record component