geforkt von Mirrors/FastAsyncWorldEdit
Made McRegion reading work.
Dieser Commit ist enthalten in:
Ursprung
5e7d9c7f7d
Commit
96e75a4cae
@ -60,7 +60,9 @@ public class ForwardSeekableInputStream extends InputStream {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int read(byte[] b, int off, int len) throws IOException {
|
public int read(byte[] b, int off, int len) throws IOException {
|
||||||
throw new IOException("Offset not supported for read()");
|
int read = super.read(b, off, len);
|
||||||
|
position += read;
|
||||||
|
return read;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,11 +48,12 @@ public abstract class McRegionChunkStore extends ChunkStore {
|
|||||||
|
|
||||||
protected McRegionReader getReader(Vector2D pos) throws DataException, IOException {
|
protected McRegionReader getReader(Vector2D pos) throws DataException, IOException {
|
||||||
String filename = getFilename(pos);
|
String filename = getFilename(pos);
|
||||||
if (curFilename.equals(filename)) {
|
if (curFilename != null && curFilename.equals(filename)) {
|
||||||
return cachedReader;
|
return cachedReader;
|
||||||
}
|
}
|
||||||
InputStream stream = getInputStream(filename);
|
InputStream stream = getInputStream(filename);
|
||||||
cachedReader = new McRegionReader(stream);
|
cachedReader = new McRegionReader(stream);
|
||||||
|
//curFilename = filename;
|
||||||
return cachedReader;
|
return cachedReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,8 +117,8 @@ public class McRegionReader {
|
|||||||
public synchronized InputStream getChunkInputStream(Vector2D pos)
|
public synchronized InputStream getChunkInputStream(Vector2D pos)
|
||||||
throws IOException, DataException {
|
throws IOException, DataException {
|
||||||
|
|
||||||
int x = pos.getBlockX();
|
int x = pos.getBlockX() & 31;
|
||||||
int z = pos.getBlockZ();
|
int z = pos.getBlockZ() & 31;
|
||||||
|
|
||||||
if (x < 0 || x >= 32 || z < 0 || z >= 32) {
|
if (x < 0 || x >= 32 || z < 0 || z >= 32) {
|
||||||
throw new DataException("MCRegion file does not contain " + x + "," + z);
|
throw new DataException("MCRegion file does not contain " + x + "," + z);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren