Class ChunkLoadStorage

java.lang.Object
com.minecolonies.api.util.ChunkLoadStorage

public class ChunkLoadStorage extends Object
The chunkload storage used to load chunks with colony information.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    NBT tag for claims to add
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChunkLoadStorage(int colonyId, long xz, boolean add, net.minecraft.resources.ResourceLocation dimension, boolean forceOwnership)
    Create a new chunkload storage.
    ChunkLoadStorage(int colonyId, long xz, net.minecraft.resources.ResourceLocation dimension, net.minecraft.core.BlockPos building, boolean add)
    Create a new chunkload storage.
    ChunkLoadStorage(net.minecraft.nbt.CompoundTag compound)
    Intitialize a ChunLoadStorage from nbt.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    applyToCap(IColonyTagCapability cap, net.minecraft.world.level.chunk.LevelChunk chunk)
    Apply this ChunkLoadStorage to a capability.
    boolean
     
    net.minecraft.resources.ResourceLocation
    Getter for the dimension.
    long
    Get the x long.
    int
     
    boolean
    Check if the chunkloadstorage is empty.
    void
    merge(ChunkLoadStorage newStorage)
    Merge the two Chunkstorages into one.
    net.minecraft.nbt.CompoundTag
    Write the ChunkLoadStorage to NBT.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ChunkLoadStorage

      public ChunkLoadStorage(net.minecraft.nbt.CompoundTag compound)
      Intitialize a ChunLoadStorage from nbt.
      Parameters:
      compound - the compound to use.
    • ChunkLoadStorage

      public ChunkLoadStorage(int colonyId, long xz, boolean add, net.minecraft.resources.ResourceLocation dimension, boolean forceOwnership)
      Create a new chunkload storage.
      Parameters:
      colonyId - the id of the colony.
      xz - the chunk xz.
      add - the operation type.
      dimension - the dimension.
      forceOwnership - if the colony should own the chunk.
    • ChunkLoadStorage

      public ChunkLoadStorage(int colonyId, long xz, net.minecraft.resources.ResourceLocation dimension, net.minecraft.core.BlockPos building, boolean add)
      Create a new chunkload storage.
      Parameters:
      colonyId - the id of the colony.
      xz - the chunk xz.
      dimension - the dimension.
      building - the building claiming this chunk.
  • Method Details

    • toNBT

      public net.minecraft.nbt.CompoundTag toNBT()
      Write the ChunkLoadStorage to NBT.
      Returns:
      the compound.
    • getDimension

      public net.minecraft.resources.ResourceLocation getDimension()
      Getter for the dimension.
      Returns:
      the dimension id.
    • getXz

      public long getXz()
      Get the x long.
      Returns:
      the long representing two integers.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • applyToCap

      public void applyToCap(IColonyTagCapability cap, net.minecraft.world.level.chunk.LevelChunk chunk)
      Apply this ChunkLoadStorage to a capability.
      Parameters:
      chunk - the chunk to apply it to.
      cap - the capability to apply it to.
    • isEmpty

      public boolean isEmpty()
      Check if the chunkloadstorage is empty.
      Returns:
      true if so.
    • merge

      public void merge(ChunkLoadStorage newStorage)
      Merge the two Chunkstorages into one. The newer one is considered to be the "more up to date" version.
      Parameters:
      newStorage - the new version to add.