Package com.minecolonies.core.util
Class ChunkDataHelper
java.lang.Object
com.minecolonies.core.util.ChunkDataHelper
Class to take care of chunk data helper.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddStorageToChunk(net.minecraft.world.level.chunk.LevelChunk chunk, ChunkLoadStorage storage) Add a chunk storage to a chunk.static booleancanClaimChunksInRange(net.minecraft.world.level.Level w, net.minecraft.core.BlockPos pos, int range) Check if all chunks within a certain range can be claimed, if range is too big this might require to load chunks.static voidclaimBuildingChunks(IColony colony, boolean add, net.minecraft.core.BlockPos center, int range, @Nullable net.minecraft.util.Tuple<net.minecraft.core.BlockPos, net.minecraft.core.BlockPos> corners) Notify all chunks in the range of the colony about the colony.static voidclaimColonyChunks(net.minecraft.world.level.Level world, boolean add, int id, net.minecraft.core.BlockPos center) Notify all chunks in the range of the colony about the colony.static voidloadChunk(net.minecraft.world.level.chunk.LevelChunk chunk, net.minecraft.world.level.Level world) Load the colony info for a certain chunk.static voidstaticClaimInRange(int colonyId, boolean add, net.minecraft.core.BlockPos center, int range, net.minecraft.world.level.Level world, boolean forceOwnerChange) Claim a number of chunks in a certain range around a position.static booleantryClaim(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos chunkBlockPos, boolean add, int id, IChunkmanagerCapability chunkManager, boolean forceOwnerChange) Add the data to the chunk directly.static booleantryClaimBuilding(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos chunkBlockPos, boolean add, IColony colony, net.minecraft.core.BlockPos buildingPos, IChunkmanagerCapability chunkManager) Add the data to the chunk directly for dynamic claiming.static voidunloadChunk(net.minecraft.world.level.chunk.LevelChunk chunk, net.minecraft.world.level.Level world) Called when a chunk is unloaded
-
Method Details
-
loadChunk
public static void loadChunk(net.minecraft.world.level.chunk.LevelChunk chunk, net.minecraft.world.level.Level world) Load the colony info for a certain chunk.- Parameters:
chunk- the chunk.world- the worldg to.
-
unloadChunk
public static void unloadChunk(net.minecraft.world.level.chunk.LevelChunk chunk, net.minecraft.world.level.Level world) Called when a chunk is unloaded- Parameters:
world- the world it is unloading in.chunk- the chunk that is unloading.
-
addStorageToChunk
public static void addStorageToChunk(net.minecraft.world.level.chunk.LevelChunk chunk, ChunkLoadStorage storage) Add a chunk storage to a chunk.- Parameters:
chunk- the chunk to add it to.storage- the said storage.
-
claimColonyChunks
public static void claimColonyChunks(net.minecraft.world.level.Level world, boolean add, int id, net.minecraft.core.BlockPos center) Notify all chunks in the range of the colony about the colony.- Parameters:
world- the world.add- if add or remove.id- the colony id.center- the center chunk.
-
claimBuildingChunks
public static void claimBuildingChunks(IColony colony, boolean add, net.minecraft.core.BlockPos center, int range, @Nullable @Nullable net.minecraft.util.Tuple<net.minecraft.core.BlockPos, net.minecraft.core.BlockPos> corners) Notify all chunks in the range of the colony about the colony.--- This is only for dynamic claiming ---
- Parameters:
colony- the colony to claim foradd- if add or remove.center- the center position of the colony.range- the range to claim.corners- also (un)claim all chunks intersecting this box (if not null)
-
canClaimChunksInRange
public static boolean canClaimChunksInRange(net.minecraft.world.level.Level w, net.minecraft.core.BlockPos pos, int range) Check if all chunks within a certain range can be claimed, if range is too big this might require to load chunks. Use carefully.--- This is only for dynamic claiming ---
- Parameters:
w- the world.pos- the center position.range- the range to check.- Returns:
- true if possible.
-
staticClaimInRange
public static void staticClaimInRange(int colonyId, boolean add, net.minecraft.core.BlockPos center, int range, net.minecraft.world.level.Level world, boolean forceOwnerChange) Claim a number of chunks in a certain range around a position.- Parameters:
colonyId- the colony id.add- if claim or unclaim.center- the center position to be claimed.range- the range.world- the world.
-
tryClaim
public static boolean tryClaim(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos chunkBlockPos, boolean add, int id, IChunkmanagerCapability chunkManager, boolean forceOwnerChange) Add the data to the chunk directly.- Parameters:
world- the world.chunkBlockPos- the position.add- if add or delete.id- the id.chunkManager- the chunk manager capability.- Returns:
- true if successful.
-
tryClaimBuilding
public static boolean tryClaimBuilding(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos chunkBlockPos, boolean add, IColony colony, net.minecraft.core.BlockPos buildingPos, IChunkmanagerCapability chunkManager) Add the data to the chunk directly for dynamic claiming.----- Only for dynamic claiming -----
- Parameters:
world- the world.chunkBlockPos- the position.add- if add or delete.colony- the colony.buildingPos- the building pos.chunkManager- the chunk manager capability.- Returns:
- true if successful.
-