mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Fix schem load
This commit is contained in:
parent
09bb9c18ca
commit
c2cb463dae
@ -156,11 +156,11 @@ public class StreamDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public StreamDelegate withLong(LongValueReader valueReader) {
|
public StreamDelegate withLong(LongValueReader valueReader) {
|
||||||
return withValue(valueReader);
|
return withElem(valueReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StreamDelegate withInt(IntValueReader valueReader) {
|
public StreamDelegate withInt(IntValueReader valueReader) {
|
||||||
return withValue(valueReader);
|
return withElem(valueReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StreamDelegate withValue(ValueReader valueReader) {
|
public StreamDelegate withValue(ValueReader valueReader) {
|
||||||
|
@ -183,6 +183,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
return;
|
return;
|
||||||
case NBTConstants.TYPE_BYTE: {
|
case NBTConstants.TYPE_BYTE: {
|
||||||
ValueReader value = scope.getValueReader();
|
ValueReader value = scope.getValueReader();
|
||||||
|
if (value == null) value = scope.getElemReader();
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value.applyInt(0, is.readByte());
|
value.applyInt(0, is.readByte());
|
||||||
} else {
|
} else {
|
||||||
@ -192,6 +193,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
}
|
}
|
||||||
case NBTConstants.TYPE_SHORT: {
|
case NBTConstants.TYPE_SHORT: {
|
||||||
ValueReader value = scope.getValueReader();
|
ValueReader value = scope.getValueReader();
|
||||||
|
if (value == null) value = scope.getElemReader();
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value.applyInt(0, is.readShort());
|
value.applyInt(0, is.readShort());
|
||||||
} else {
|
} else {
|
||||||
@ -201,6 +203,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
}
|
}
|
||||||
case NBTConstants.TYPE_INT: {
|
case NBTConstants.TYPE_INT: {
|
||||||
ValueReader value = scope.getValueReader();
|
ValueReader value = scope.getValueReader();
|
||||||
|
if (value == null) value = scope.getElemReader();
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value.applyInt(0, is.readInt());
|
value.applyInt(0, is.readInt());
|
||||||
} else {
|
} else {
|
||||||
@ -210,6 +213,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
}
|
}
|
||||||
case NBTConstants.TYPE_LONG: {
|
case NBTConstants.TYPE_LONG: {
|
||||||
ValueReader value = scope.getValueReader();
|
ValueReader value = scope.getValueReader();
|
||||||
|
if (value == null) value = scope.getElemReader();
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value.applyLong(0, is.readLong());
|
value.applyLong(0, is.readLong());
|
||||||
} else {
|
} else {
|
||||||
@ -219,6 +223,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
}
|
}
|
||||||
case NBTConstants.TYPE_FLOAT: {
|
case NBTConstants.TYPE_FLOAT: {
|
||||||
ValueReader value = scope.getValueReader();
|
ValueReader value = scope.getValueReader();
|
||||||
|
if (value == null) value = scope.getElemReader();
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value.applyFloat(0, is.readFloat());
|
value.applyFloat(0, is.readFloat());
|
||||||
} else {
|
} else {
|
||||||
@ -228,6 +233,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
}
|
}
|
||||||
case NBTConstants.TYPE_DOUBLE: {
|
case NBTConstants.TYPE_DOUBLE: {
|
||||||
ValueReader value = scope.getValueReader();
|
ValueReader value = scope.getValueReader();
|
||||||
|
if (value == null) value = scope.getElemReader();
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value.applyDouble(0, is.readDouble());
|
value.applyDouble(0, is.readDouble());
|
||||||
} else {
|
} else {
|
||||||
@ -237,6 +243,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
}
|
}
|
||||||
case NBTConstants.TYPE_STRING: {
|
case NBTConstants.TYPE_STRING: {
|
||||||
ValueReader value = scope.getValueReader();
|
ValueReader value = scope.getValueReader();
|
||||||
|
if (value == null) value = scope.getElemReader();
|
||||||
int length = is.readShort() & 0xFFFF;
|
int length = is.readShort() & 0xFFFF;
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
byte[] bytes = new byte[length];
|
byte[] bytes = new byte[length];
|
||||||
|
@ -591,7 +591,6 @@ public class SchematicCommands {
|
|||||||
String filter,
|
String filter,
|
||||||
Arguments arguments
|
Arguments arguments
|
||||||
) throws WorldEditException {
|
) throws WorldEditException {
|
||||||
if (formatName.isEmpty()) formatName = null;
|
|
||||||
if (oldFirst && newFirst) {
|
if (oldFirst && newFirst) {
|
||||||
throw new StopExecutionException(TextComponent.of("Cannot sort by oldest and newest."));
|
throw new StopExecutionException(TextComponent.of("Cannot sort by oldest and newest."));
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
|||||||
if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) {
|
if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) {
|
||||||
origin = origin.subtract(BlockVector3.at(offsetX, offsetY, offsetZ));
|
origin = origin.subtract(BlockVector3.at(offsetX, offsetY, offsetZ));
|
||||||
}
|
}
|
||||||
if (blocksOut.getSize() != 0) {
|
if (blocksOut != null && blocksOut.getSize() != 0) {
|
||||||
try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(blocksOut.toByteArrays())))) {
|
try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(blocksOut.toByteArrays())))) {
|
||||||
if (clipboard instanceof LinearClipboard) {
|
if (clipboard instanceof LinearClipboard) {
|
||||||
LinearClipboard linear = (LinearClipboard) clipboard;
|
LinearClipboard linear = (LinearClipboard) clipboard;
|
||||||
@ -286,7 +286,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (biomesOut.getSize() != 0) {
|
if (biomesOut != null && biomesOut.getSize() != 0) {
|
||||||
try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(biomesOut.toByteArrays())))) {
|
try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(biomesOut.toByteArrays())))) {
|
||||||
if (clipboard instanceof LinearClipboard) {
|
if (clipboard instanceof LinearClipboard) {
|
||||||
LinearClipboard linear = (LinearClipboard) clipboard;
|
LinearClipboard linear = (LinearClipboard) clipboard;
|
||||||
|
Loading…
Reference in New Issue
Block a user