Represents a Base Minecraft World.
Extended by Overworld, Nether and End
If anyone would need a CustomDimension (modded worlds maybe?), we could do that, but I'm keeping it simple for now
Constructors
public Dimension(File worldFolder, DimensionType type)| Parameters | ||
|---|---|---|
worldFolder | File | |
type | DimensionType | |
public Dimension(File worldFolder)Like above, but here we're building the
DimensionType Object ourselves, using the folder name| Parameters | ||
|---|---|---|
worldFolder | File | |
Methods
void close()Closes all RegionFilesFile dimensionFolder(RegionCategory)Chunk readChunk(int, int)Like readChunkData, but wrapped in a Chunk for simplified
access compared to raw NBT.NbtCompound readChunkData(int, int)EntityData readEntities(int, int)Like readEntityData, but wrapped in an EntityData for simplified
access compared to raw NBT.NbtCompound readEntityData(int, int)PoiData readPoi(int, int)Like readPoiData, but wrapped in a PoiData for simplified
access compared to raw NBT.NbtCompound readPoiData(int, int)void saveChunkData(Chunk)Serializes and writes a chunk's current data to its region file, creating
the region file if it doesn't exist.void saveEntityData(int, int, NbtCompound)Converts and writes Entity data for the given chunk to its
region file, creating the file if it doesn't exist yet.void saveEntityData(int, int, EntityData)Like saveEntityData(int, int, NbtCompound), but takes an
EntityData instead of requiring a .raw() call.void savePoiData(int, int, NbtCompound)Converts and writes POI (point of interest) data for the given chunk to its
region file, creating the file if it doesn't exist yet.void savePoiData(int, int, PoiData)Like savePoiData(int, int, NbtCompound), but takes a PoiData
instead of requiring a .raw() call.public void close() throws IOExceptionCloses all RegionFiles
| Throws | ||
|---|---|---|
IOException | ||
protected File dimensionFolder(RegionCategory category)| Parameters | ||
|---|---|---|
category | RegionCategory | |
| Returns | ||
File | ||
public Chunk readChunk(int chunkX, int chunkZ) throws IOExceptionLike
readChunkData, but wrapped in a Chunk for simplified
access compared to raw NBT. Returns null when the Chunk has not been generated yet.| Parameters | ||
|---|---|---|
chunkX | int | |
chunkZ | int | |
| Returns | ||
Chunk | ||
| Throws | ||
IOException | ||
public NbtCompound readChunkData(int chunkX, int chunkZ) throws IOException| Parameters | ||
|---|---|---|
chunkX | int | |
chunkZ | int | |
| Returns | ||
NbtCompound | ||
| Throws | ||
IOException | ||
public EntityData readEntities(int chunkX, int chunkZ) throws IOExceptionLike
readEntityData, but wrapped in an EntityData for simplified
access compared to raw NBT. Returns null when the Chunk has not been generated yet.| Parameters | ||
|---|---|---|
chunkX | int | |
chunkZ | int | |
| Returns | ||
EntityData | ||
| Throws | ||
IOException | ||
public NbtCompound readEntityData(int chunkX, int chunkZ) throws IOException| Parameters | ||
|---|---|---|
chunkX | int | |
chunkZ | int | |
| Returns | ||
NbtCompound | ||
| Throws | ||
IOException | ||
public PoiData readPoi(int chunkX, int chunkZ) throws IOExceptionLike
readPoiData, but wrapped in a PoiData for simplified
access compared to raw NBT. Returns null when the Chunk has not been generated yet.| Parameters | ||
|---|---|---|
chunkX | int | |
chunkZ | int | |
| Returns | ||
PoiData | ||
| Throws | ||
IOException | ||
public NbtCompound readPoiData(int chunkX, int chunkZ) throws IOException| Parameters | ||
|---|---|---|
chunkX | int | |
chunkZ | int | |
| Returns | ||
NbtCompound | ||
| Throws | ||
IOException | ||
public void saveChunkData(Chunk chunk) throws IOExceptionSerializes and writes a chunk's current data to its region file, creating
the region file if it doesn't exist. The chunk's coordinates
(chunk.chunkX()/chunkZ()) determine where it's written.
Also makes Minecraft rebuild the pois (beds, job sites, ...) of every section
Chunk.setBlock touched
Takes the world's SessionLock while writing| Parameters | ||
|---|---|---|
chunk | Chunk | |
| Throws | ||
IOException | If writing fails, or Minecraft has the world open right now | |
public void saveEntityData(int chunkX, int chunkZ, NbtCompound entityData) throws IOExceptionConverts and writes Entity data for the given chunk to its
region file, creating the file if it doesn't exist yet.
Takes the world's
SessionLock while writing| Parameters | ||
|---|---|---|
chunkX | int | |
chunkZ | int | |
entityData | NbtCompound | |
| Throws | ||
IOException | If writing fails, or Minecraft has the world open right now | |
public void saveEntityData(int chunkX, int chunkZ, EntityData entityData) throws IOExceptionLike
saveEntityData(int, int, NbtCompound), but takes an
EntityData instead of requiring a .raw() call.| Parameters | ||
|---|---|---|
chunkX | int | |
chunkZ | int | |
entityData | EntityData | |
| Throws | ||
IOException | ||
public void savePoiData(int chunkX, int chunkZ, NbtCompound poiData) throws IOExceptionConverts and writes POI (point of interest) data for the given chunk to its
region file, creating the file if it doesn't exist yet.
Takes the world's
SessionLock while writing| Parameters | ||
|---|---|---|
chunkX | int | |
chunkZ | int | |
poiData | NbtCompound | |
| Throws | ||
IOException | If writing fails, or Minecraft has the world open right now | |
public void savePoiData(int chunkX, int chunkZ, PoiData poiData) throws IOExceptionLike
savePoiData(int, int, NbtCompound), but takes a PoiData
instead of requiring a .raw() call.| Parameters | ||
|---|---|---|
chunkX | int | |
chunkZ | int | |
poiData | PoiData | |
| Throws | ||
IOException | ||