public class MemoryChunk extends java.lang.Object implements Chunk, MinecraftWorld, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
MemoryChunk.Section |
Modifier and Type | Field and Description |
---|---|
boolean |
readOnly |
Constructor and Description |
---|
MemoryChunk(int xPos,
int zPos,
int minHeight,
int maxHeight) |
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) |
MCRegionChunk |
clone() |
void |
close()
Close the chunk provider, flushing any changes and closing any system
resources.
|
boolean |
equals(java.lang.Object obj) |
int |
get3DBiome(int x,
int y,
int z)
Get a 3D biome, stored per 4x4x4 block.
|
int |
getBiome(int x,
int z)
Get a 2D biome, stored per column.
|
int |
getBlockLightLevel(int x,
int y,
int z)
Returns
0 if height is too large. |
int |
getBlockType(int x,
int y,
int z) |
int |
getBlockTypeAt(int x,
int y,
int height)
Returns
Constants.BLK_AIR if height is too large. |
Chunk |
getChunk(int x,
int z)
Retrieve a chunk.
|
Chunk |
getChunkForEditing(int x,
int z)
Retrieve a chunk for editing.
|
MinecraftCoords |
getCoords() |
int |
getDataAt(int x,
int y,
int height)
Returns
0 if height is too large. |
int |
getDataValue(int x,
int y,
int z) |
java.util.List<Entity> |
getEntities()
Get a list of entities contained in this chunk.
|
int |
getHeight(int x,
int z) |
int |
getHighestNonAirBlock()
Get the Y coordinate of the highest non-air (block ID zero, any data value) block in the chunk.
|
int |
getHighestNonAirBlock(int x,
int z)
Get the Y coordinate of the highest non-air (block ID zero, any data value) block in a specific column.
|
long |
getInhabitedTime() |
Material |
getMaterial(int x,
int y,
int z) |
Material |
getMaterialAt(int x,
int y,
int height)
Returns
null if height is too large. |
int |
getMaxHeight() |
int |
getMinHeight() |
MemoryChunk.Section[] |
getSections() |
int |
getSkyLightLevel(int x,
int y,
int z)
Returns
15 if height is too large. |
java.util.List<TileEntity> |
getTileEntities()
Get a list of tile entities (also known as block entities) contained in this chunk.
|
int |
getxPos() |
int |
getzPos() |
int |
hashCode() |
boolean |
is3DBiomesAvailable()
Indicates whether 3D biomes are available.
|
boolean |
is3DBiomesSupported()
Indicates whether 3D biomes are supported.
|
boolean |
isBiomesAvailable()
Indicates whether 2D biomes are available.
|
boolean |
isBiomesSupported()
Indicates whether 2D biomes are supported.
|
boolean |
isChunkPresent(int x,
int y)
Determine whether the world contains any data in a particular chunk (a
16 by 16 block area).
|
boolean |
isLightPopulated() |
boolean |
isReadOnly() |
boolean |
isSectionPresent(int y) |
boolean |
isTerrainPopulated() |
void |
set3DBiome(int x,
int y,
int z,
int biome)
Set a 3D biome, stored per 4x4x4 block.
|
void |
setBiome(int x,
int z,
int biome)
Set a 2D biome, stored per column.
|
void |
setBlockLightLevel(int x,
int y,
int z,
int blockLightLevel)
Fails silently if
height is too large. |
void |
setBlockType(int x,
int y,
int z,
int blockType) |
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 |
setDataValue(int x,
int y,
int z,
int dataValue) |
void |
setHeight(int x,
int z,
int height) |
void |
setInhabitedTime(long inhabitedTime) |
void |
setLightPopulated(boolean lightPopulated) |
void |
setMaterial(int x,
int y,
int z,
Material material) |
void |
setMaterialAt(int x,
int y,
int height,
Material material)
Fails silently if
height is too large. |
void |
setSkyLightLevel(int x,
int y,
int z,
int skyLightLevel)
Fails silently if
height is too large. |
void |
setTerrainPopulated(boolean terrainPopulated) |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getNamedBiome, isNamedBiomesAvailable, isNamedBiomesSupported, markForUpdateChunk, setNamedBiome
markForUpdateWorld
public boolean isSectionPresent(int y)
public MemoryChunk.Section[] getSections()
public int getMinHeight()
getMinHeight
in interface Chunk
getMinHeight
in interface MinecraftWorld
public int getMaxHeight()
getMaxHeight
in interface Chunk
getMaxHeight
in interface MinecraftWorld
public MinecraftCoords getCoords()
public int getBlockType(int x, int y, int z)
getBlockType
in interface Chunk
public void setBlockType(int x, int y, int z, int blockType)
setBlockType
in interface Chunk
public int getDataValue(int x, int y, int z)
getDataValue
in interface Chunk
public void setDataValue(int x, int y, int z, int dataValue)
setDataValue
in interface Chunk
public int getSkyLightLevel(int x, int y, int z)
MinecraftWorld
15
if height
is too large.getSkyLightLevel
in interface Chunk
getSkyLightLevel
in interface MinecraftWorld
public void setSkyLightLevel(int x, int y, int z, int skyLightLevel)
MinecraftWorld
height
is too large.setSkyLightLevel
in interface Chunk
setSkyLightLevel
in interface MinecraftWorld
public int getBlockLightLevel(int x, int y, int z)
MinecraftWorld
0
if height
is too large.getBlockLightLevel
in interface Chunk
getBlockLightLevel
in interface MinecraftWorld
public void setBlockLightLevel(int x, int y, int z, int blockLightLevel)
MinecraftWorld
height
is too large.setBlockLightLevel
in interface Chunk
setBlockLightLevel
in interface MinecraftWorld
public void setHeight(int x, int z, int height)
public boolean isBiomesSupported()
Chunk
Chunk.getBiome(int, int)
and Chunk.setBiome(int, int, int)
.
The default implementation returns false
.
isBiomesSupported
in interface Chunk
public boolean isBiomesAvailable()
Chunk
Chunk.getBiome(int, int)
and Chunk.setBiome(int, int, int)
.
The default implementation returns false
.
isBiomesAvailable
in interface Chunk
public boolean is3DBiomesSupported()
Chunk
Chunk.get3DBiome(int, int, int)
and
Chunk.set3DBiome(int, int, int, int)
.
The default implemenation returns false
.
is3DBiomesSupported
in interface Chunk
public boolean is3DBiomesAvailable()
Chunk
Chunk.get3DBiome(int, int, int)
and
Chunk.set3DBiome(int, int, int, int)
.
The default implemenation returns false
.
is3DBiomesAvailable
in interface Chunk
public int getBiome(int x, int z)
Chunk
UnsupportedOperationException
when invoked on a format which
does not support 2D biomes.public void setBiome(int x, int z, int biome)
Chunk
UnsupportedOperationException
when invoked on a format which
does not support 2D biomes.public int get3DBiome(int x, int y, int z)
Chunk
UnsupportedOperationException
when invoked on a format which does not support 3D biomes.get3DBiome
in interface Chunk
public void set3DBiome(int x, int y, int z, int biome)
Chunk
UnsupportedOperationException
when invoked on a format which does not support 3D biomes.set3DBiome
in interface Chunk
public boolean isTerrainPopulated()
isTerrainPopulated
in interface Chunk
public void setTerrainPopulated(boolean terrainPopulated)
setTerrainPopulated
in interface Chunk
public java.util.List<Entity> getEntities()
Chunk
getEntities
in interface Chunk
public java.util.List<TileEntity> getTileEntities()
Chunk
getTileEntities
in interface Chunk
public Material getMaterial(int x, int y, int z)
getMaterial
in interface Chunk
public void setMaterial(int x, int y, int z, Material material)
setMaterial
in interface Chunk
public boolean isReadOnly()
isReadOnly
in interface Chunk
public boolean isLightPopulated()
isLightPopulated
in interface Chunk
public void setLightPopulated(boolean lightPopulated)
setLightPopulated
in interface Chunk
public long getInhabitedTime()
getInhabitedTime
in interface Chunk
public void setInhabitedTime(long inhabitedTime)
setInhabitedTime
in interface Chunk
public int getHighestNonAirBlock(int x, int z)
Chunk
getHighestNonAirBlock
in interface Chunk
getHighestNonAirBlock
in interface MinecraftWorld
x
- The X coordinate of the column relative to the chunk.z
- The Z coordinate of the column relative to the chunk.Integer.MIN_VALUE
if the column is empty.public int getHighestNonAirBlock()
Chunk
getHighestNonAirBlock
in interface Chunk
Integer.MIN_VALUE
if the chunk is empty.public int getBlockTypeAt(int x, int y, int height)
MinecraftWorld
Constants.BLK_AIR
if height
is too large.getBlockTypeAt
in interface MinecraftWorld
public int getDataAt(int x, int y, int height)
MinecraftWorld
0
if height
is too large.getDataAt
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 setBlockTypeAt(int x, int y, int height, int blockType)
MinecraftWorld
height
is too large.setBlockTypeAt
in interface MinecraftWorld
public void setDataAt(int x, int y, int height, int data)
MinecraftWorld
height
is too large.setDataAt
in interface MinecraftWorld
public void setMaterialAt(int x, int y, int height, Material material)
MinecraftWorld
height
is too large.setMaterialAt
in interface MinecraftWorld
public boolean isChunkPresent(int x, int y)
MinecraftWorld
isChunkPresent
in interface ChunkProvider
isChunkPresent
in interface MinecraftWorld
x
- The X coordinate in chunk coordinates.y
- 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 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 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 close()
ChunkProvider
close
in interface java.lang.AutoCloseable
close
in interface ChunkProvider
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public MCRegionChunk clone()
clone
in class java.lang.Object
java.lang.UnsupportedOperationException