Correctly parse last update for old chunks for regionfile recalc

It's required so that comparisons between two chunks can be
made
This commit is contained in:
Spottedleaf 2021-12-27 13:35:09 -08:00
parent 2ecc06a8fb
commit c885b21024

View file

@ -20,8 +20,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ // TODO: Check on update
+ public static long getLastWorldSaveTime(CompoundTag chunkData) {
+ final int dataVersion = ChunkStorage.getVersion(chunkData);
+ if (dataVersion < 2842) { // Level tag is removed after this version
+ final CompoundTag levelData = chunkData.getCompound("Level");
+ return levelData.getLong("LastUpdate");
+ } else {
+ return chunkData.getLong("LastUpdate");
+ }
+ }
+ // Paper end
public static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null); // Paper - Anti-Xray - Add preset block states