geforkt von Mirrors/FastAsyncWorldEdit
Regress to upstream for (Binary)Tags in data fixers
Dieser Commit ist enthalten in:
Ursprung
b5479e480d
Commit
37eb4a1008
@ -9,7 +9,6 @@ import com.fastasyncworldedit.core.internal.io.FaweInputStream;
|
|||||||
import com.fastasyncworldedit.core.internal.io.FaweOutputStream;
|
import com.fastasyncworldedit.core.internal.io.FaweOutputStream;
|
||||||
import com.fastasyncworldedit.core.jnbt.streamer.StreamDelegate;
|
import com.fastasyncworldedit.core.jnbt.streamer.StreamDelegate;
|
||||||
import com.fastasyncworldedit.core.jnbt.streamer.ValueReader;
|
import com.fastasyncworldedit.core.jnbt.streamer.ValueReader;
|
||||||
import com.sk89q.jnbt.AdventureNBTConverter;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.IntTag;
|
import com.sk89q.jnbt.IntTag;
|
||||||
import com.sk89q.jnbt.NBTInputStream;
|
import com.sk89q.jnbt.NBTInputStream;
|
||||||
@ -27,7 +26,6 @@ import com.sk89q.worldedit.internal.Constants;
|
|||||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.nbt.CompoundBinaryTag;
|
|
||||||
import com.sk89q.worldedit.world.DataFixer;
|
import com.sk89q.worldedit.world.DataFixer;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||||
@ -106,18 +104,18 @@ public class FastSchematicReader extends NBTSchematicReader {
|
|||||||
return fixer.fixUp(DataFixer.FixTypes.BLOCK_STATE, palettePart, dataVersion);
|
return fixer.fixUp(DataFixer.FixTypes.BLOCK_STATE, palettePart, dataVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompoundBinaryTag fixBlockEntity(CompoundTag tag) {
|
private CompoundTag fixBlockEntity(CompoundTag tag) {
|
||||||
if (fixer == null || dataVersion == -1) {
|
if (fixer == null || dataVersion == -1) {
|
||||||
return tag.asBinaryTag();
|
return tag;
|
||||||
}
|
}
|
||||||
return fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, tag.asBinaryTag(), dataVersion);
|
return fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, tag, dataVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompoundBinaryTag fixEntity(CompoundTag tag) {
|
private CompoundTag fixEntity(CompoundTag tag) {
|
||||||
if (fixer == null || dataVersion == -1) {
|
if (fixer == null || dataVersion == -1) {
|
||||||
return tag.asBinaryTag();
|
return tag;
|
||||||
}
|
}
|
||||||
return fixer.fixUp(DataFixer.FixTypes.ENTITY, tag.asBinaryTag(), dataVersion);
|
return fixer.fixUp(DataFixer.FixTypes.ENTITY, tag, dataVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String fixBiome(String biomePalettePart) {
|
private String fixBiome(String biomePalettePart) {
|
||||||
@ -353,7 +351,7 @@ public class FastSchematicReader extends NBTSchematicReader {
|
|||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
z,
|
z,
|
||||||
(CompoundTag) AdventureNBTConverter.fromAdventure(fixBlockEntity(new CompoundTag(values)))
|
fixBlockEntity(new CompoundTag(values))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,7 +372,7 @@ public class FastSchematicReader extends NBTSchematicReader {
|
|||||||
|
|
||||||
EntityType type = EntityTypes.parse(id.getValue());
|
EntityType type = EntityTypes.parse(id.getValue());
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
final CompoundTag ent = (CompoundTag) AdventureNBTConverter.fromAdventure(fixEntity(new CompoundTag(value)));
|
final CompoundTag ent = fixEntity(new CompoundTag(value));
|
||||||
BaseEntity state = new BaseEntity(type, ent);
|
BaseEntity state = new BaseEntity(type, ent);
|
||||||
Location loc = ent.getEntityLocation(clipboard);
|
Location loc = ent.getEntityLocation(clipboard);
|
||||||
if (brokenEntities) {
|
if (brokenEntities) {
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
package com.sk89q.worldedit.extent.clipboard.io;
|
package com.sk89q.worldedit.extent.clipboard.io;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.sk89q.jnbt.AdventureNBTConverter;
|
|
||||||
import com.sk89q.jnbt.ByteArrayTag;
|
import com.sk89q.jnbt.ByteArrayTag;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.IntTag;
|
import com.sk89q.jnbt.IntTag;
|
||||||
@ -229,13 +228,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fixer != null && t != null) {
|
if (fixer != null && t != null) {
|
||||||
//FAWE start
|
t = fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, t, -1);
|
||||||
t = (CompoundTag) AdventureNBTConverter.fromAdventure(fixer.fixUp(
|
|
||||||
DataFixer.FixTypes.BLOCK_ENTITY,
|
|
||||||
t.asBinaryTag(),
|
|
||||||
-1
|
|
||||||
));
|
|
||||||
//FAWE end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockVector3 vec = BlockVector3.at(x, y, z);
|
BlockVector3 vec = BlockVector3.at(x, y, z);
|
||||||
@ -296,11 +289,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
|
|||||||
if (tag instanceof CompoundTag) {
|
if (tag instanceof CompoundTag) {
|
||||||
CompoundTag compound = (CompoundTag) tag;
|
CompoundTag compound = (CompoundTag) tag;
|
||||||
if (fixer != null) {
|
if (fixer != null) {
|
||||||
compound = (CompoundTag) AdventureNBTConverter.fromAdventure(fixer.fixUp(
|
compound = fixer.fixUp(DataFixer.FixTypes.ENTITY, compound, -1);
|
||||||
DataFixer.FixTypes.ENTITY,
|
|
||||||
compound.asBinaryTag(),
|
|
||||||
-1
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
String id = convertEntityId(compound.getString("id"));
|
String id = convertEntityId(compound.getString("id"));
|
||||||
Location location = NBTConversions.toLocation(
|
Location location = NBTConversions.toLocation(
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
package com.sk89q.worldedit.extent.clipboard.io;
|
package com.sk89q.worldedit.extent.clipboard.io;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.sk89q.jnbt.AdventureNBTConverter;
|
|
||||||
import com.sk89q.jnbt.ByteArrayTag;
|
import com.sk89q.jnbt.ByteArrayTag;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.IntArrayTag;
|
import com.sk89q.jnbt.IntArrayTag;
|
||||||
@ -271,11 +270,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
|||||||
values.remove("Id");
|
values.remove("Id");
|
||||||
values.remove("Pos");
|
values.remove("Pos");
|
||||||
if (fixer != null) {
|
if (fixer != null) {
|
||||||
//FAWE start
|
tileEntity = fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, new CompoundTag(values), dataVersion).getValue();
|
||||||
tileEntity = ((CompoundTag) AdventureNBTConverter.fromAdventure(fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY,
|
|
||||||
new CompoundTag(values).asBinaryTag(), dataVersion
|
|
||||||
))).getValue();
|
|
||||||
//FAWE end
|
|
||||||
} else {
|
} else {
|
||||||
tileEntity = values;
|
tileEntity = values;
|
||||||
}
|
}
|
||||||
@ -416,13 +411,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
|||||||
entityTag = entityTag.createBuilder().putString("id", id).remove("Id").build();
|
entityTag = entityTag.createBuilder().putString("id", id).remove("Id").build();
|
||||||
|
|
||||||
if (fixer != null) {
|
if (fixer != null) {
|
||||||
//FAWE start
|
entityTag = fixer.fixUp(DataFixer.FixTypes.ENTITY, entityTag, dataVersion);
|
||||||
entityTag = (CompoundTag) AdventureNBTConverter.fromAdventure(fixer.fixUp(
|
|
||||||
DataFixer.FixTypes.ENTITY,
|
|
||||||
entityTag.asBinaryTag(),
|
|
||||||
dataVersion
|
|
||||||
));
|
|
||||||
//FAWE end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityType entityType = EntityTypes.get(id);
|
EntityType entityType = EntityTypes.get(id);
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package com.sk89q.worldedit.world;
|
package com.sk89q.worldedit.world;
|
||||||
|
|
||||||
import com.google.common.annotations.Beta;
|
import com.google.common.annotations.Beta;
|
||||||
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.util.nbt.CompoundBinaryTag;
|
import com.sk89q.worldedit.util.nbt.CompoundBinaryTag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,9 +41,9 @@ public interface DataFixer {
|
|||||||
private FixTypes() {
|
private FixTypes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FixType<CompoundBinaryTag> CHUNK = new FixType<>();
|
public static FixType<CompoundTag> CHUNK = new FixType<>();
|
||||||
public static FixType<CompoundBinaryTag> BLOCK_ENTITY = new FixType<>();
|
public static FixType<CompoundTag> BLOCK_ENTITY = new FixType<>();
|
||||||
public static FixType<CompoundBinaryTag> ENTITY = new FixType<>();
|
public static FixType<CompoundTag> ENTITY = new FixType<>();
|
||||||
public static FixType<String> BLOCK_STATE = new FixType<>();
|
public static FixType<String> BLOCK_STATE = new FixType<>();
|
||||||
public static FixType<String> BIOME = new FixType<>();
|
public static FixType<String> BIOME = new FixType<>();
|
||||||
public static FixType<String> ITEM_TYPE = new FixType<>();
|
public static FixType<String> ITEM_TYPE = new FixType<>();
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.world.storage;
|
package com.sk89q.worldedit.world.storage;
|
||||||
|
|
||||||
import com.sk89q.jnbt.AdventureNBTConverter;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.NBTInputStream;
|
import com.sk89q.jnbt.NBTInputStream;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
@ -120,13 +119,7 @@ public class ChunkStoreHelper {
|
|||||||
.containsKey("Sections") && dataVersion < currentDataVersion) { // only fix up MCA format, DFU doesn't support MCR chunks
|
.containsKey("Sections") && dataVersion < currentDataVersion) { // only fix up MCA format, DFU doesn't support MCR chunks
|
||||||
final DataFixer dataFixer = platform.getDataFixer();
|
final DataFixer dataFixer = platform.getDataFixer();
|
||||||
if (dataFixer != null) {
|
if (dataFixer != null) {
|
||||||
//FAWE start - use Adventure
|
tag = (CompoundTag) dataFixer.fixUp(DataFixer.FixTypes.CHUNK, rootTag, dataVersion).getValue().get("Level");
|
||||||
tag = (CompoundTag) ((CompoundTag) AdventureNBTConverter.fromAdventure(dataFixer.fixUp(
|
|
||||||
DataFixer.FixTypes.CHUNK,
|
|
||||||
rootTag.asBinaryTag(),
|
|
||||||
dataVersion
|
|
||||||
))).getValue().get("Level");
|
|
||||||
//FAWE end
|
|
||||||
dataVersion = currentDataVersion;
|
dataVersion = currentDataVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren