public class CachingMinecraftWorld extends java.lang.Object implements MinecraftWorld
Constructor and Description |
---|
CachingMinecraftWorld(java.io.File worldDir,
int dimension,
int minHeight,
int maxHeight,
Platform platform,
boolean readOnly,
int cacheSize) |
Modifier and Type | Method and Description |
---|---|
void |
addChunk(Chunk chunk)
Add a chunk.
|
void |
addEntity(double x,
double y,
double height,
Entity entity) |
void |
addTileEntity(int x,
int y,
int height,
TileEntity tileEntity) |
void |
close()
Close the chunk provider, flushing any changes and closing any system
resources.
|
void |
flush()
Saves all dirty chunks and closes all files.
|
int |
getBlockLightLevel(int x,
int y,
int height)
Returns
0 if height is too large. |
int |
getBlockTypeAt(int x,
int y,
int height)
Returns
Constants.BLK_AIR if height is too large. |
int |
getCacheSize() |
Chunk |
getChunk(int x,
int z)
Retrieve a chunk.
|
Chunk |
getChunkForEditing(int x,
int z)
Retrieve a chunk for editing.
|
int |
getDataAt(int x,
int y,
int height)
Returns
0 if height is too large. |
int |
getHighestNonAirBlock(int x,
int y)
Get the Z coordinate of the highest non-air block in a specific column.
|
Material |
getMaterialAt(int x,
int y,
int height)
Returns
null if height is too large. |
int |
getMaxHeight() |
int |
getMinHeight() |
int |
getSkyLightLevel(int x,
int y,
int height)
Returns
15 if height is too large. |
boolean |
isChunkPresent(int x,
int z)
Determine whether the world contains any data in a particular chunk (a
16 by 16 block area).
|
void |
replaceChunk(Chunk chunk) |
void |
saveDirtyChunks() |
void |
setBlockLightLevel(int x,
int y,
int height,
int blockLightLevel)
Fails silently if
height is too large. |
void |
setBlockTypeAt(int x,
int y,
int height,
int blockType)
Fails silently if
height is too large. |
void |
setDataAt(int x,
int y,
int height,
int data)
Fails silently if
height is too large. |
void |
setMaterialAt(int x,
int y,
int height,
Material material)
Fails silently if
height is too large. |
void |
setSkyLightLevel(int x,
int y,
int height,
int skyLightLevel)
Fails silently if
height is too large. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
markForUpdateWorld
public CachingMinecraftWorld(java.io.File worldDir, int dimension, int minHeight, int maxHeight, Platform platform, boolean readOnly, int cacheSize)
public int getMinHeight()
getMinHeight
in interface MinecraftWorld
public int getMaxHeight()
getMaxHeight
in interface MinecraftWorld
public int getBlockTypeAt(int x, int y, int height)
MinecraftWorld
Constants.BLK_AIR
if height
is too large.getBlockTypeAt
in interface MinecraftWorld
public void setBlockTypeAt(int x, int y, int height, int blockType)
MinecraftWorld
height
is too large.setBlockTypeAt
in interface MinecraftWorld
public int getDataAt(int x, int y, int height)
MinecraftWorld
0
if height
is too large.getDataAt
in interface MinecraftWorld
public void setDataAt(int x, int y, int height, int data)
MinecraftWorld
height
is too large.setDataAt
in interface MinecraftWorld
public Material getMaterialAt(int x, int y, int height)
MinecraftWorld
null
if height
is too large.getMaterialAt
in interface MinecraftWorld
public void setMaterialAt(int x, int y, int height, Material material)
MinecraftWorld
height
is too large.setMaterialAt
in interface MinecraftWorld
public int getBlockLightLevel(int x, int y, int height)
MinecraftWorld
0
if height
is too large.getBlockLightLevel
in interface MinecraftWorld
public void setBlockLightLevel(int x, int y, int height, int blockLightLevel)
MinecraftWorld
height
is too large.setBlockLightLevel
in interface MinecraftWorld
public int getSkyLightLevel(int x, int y, int height)
MinecraftWorld
15
if height
is too large.getSkyLightLevel
in interface MinecraftWorld
public void setSkyLightLevel(int x, int y, int height, int skyLightLevel)
MinecraftWorld
height
is too large.setSkyLightLevel
in interface MinecraftWorld
public boolean isChunkPresent(int x, int z)
MinecraftWorld
isChunkPresent
in interface ChunkProvider
isChunkPresent
in interface MinecraftWorld
x
- The X coordinate in chunk coordinates.z
- The Y coordinate in chunk coordinates.true
if data is present for the specified chunk.public void addChunk(Chunk chunk)
MinecraftWorld
Platform
.addChunk
in interface MinecraftWorld
chunk
- The chunk to add.public void replaceChunk(Chunk chunk)
public int getHighestNonAirBlock(int x, int y)
MinecraftWorld
getHighestNonAirBlock
in interface MinecraftWorld
x
- The X coordinate of the column.y
- The Y coordinate of the column.Integer.MIN_VALUE
if the
column is empty or no data is present
for the specified coordinates.public Chunk getChunk(int x, int z)
ChunkProvider
null
is
returned. The returned chunk may be read-only.getChunk
in interface ChunkProvider
x
- The X coordinate of the chunk to retrieve.z
- The Z coordinate of the chunk to retrieve.null
if there is no chunk at
the specified coordinates.public Chunk getChunkForEditing(int x, int z)
ChunkProvider
null
may be returned, or the provider may
create a new, empty chunk. The returned chunk is guaranteed not to be
read-only.getChunkForEditing
in interface ChunkProvider
x
- The X coordinate of the chunk to retrieve.z
- The Z coordinate of the chunk to retrieve.null
if there is no chunk at
the specified coordinates, and this chunk provider does not create new
chunks.public void flush()
public void addEntity(double x, double y, double height, Entity entity)
addEntity
in interface MinecraftWorld
public void addTileEntity(int x, int y, int height, TileEntity tileEntity)
addTileEntity
in interface MinecraftWorld
public void close()
ChunkProvider
close
in interface java.lang.AutoCloseable
close
in interface ChunkProvider
public int getCacheSize()
public void saveDirtyChunks()