Package com.minecolonies.api.util
Class ChunkLoadStorage
java.lang.Object
com.minecolonies.api.util.ChunkLoadStorage
The chunkload storage used to load chunks with colony information.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionChunkLoadStorage(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 TypeMethodDescriptionvoidapplyToCap(IColonyTagCapability cap, net.minecraft.world.level.chunk.LevelChunk chunk) Apply this ChunkLoadStorage to a capability.booleannet.minecraft.resources.ResourceLocationGetter for the dimension.longgetXz()Get the x long.inthashCode()booleanisEmpty()Check if the chunkloadstorage is empty.voidmerge(ChunkLoadStorage newStorage) Merge the two Chunkstorages into one.net.minecraft.nbt.CompoundTagtoNBT()Write the ChunkLoadStorage to NBT.
-
Field Details
-
TAG_CLAIM_LIST
NBT tag for claims to add- See Also:
-
-
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
-
hashCode
public int hashCode() -
applyToCap
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
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.
-