Fix schem loading of sponge schems with dataversion == 1 (#690)

* fix sponge schem loading with schem version 1
Dieser Commit ist enthalten in:
weaondara 2020-10-07 21:11:57 +02:00 committet von MattBDev
Ursprung 950b1599ec
Commit d10a5cc5fa
2 geänderte Dateien mit 15 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -32,10 +32,13 @@ import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.DataFixer;
@ -99,6 +102,7 @@ public class FastSchematicReader extends NBTSchematicReader {
public FastSchematicReader(NBTInputStream inputStream) {
checkNotNull(inputStream);
this.inputStream = inputStream;
this.fixer = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getDataFixer();
}
private String fix(String palettePart) {
@ -133,7 +137,12 @@ public class FastSchematicReader extends NBTSchematicReader {
StreamDelegate root = new StreamDelegate();
StreamDelegate schematic = root.add("Schematic");
schematic.add("DataVersion").withInt((i, v) -> dataVersion = v);
schematic.add("Version").withInt((i, v) -> version = v);
schematic.add("Version").withInt((i, v) -> {
version = v;
if (v == 1 && dataVersion == -1) { // DataVersion might not be present, assume 1.13.2
dataVersion = Constants.DATA_VERSION_MC_1_13_2;
}
});
schematic.add("Width").withInt((i, v) -> width = v);
schematic.add("Height").withInt((i, v) -> height = v);
schematic.add("Length").withInt((i, v) -> length = v);

Datei anzeigen

@ -33,6 +33,8 @@ import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.legacycompat.BannerBlockCompatibilityHandler;
import com.sk89q.worldedit.extent.clipboard.io.legacycompat.BedBlockCompatibilityHandler;
import com.sk89q.worldedit.extent.clipboard.io.legacycompat.EntityNBTCompatibilityHandler;
import com.sk89q.worldedit.extent.clipboard.io.legacycompat.FlowerPotCompatibilityHandler;
import com.sk89q.worldedit.extent.clipboard.io.legacycompat.NBTCompatibilityHandler;
@ -86,7 +88,9 @@ public class SchematicReader implements ClipboardReader {
new SignCompatibilityHandler(),
new FlowerPotCompatibilityHandler(),
new NoteBlockCompatibilityHandler(),
new SkullBlockCompatibilityHandler()
new SkullBlockCompatibilityHandler(),
new BannerBlockCompatibilityHandler(),
new BedBlockCompatibilityHandler()
};
private static final EntityNBTCompatibilityHandler[] ENTITY_COMPATIBILITY_HANDLERS = {
new Pre13HangingCompatibilityHandler()