Premultiply chunk offset for incredibly small performance gain
This commit is contained in:
parent
1c789111e8
commit
32a8800344
|
|
@ -62,16 +62,16 @@ public abstract class LevelChunkMixin extends ChunkAccess {
|
|||
|
||||
@Unique
|
||||
private void scanSectionForBlockEntities(LevelChunkSection section, int i) {
|
||||
int chunkX = this.chunkPos.x;
|
||||
int chunkZ = this.chunkPos.z;
|
||||
int chunkXOff = this.chunkPos.x * 16;
|
||||
int chunkZOff = this.chunkPos.z * 16;
|
||||
BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
|
||||
int sectionY = this.getSectionYFromSectionIndex(i);
|
||||
int sectionYOff = this.getSectionYFromSectionIndex(i) * 16;
|
||||
for (int y = 0; y < 16; y++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
var state = section.getBlockState(x, y, z);
|
||||
if (state.hasBlockEntity()) {
|
||||
cursor.set(chunkX * 16 + x, sectionY * 16 + y, chunkZ * 16 + z);
|
||||
cursor.set(chunkXOff + x, sectionYOff + y, chunkZOff + z);
|
||||
makeBlockEntityIfNotExists(state, cursor);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user