Rearrange DOC methods

This commit is contained in:
dordsor21 2021-09-23 12:42:51 +01:00
parent 07c02b5825
commit 8593c2df9f
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -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) { public DiskOptimizedClipboard(File file) {
super(readSize(file)); super(readSize(file));
nbtMap = new HashMap<>(); 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() { public File getFile() {
return file; return file;
} }
@ -290,6 +290,14 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
return null; 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 @Override
public void setOrigin(BlockVector3 offset) { public void setOrigin(BlockVector3 offset) {
super.setOrigin(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) { private void setOffset(BlockVector3 offset) {
if (version == 0) { if (version == 0) {
return; return;