tcr/java/src/game/world/ChunkCache.java
2025-03-12 18:13:11 +01:00

25 lines
768 B
Java
Executable file

package game.world;
public class ChunkCache
{
protected final int chunkX;
protected final int chunkZ;
protected final Chunk[][] chunkArray;
public ChunkCache(World worldIn, BlockPos posFromIn, BlockPos posToIn, int subIn)
{
this.chunkX = posFromIn.getX() - subIn >> 4;
this.chunkZ = posFromIn.getZ() - subIn >> 4;
int i = posToIn.getX() + subIn >> 4;
int j = posToIn.getZ() + subIn >> 4;
this.chunkArray = new Chunk[i - this.chunkX + 1][j - this.chunkZ + 1];
for (int k = this.chunkX; k <= i; ++k)
{
for (int l = this.chunkZ; l <= j; ++l)
{
this.chunkArray[k - this.chunkX][l - this.chunkZ] = worldIn.getChunk(k, l);
}
}
}
}