Bump Hephaistos version + fix loading of <0 sections for 1.18 worlds

This commit is contained in:
jglrxavpok 2021-12-16 22:20:57 +01:00 committed by TheMode
parent f708750045
commit 34030e3a8f
6 changed files with 6 additions and 14 deletions

View File

@ -3,6 +3,6 @@ mcVersion = 1.17
asmVersion=9.2 asmVersion=9.2
mixinVersion=0.8.4 mixinVersion=0.8.4
hephaistosVersion=2.3.0 hephaistosVersion=2.3.1
kotlinVersion=1.5.31 kotlinVersion=1.5.31
adventureVersion=4.9.3 adventureVersion=4.9.3

View File

@ -94,6 +94,7 @@ public class AnvilLoader implements IChunkLoader {
HashMap<String, Biome> biomeCache = new HashMap<>(); HashMap<String, Biome> biomeCache = new HashMap<>();
for (ChunkSection section : fileChunk.getSections().values()) { for (ChunkSection section : fileChunk.getSections().values()) {
if(!section.getEmpty()) continue;
for (int y = 0; y < Chunk.CHUNK_SECTION_SIZE; y++) { for (int y = 0; y < Chunk.CHUNK_SECTION_SIZE; y++) {
for (int z = 0; z < Chunk.CHUNK_SIZE_Z; z++) { for (int z = 0; z < Chunk.CHUNK_SIZE_Z; z++) {
for (int x = 0; x < Chunk.CHUNK_SIZE_X; x++) { for (int x = 0; x < Chunk.CHUNK_SIZE_X; x++) {

View File

@ -216,11 +216,11 @@ public class DynamicChunk extends Chunk {
index++; index++;
final byte[] skyLight = section.getSkyLight(); final byte[] skyLight = section.getSkyLight();
final byte[] blockLight = section.getBlockLight(); final byte[] blockLight = section.getBlockLight();
if (!ArrayUtils.empty(skyLight)) { if (skyLight.length != 0) {
skyLights.add(skyLight); skyLights.add(skyLight);
skyMask.set(index); skyMask.set(index);
} }
if (!ArrayUtils.empty(blockLight)) { if (blockLight.length != 0) {
blockLights.add(blockLight); blockLights.add(blockLight);
blockMask.set(index); blockMask.set(index);
} }

View File

@ -33,7 +33,7 @@ public class Tag<T> {
* Writing will override all tags. Proceed with caution. * Writing will override all tags. Proceed with caution.
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static final Tag<String> SNBT = new Tag<>(null, n -> n.toCompound().toSNBT(), (original, snbt) -> { public static final Tag<String> SNBT = new Tag<>(null, NBTCompoundLike::toSNBT, (original, snbt) -> {
try { try {
final var updated = new SNBTParser(new StringReader(snbt)).parse(); final var updated = new SNBTParser(new StringReader(snbt)).parse();
if (!(updated instanceof NBTCompound updatedCompound)) if (!(updated instanceof NBTCompound updatedCompound))

View File

@ -48,13 +48,4 @@ public final class ArrayUtils {
list.getElements(0, array, 0, array.length); list.getElements(0, array, 0, array.length);
return array; return array;
} }
public static boolean empty(byte[] array) {
for (byte b : array) {
if (b != 0) {
return false;
}
}
return true;
}
} }

View File

@ -140,7 +140,7 @@ public final class ChunkUtils {
} }
public static int getSectionAt(int y) { public static int getSectionAt(int y) {
return y / Chunk.CHUNK_SECTION_SIZE; return (int) Math.floor((double)y / Chunk.CHUNK_SECTION_SIZE);
} }
public static void forDifferingChunksInRange(int newChunkX, int newChunkZ, public static void forDifferingChunksInRange(int newChunkX, int newChunkZ,