Rearrange DOC methods

Dieser Commit ist enthalten in:
dordsor21 2021-09-23 12:42:51 +01:00
Ursprung 07c02b5825
Commit 8593c2df9f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -129,24 +129,6 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
}
}
@Override
public URI getURI() {
return file.toURI();
}
private static BlockVector3 readSize(File file) {
try (DataInputStream is = new DataInputStream(new FileInputStream(file))) {
int version = is.readChar();
if (version > VERSION) {
throw new UnsupportedOperationException("Unsupported clipboard-on-disk version: " + version);
}
return BlockVector3.at(is.readChar(), is.readChar(), is.readChar());
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
public DiskOptimizedClipboard(File file) {
super(readSize(file));
nbtMap = new HashMap<>();
@ -165,6 +147,24 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
}
}
private static BlockVector3 readSize(File file) {
try (DataInputStream is = new DataInputStream(new FileInputStream(file))) {
int version = is.readChar();
if (version > VERSION) {
throw new UnsupportedOperationException("Unsupported clipboard-on-disk version: " + version);
}
return BlockVector3.at(is.readChar(), is.readChar(), is.readChar());
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
@Override
public URI getURI() {
return file.toURI();
}
public File getFile() {
return file;
}
@ -290,6 +290,14 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
return null;
}
@Override
public BlockVector3 getOrigin() {
int ox = byteBuffer.getShort(8);
int oy = byteBuffer.getShort(10);
int oz = byteBuffer.getShort(12);
return BlockVector3.at(ox, oy, oz);
}
@Override
public void setOrigin(BlockVector3 offset) {
super.setOrigin(offset);
@ -302,14 +310,6 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
}
}
@Override
public BlockVector3 getOrigin() {
int ox = byteBuffer.getShort(8);
int oy = byteBuffer.getShort(10);
int oz = byteBuffer.getShort(12);
return BlockVector3.at(ox, oy, oz);
}
private void setOffset(BlockVector3 offset) {
if (version == 0) {
return;