3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-10 05:20:04 +01:00

Made McRegion reading work.

Dieser Commit ist enthalten in:
sk89q 2011-03-09 23:44:04 -08:00
Ursprung 5e7d9c7f7d
Commit 96e75a4cae
3 geänderte Dateien mit 7 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -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;
} }

Datei anzeigen

@ -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);