3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-19 17:30:08 +01:00
Dieser Commit ist enthalten in:
Pierre Maurice Schwang 2024-06-23 18:06:02 +02:00
Ursprung c039ae8b9b
Commit 510dee4a49
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 37E613079F3E5BB9
3 geänderte Dateien mit 8 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -58,10 +58,6 @@ import java.util.function.BooleanSupplier;
import java.util.function.Function; import java.util.function.Function;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
/**
* TODO: fix tile entity locations (+ validate entity location)
*/
/** /**
* ClipboardReader for the Sponge Schematic Format v3. * ClipboardReader for the Sponge Schematic Format v3.
* Not necessarily much faster than {@link com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV3Reader}, but uses a * Not necessarily much faster than {@link com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV3Reader}, but uses a
@ -350,7 +346,6 @@ public class FastSchematicReaderV3 implements ClipboardReader {
final NBTOutputStream cacheStream = new NBTOutputStream(this.getDataCacheWriter()); final NBTOutputStream cacheStream = new NBTOutputStream(this.getDataCacheWriter());
cacheStream.writeByte(CACHE_IDENTIFIER_ENTITIES); cacheStream.writeByte(CACHE_IDENTIFIER_ENTITIES);
cacheStream.writeTagPayload(this.nbtInputStream.readTagPayload(NBTConstants.TYPE_LIST, 0)); cacheStream.writeTagPayload(this.nbtInputStream.readTagPayload(NBTConstants.TYPE_LIST, 0));
System.out.println("Wrote entities to cache");
return; return;
} }
if (this.dataInputStream.read() != NBTConstants.TYPE_COMPOUND) { if (this.dataInputStream.read() != NBTConstants.TYPE_COMPOUND) {
@ -437,6 +432,7 @@ public class FastSchematicReaderV3 implements ClipboardReader {
if (!stream.readUTF().equals("Data")) { if (!stream.readUTF().equals("Data")) {
throw new IOException("Expected COMPOUND tag to be Data"); throw new IOException("Expected COMPOUND tag to be Data");
} }
//noinspection deprecation
tag = ((CompoundTag) nbtStream.readTagPayload(NBTConstants.TYPE_COMPOUND, 0)).asBinaryTag(); tag = ((CompoundTag) nbtStream.readTagPayload(NBTConstants.TYPE_COMPOUND, 0)).asBinaryTag();
} }
default -> throw new IOException("Unexpected tag in compound: " + type); default -> throw new IOException("Unexpected tag in compound: " + type);
@ -631,6 +627,7 @@ public class FastSchematicReaderV3 implements ClipboardReader {
} }
private EntityTransformer provideTileEntityTransformer(Clipboard clipboard) { private EntityTransformer provideTileEntityTransformer(Clipboard clipboard) {
//noinspection deprecation
return (x, y, z, id, tag) -> clipboard.setTile( return (x, y, z, id, tag) -> clipboard.setTile(
MathMan.roundInt(x + clipboard.getMinimumPoint().x()), MathMan.roundInt(x + clipboard.getMinimumPoint().x()),
MathMan.roundInt(y + clipboard.getMinimumPoint().y()), MathMan.roundInt(y + clipboard.getMinimumPoint().y()),

Datei anzeigen

@ -125,12 +125,14 @@ public class FastSchematicWriterV3 implements ClipboardWriter {
CompoundBinaryTag tag; CompoundBinaryTag tag;
if ((tag = block.getNbt()) != null) { if ((tag = block.getNbt()) != null) {
tiles[0]++; tiles[0]++;
BlockVector3 posNormalized = pos.subtract(clipboard.getMinimumPoint());
try { try {
tileOut.writeNamedTag("Id", block.getNbtId()); tileOut.writeNamedTag("Id", block.getNbtId());
tileOut.writeNamedTag("Pos", new int[]{ tileOut.writeNamedTag("Pos", new int[]{
posNormalized.x(), posNormalized.y(), posNormalized.z() pos.x() - clipboard.getMinimumPoint().x(),
pos.y() - clipboard.getMinimumPoint().y(),
pos.z() - clipboard.getMinimumPoint().z()
}); });
//noinspection deprecation
tileOut.writeNamedTag("Data", new CompoundTag(tag)); tileOut.writeNamedTag("Data", new CompoundTag(tag));
tileOut.write(NBTConstants.TYPE_END); tileOut.write(NBTConstants.TYPE_END);
} catch (IOException e) { } catch (IOException e) {
@ -189,6 +191,7 @@ public class FastSchematicWriterV3 implements ClipboardWriter {
out.writeDouble(entity.getLocation().z() - clipboard.getMinimumPoint().z()); out.writeDouble(entity.getLocation().z() - clipboard.getMinimumPoint().z());
out.writeLazyCompoundTag("Data", data -> { out.writeLazyCompoundTag("Data", data -> {
//noinspection deprecation
CompoundTag nbt = state.getNbtData(); CompoundTag nbt = state.getNbtData();
if (nbt != null) { if (nbt != null) {
nbt.getValue().forEach((s, tag) -> { nbt.getValue().forEach((s, tag) -> {

Datei anzeigen

@ -296,7 +296,7 @@ public enum BuiltInClipboardFormat implements ClipboardFormat {
return true; return true;
} }
}, },
SPONGE_V3_SCHEMATIC("sponge.3", "slow", "safe") { SPONGE_V3_SCHEMATIC("sponge.3", "slow", "safe") { // FAWE edit aliases for fast
@Override @Override
public String getPrimaryFileExtension() { public String getPrimaryFileExtension() {
return "schem"; return "schem";