mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2025-02-19 22:11:58 +01:00
Created Clipboard API (markdown)
parent
acaf113521
commit
b89405ec05
40
Clipboard-API.md
Normal file
40
Clipboard-API.md
Normal file
@ -0,0 +1,40 @@
|
||||
With FAWE installed, you can register a new ClipboardFormat through the API
|
||||
```Java
|
||||
ClipboardFormat.addFormat(new AbstractClipboardFormat("FAWE", "fawe") {
|
||||
@Override
|
||||
public ClipboardReader getReader(InputStream inputStream) throws IOException {
|
||||
return new FaweFormat(MainUtil.getCompressedIS(inputStream));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClipboardWriter getWriter(OutputStream outputStream) throws IOException {
|
||||
return getWriter(outputStream, 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFormat(File file) {
|
||||
return file.getName().endsWith(".fawe") || file.getName().endsWith(".bd");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExtension() {
|
||||
return "fawe";
|
||||
}
|
||||
|
||||
public ClipboardWriter getWriter(OutputStream os, int compression) throws IOException {
|
||||
FaweFormat writer = new FaweFormat(new FaweOutputStream(os));
|
||||
writer.compress(compression);
|
||||
return writer;
|
||||
}
|
||||
|
||||
public DiskOptimizedClipboard getUncompressedReadWrite(File file) throws IOException {
|
||||
return new DiskOptimizedClipboard(file);
|
||||
}
|
||||
|
||||
public DiskOptimizedClipboard createUncompressedReadWrite(int width, int height, int length, File file) {
|
||||
return new DiskOptimizedClipboard(width, height, length, file);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
The format will then be usable ingame: `//schem load <format> <file>`
|
Loading…
Reference in New Issue
Block a user