Class ChunkStore
java.lang.Object
com.sk89q.worldedit.world.storage.ChunkStore
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
LegacyChunkStore
,McRegionChunkStore
Represents chunk storage mechanisms.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The shift for converting to/from a chunk position.static final int
The shift for converting to/from a 3D chunk position. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getChunk
(BlockVector2 position, World world) Get a chunk at a location.abstract CompoundTag
getChunkTag
(BlockVector2 position, World world) Get the tag for a chunk.abstract boolean
isValid()
Returns whether the chunk store is of this type.static BlockVector2
toChunk
(BlockVector3 position) Convert a position to a chunk.static BlockVector3
toChunk3d
(BlockVector3 position) Convert a position to a 3D-chunk.
-
Field Details
-
CHUNK_SHIFTS
public static final int CHUNK_SHIFTSThe shift for converting to/from a chunk position.>>
- to chunk<<
- from chunk- See Also:
-
CHUNK_SHIFTS_Y
public static final int CHUNK_SHIFTS_YThe shift for converting to/from a 3D chunk position.>>
- to Y of 3D-chunk<<
- from Y of 3D-chunk- See Also:
-
-
Constructor Details
-
ChunkStore
public ChunkStore()
-
-
Method Details
-
toChunk3d
Convert a position to a 3D-chunk. Y is counted in steps of 256.- Parameters:
position
- the position- Returns:
- chunk coordinates
-
toChunk
Convert a position to a chunk.- Parameters:
position
- the position- Returns:
- chunk coordinates
-
getChunkTag
public abstract CompoundTag getChunkTag(BlockVector2 position, World world) throws DataException, IOException Get the tag for a chunk.- Parameters:
position
- the position of the chunk- Returns:
- tag
- Throws:
DataException
- thrown on data errorIOException
- thrown on I/O error
-
getChunk
Get a chunk at a location.- Parameters:
position
- the position of the chunk- Returns:
- a chunk
- Throws:
ChunkStoreException
- thrown if there is an error from the chunk storeDataException
- thrown on data errorIOException
- thrown on I/O error
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
isValid
public abstract boolean isValid()Returns whether the chunk store is of this type.- Returns:
- true if valid
-