3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-09-08 22:02:50 +02:00

Move heightmap code above block entity check

Dieser Commit ist enthalten in:
KennyTV 2020-04-22 21:46:14 +02:00
Ursprung f7b841faf3
Commit 867cd4ee39
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 9 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -55,6 +55,14 @@ public class WorldPackets {
}
}
CompoundTag heightMaps = chunk.getHeightMap();
for (String key : heightMaps.keySet()) {
LongArrayTag heightMap = heightMaps.get(key);
int[] heightMapData = new int[256];
CompactArrayUtil.iterateCompactArray(9, heightMapData.length, heightMap.getValue(), (i, v) -> heightMapData[i] = v);
heightMap.setValue(CompactArrayUtil.createCompactArrayWithPadding(9, heightMapData.length, i -> heightMapData[i]));
}
if (chunk.getBlockEntities() == null) return;
for (CompoundTag blockEntity : chunk.getBlockEntities()) {
StringTag idTag = blockEntity.get("id");
@ -84,14 +92,6 @@ public class WorldPackets {
blockEntity.put(skullOwnerTag);
}
}
CompoundTag heightMaps = chunk.getHeightMap();
for (String key : heightMaps.keySet()) {
LongArrayTag heightMap = heightMaps.get(key);
int[] heightMapData = new int[256];
CompactArrayUtil.iterateCompactArray(9, heightMapData.length, heightMap.getValue(), (i, v) -> heightMapData[i] = v);
heightMap.setValue(CompactArrayUtil.createCompactArrayWithPadding(9, heightMapData.length, i -> heightMapData[i]));
}
});
}
});

Datei anzeigen

@ -4,7 +4,7 @@ import java.util.function.IntToLongFunction;
public class CompactArrayUtil {
//Oh no
private static final int[] MAGIC = new int[] {
private static final int[] MAGIC = {
-1, -1, 0, Integer.MIN_VALUE, 0, 0, 1431655765, 1431655765, 0, Integer.MIN_VALUE,
0, 1, 858993459, 858993459, 0, 715827882, 715827882, 0, 613566756, 613566756,
0, Integer.MIN_VALUE, 0, 2, 477218588, 477218588, 0, 429496729, 429496729, 0,