@ParametersAreNonnullByDefault
public interface ICubicStorage
extends java.io.Flushable, java.lang.AutoCloseable
Implementations of this class must be thread-safe.
Unless otherwise specified by the implementation, absolutely NO atomicity guarantees are made whatsoever.
| Modifier and Type | Interface and Description |
|---|---|
static class |
ICubicStorage.NBTBatch
A group of position+NBT data pairs for both column and cube data.
|
static class |
ICubicStorage.PosBatch
A group of positions for both columns and cubes.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this storage.
|
boolean |
columnExists(net.minecraft.util.math.ChunkPos pos)
Checks whether the column at the given position exists.
|
boolean |
cubeExists(CubePos pos)
Checks whether the cube at the given position exists.
|
default ICubicStorage.PosBatch |
existsBatch(ICubicStorage.PosBatch positions)
Checks for the existence of multiple cubes+columns at once.
|
void |
flush()
Forces any internally buffered data to be written to disk immediately, blocking until the action is completed.
|
void |
forEachColumn(java.util.function.Consumer<net.minecraft.util.math.ChunkPos> callback)
Iterates over all the columns that exist in the world.
|
void |
forEachCube(java.util.function.Consumer<CubePos> callback)
Iterates over all the cubes that exist in the world.
|
default ICubicStorage.NBTBatch |
readBatch(ICubicStorage.PosBatch positions)
Reads the NBT data for multiple cubes+columns at once.
|
net.minecraft.nbt.NBTTagCompound |
readColumn(net.minecraft.util.math.ChunkPos pos)
Reads the NBT data for the column at the given position.
|
net.minecraft.nbt.NBTTagCompound |
readCube(CubePos pos)
Reads the NBT data for the cube at the given position.
|
default void |
writeBatch(ICubicStorage.NBTBatch batch)
Writes the NBT data for multiple cubes+columns at once.
|
void |
writeColumn(net.minecraft.util.math.ChunkPos pos,
net.minecraft.nbt.NBTTagCompound nbt)
Writes the NBT data to the column at the given position.
|
void |
writeCube(CubePos pos,
net.minecraft.nbt.NBTTagCompound nbt)
Writes the NBT data to the cube at the given position.
|
boolean columnExists(net.minecraft.util.math.ChunkPos pos)
throws java.io.IOException
pos - the column's positionjava.io.IOException - if there is an IO errorboolean cubeExists(CubePos pos) throws java.io.IOException
pos - the cube's positionjava.io.IOException - if there is an IO error@Nonnull default ICubicStorage.PosBatch existsBatch(ICubicStorage.PosBatch positions) throws java.io.IOException
positions - a ICubicStorage.PosBatch containing the positions of all the cubes+columns to check forICubicStorage.PosBatch containing the positions of all the cubes+columns that existjava.io.IOException - if there is an IO errornet.minecraft.nbt.NBTTagCompound readColumn(net.minecraft.util.math.ChunkPos pos)
throws java.io.IOException
pos - the column's positionnull if the column couldn't be foundjava.io.IOException - if there is an IO errornet.minecraft.nbt.NBTTagCompound readCube(CubePos pos) throws java.io.IOException
pos - the cube's positionnull if the cube couldn't be foundjava.io.IOException - if there is an IO error@Nonnull default ICubicStorage.NBTBatch readBatch(ICubicStorage.PosBatch positions) throws java.io.IOException
positions - a ICubicStorage.PosBatch containing the positions of all the cubes+columns to readICubicStorage.NBTBatch containing all the given cube+column positions mapped to their corresponding NBT data, or null for cubes/columns that can't be foundjava.io.IOException - if there is an IO errorvoid writeColumn(net.minecraft.util.math.ChunkPos pos,
net.minecraft.nbt.NBTTagCompound nbt)
throws java.io.IOException
pos - the column's positionnbt - the column's NBT datajava.io.IOException - if there is an IO errorvoid writeCube(CubePos pos, net.minecraft.nbt.NBTTagCompound nbt) throws java.io.IOException
pos - the cube's positionnbt - the cube's NBT datajava.io.IOException - if there is an IO errordefault void writeBatch(ICubicStorage.NBTBatch batch) throws java.io.IOException
batch - a ICubicStorage.NBTBatch containing the cube+column positions and the NBT data to write to eachjava.io.IOException - if there is an IO errorvoid forEachColumn(java.util.function.Consumer<net.minecraft.util.math.ChunkPos> callback)
throws java.io.IOException
callback - the callback function to runjava.io.IOException - if there is an IO errorvoid forEachCube(java.util.function.Consumer<CubePos> callback) throws java.io.IOException
callback - the callback function to runjava.io.IOException - if there is an IO errorvoid flush()
throws java.io.IOException
Once this method returns, all writes issued at the time of this method's invocation are guaranteed to be present on disk.
flush in interface java.io.Flushablejava.io.IOException - if there is an IO errorvoid close()
throws java.io.IOException
This method may only be called once for a given of ICubicStorage. Once called, the instance shall be considered to have been disposed, and the behavior of
all other methods is undefined.
close in interface java.lang.AutoCloseablejava.io.IOException - if there is an IO error