This commit is contained in:
Jesse Boyd 2018-04-19 23:55:03 +10:00
parent 11ac395ff6
commit 40a569e14e
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 61 additions and 3 deletions

View File

@ -0,0 +1,56 @@
package com.boydti.fawe.object.io;
import java.io.IOException;
import java.io.InputStream;
public class NonCloseableInputStream extends InputStream {
private final InputStream parent;
public NonCloseableInputStream(InputStream parent) {
this.parent = parent;
}
@Override
public int read() throws IOException {
return parent.read();
}
@Override
public int read(byte[] b) throws IOException {
return parent.read(b);
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
return parent.read(b, off, len);
}
@Override
public long skip(long n) throws IOException {
return parent.skip(n);
}
@Override
public int available() throws IOException {
return parent.available();
}
@Override
public void close() throws IOException {
}
@Override
public void mark(int readlimit) {
parent.mark(readlimit);
}
@Override
public void reset() throws IOException {
parent.reset();
}
@Override
public boolean markSupported() {
return parent.markSupported();
}
}

View File

@ -9,6 +9,7 @@ import com.boydti.fawe.object.clipboard.LazyClipboardHolder;
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
import com.boydti.fawe.object.clipboard.URIClipboardHolder;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.io.NonCloseableInputStream;
import com.boydti.fawe.object.queue.LazyFaweChunk;
import com.boydti.fawe.object.schematic.Schematic;
import com.boydti.fawe.util.*;
@ -457,7 +458,8 @@ public class SchemVis extends ImmutableVirtualWorld {
try (FileInputStream fis = new FileInputStream(cached)) {
BlockVector2D dimensions = new BlockVector2D(IOUtil.readVarInt(fis), IOUtil.readVarInt(fis));
try (FaweInputStream in = MainUtil.getCompressedIS(fis)) {
try (NBTInputStream nis = new NBTInputStream(in)) {
NonCloseableInputStream nonCloseable = new NonCloseableInputStream(in);
try (NBTInputStream nis = new NBTInputStream(nonCloseable)) {
int numChunks = in.readInt();
for (int i = 0; i < numChunks; i++) {

View File

@ -96,7 +96,7 @@ public class PatternCommands extends MethodCommands {
@Command(
aliases = {"#simplex"},
desc = "Use simplex noise to randomize blocks",
desc = "Use simplex noise to randomize blocks. Tutorial: https://imgur.com/a/rwVAE",
usage = "<scale=10> <pattern>",
min = 2,
max = 2
@ -377,7 +377,7 @@ public class PatternCommands extends MethodCommands {
@Command(
aliases = {"#surfacespread"},
desc = "Applies to only blocks on a surface. Selects a block from provided pattern with a given ranomized offset [0, <distance>). e.g. Use `#existing` to randomly offset blocks in the world, or `#copy` to offset blocks in your clipboard",
desc = "Applies to only blocks on a surface. Selects a block from provided pattern with a given ranomized offset `[0, <distance>)`. e.g. Use `#existing` to randomly offset blocks in the world, or `#copy` to offset blocks in your clipboard",
usage = "<distance> <pattern>",
min = 2,
max = 2