Fix the coordinate-packing for block entity-loading

This commit fixes the incorrect shifting of bits when
packing the chunk-local coordinates of a block entity
into a 64-bit long for lookups.
This commit is contained in:
Gerber Lóránt Viktor 2024-03-19 17:09:39 +01:00
parent b10d15657a
commit 574bc6f9e8
3 changed files with 6 additions and 6 deletions

View File

@ -121,7 +121,7 @@ public class Chunk_1_13 extends MCAChunk {
}
this.blockEntities = level.blockEntities.stream().collect(Collectors.toMap(
it -> (long) it.getY() << 40 | (it.getX() & 0xF) << 4 | it.getZ() & 0xF, it -> it
it -> (long) it.getY() << 8 | (it.getX() & 0xF) << 4 | it.getZ() & 0xF, it -> it
));
}
@ -207,7 +207,7 @@ public class Chunk_1_13 extends MCAChunk {
@Override
public @Nullable BlockEntity getBlockEntity(int x, int y, int z) {
return blockEntities.get((long) y << 40 | (x & 0xF) << 4 | z & 0xF);
return blockEntities.get((long) y << 8 | (x & 0xF) << 4 | z & 0xF);
}
private @Nullable Section getSection(int y) {

View File

@ -120,7 +120,7 @@ public class Chunk_1_16 extends MCAChunk {
}
this.blockEntities = level.blockEntities.stream().collect(Collectors.toMap(
it -> (long) it.getY() << 40 | (it.getX() & 0xF) << 4 | it.getZ() & 0xF, it -> it
it -> (long) it.getY() << 8 | (it.getX() & 0xF) << 4 | it.getZ() & 0xF, it -> it
));
}
@ -203,7 +203,7 @@ public class Chunk_1_16 extends MCAChunk {
@Override
public @Nullable BlockEntity getBlockEntity(int x, int y, int z) {
return blockEntities.get((long) y << 40 | (x & 0xF) << 4 | z & 0xF);
return blockEntities.get((long) y << 8 | (x & 0xF) << 4 | z & 0xF);
}
private @Nullable Section getSection(int y) {

View File

@ -117,7 +117,7 @@ public class Chunk_1_18 extends MCAChunk {
}
this.blockEntities = data.blockEntities.stream().collect(Collectors.toMap(
it -> (long) it.getY() << 40 | (it.getX() & 0xF) << 4 | it.getZ() & 0xF, it -> it
it -> (long) it.getY() << 8 | (it.getX() & 0xF) << 4 | it.getZ() & 0xF, it -> it
));
}
@ -195,7 +195,7 @@ public class Chunk_1_18 extends MCAChunk {
@Override
public @Nullable BlockEntity getBlockEntity(int x, int y, int z) {
return blockEntities.get((long) y << 40 | (x & 0xF) << 4 | z & 0xF);
return blockEntities.get((long) y << 8 | (x & 0xF) << 4 | z & 0xF);
}
private @Nullable Section getSection(int y) {