Move paperweight to BinaryTag

- Upstream put paperweight into master branch, which doesn't have BinaryTags
 - Fixes #1374
This commit is contained in:
dordsor21
2021-10-22 16:00:51 +01:00
parent 7b775ca57d
commit ae949d607b
7 changed files with 141 additions and 91 deletions

View File

@ -41,9 +41,11 @@ public interface DataFixer {
private FixTypes() {
}
public static FixType<CompoundTag> CHUNK = new FixType<>();
public static FixType<CompoundTag> BLOCK_ENTITY = new FixType<>();
public static FixType<CompoundTag> ENTITY = new FixType<>();
//FAWE start - BinaryTag
public static FixType<CompoundBinaryTag> CHUNK = new FixType<>();
public static FixType<CompoundBinaryTag> BLOCK_ENTITY = new FixType<>();
public static FixType<CompoundBinaryTag> ENTITY = new FixType<>();
//FAWE end
public static FixType<String> BLOCK_STATE = new FixType<>();
public static FixType<String> BIOME = new FixType<>();
public static FixType<String> ITEM_TYPE = new FixType<>();

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.world.storage;
import com.sk89q.jnbt.AdventureNBTConverter;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.jnbt.Tag;
@ -119,7 +120,11 @@ public class ChunkStoreHelper {
.containsKey("Sections") && dataVersion < currentDataVersion) { // only fix up MCA format, DFU doesn't support MCR chunks
final DataFixer dataFixer = platform.getDataFixer();
if (dataFixer != null) {
tag = (CompoundTag) dataFixer.fixUp(DataFixer.FixTypes.CHUNK, rootTag, dataVersion).getValue().get("Level");
//FAWE start - BinaryTag
tag = (CompoundTag) AdventureNBTConverter.fromAdventure(dataFixer
.fixUp(DataFixer.FixTypes.CHUNK, rootTag.asBinaryTag(), dataVersion)
.get("Level"));
//FAWE end
dataVersion = currentDataVersion;
}
}