mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-26 20:16:02 +01:00
Move heightmap code above block entity check
This commit is contained in:
parent
f7b841faf3
commit
867cd4ee39
@ -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]));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user