public class Chunk
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Chunk.EnumCreateEntityType |
Modifier and Type | Field and Description |
---|---|
private byte[] |
blockBiomeArray
Contains a 16x16 mapping on the X/Z plane of the biome ID to which each colum belongs.
|
private java.util.Map<BlockPos,TileEntity> |
chunkTileEntityMap |
private ClassInheritanceMultiMap<Entity>[] |
entityLists |
private boolean |
field_150815_m |
private boolean |
hasEntities
Whether this Chunk has any Entities and thus requires saving on every tick
|
private int[] |
heightMap |
private int |
heightMapMinimum
Lowest value in the heightmap.
|
private long |
inhabitedTime
the cumulative number of ticks players have been in this chunk
|
private boolean |
isChunkLoaded
Whether or not this Chunk is currently loaded into the World
|
private boolean |
isGapLightingUpdated |
private boolean |
isLightPopulated |
private boolean |
isModified
Set to true if the chunk has been modified and needs to be updated internally.
|
private boolean |
isTerrainPopulated
Boolean value indicating if the terrain is populated.
|
private long |
lastSaveTime
The time according to World.worldTime when this chunk was last saved
|
private static org.apache.logging.log4j.Logger |
logger |
private int[] |
precipitationHeightMap
A map, similar to heightMap, that tracks how far down precipitation can fall.
|
private int |
queuedLightChecks
Contains the current round-robin relight check index, and is implied as the relight check location as well.
|
private ExtendedBlockStorage[] |
storageArrays
Used to store block IDs, block MSBs, Sky-light maps, Block-light maps, and metadata.
|
private java.util.concurrent.ConcurrentLinkedQueue<BlockPos> |
tileEntityPosQueue |
private boolean[] |
updateSkylightColumns
Which columns need their skylightMaps updated.
|
private World |
worldObj
Reference to the World object.
|
int |
xPosition
The x coordinate of the chunk.
|
int |
zPosition
The z coordinate of the chunk.
|
Constructor and Description |
---|
Chunk(World worldIn,
ChunkPrimer primer,
int x,
int z) |
Chunk(World worldIn,
int x,
int z) |
Modifier and Type | Method and Description |
---|---|
void |
addEntity(Entity entityIn)
Adds an entity to the chunk.
|
void |
addTileEntity(BlockPos pos,
TileEntity tileEntityIn) |
void |
addTileEntity(TileEntity tileEntityIn) |
boolean |
canSeeSky(BlockPos pos) |
private void |
checkSkylightNeighborHeight(int x,
int z,
int maxValue)
Checks the height of a block next to a sky-visible block and schedules a lighting update as necessary.
|
private TileEntity |
createNewTileEntity(BlockPos pos) |
void |
enqueueRelightChecks()
Called once-per-chunk-per-tick, and advances the round-robin relight check index by up to 8 blocks at a time.
|
void |
fillChunk(byte[] p_177439_1_,
int p_177439_2_,
boolean p_177439_3_)
Initialize this chunk with new binary data.
|
void |
func_150804_b(boolean p_150804_1_) |
void |
func_150809_p() |
private boolean |
func_150811_f(int x,
int z) |
private void |
func_177441_y() |
private void |
func_180700_a(EnumFacing p_180700_1_) |
protected void |
generateHeightMap()
Generates the height map for a chunk from scratch
|
void |
generateSkylightMap()
Generates the initial skylight map for the chunk upon generation or load.
|
boolean |
getAreLevelsEmpty(int startY,
int endY)
Returns whether the ExtendedBlockStorages containing levels (in blocks) from arg 1 to arg 2 are fully empty
(true) or not (false).
|
BiomeGenBase |
getBiome(BlockPos pos,
WorldChunkManager chunkManager) |
byte[] |
getBiomeArray()
Returns an array containing a 16x16 mapping on the X/Z of block positions in this Chunk to biome IDs.
|
Block |
getBlock(BlockPos pos) |
Block |
getBlock(int x,
int y,
int z) |
private Block |
getBlock0(int x,
int y,
int z)
Returns the block corresponding to the given coordinates inside a chunk.
|
int |
getBlockLightOpacity(BlockPos pos) |
private int |
getBlockLightOpacity(int x,
int y,
int z) |
int |
getBlockMetadata(BlockPos pos) |
private int |
getBlockMetadata(int x,
int y,
int z)
Return the metadata corresponding to the given coordinates inside a chunk.
|
IBlockState |
getBlockState(BlockPos pos) |
ExtendedBlockStorage[] |
getBlockStorageArray()
Returns the ExtendedBlockStorage array for this Chunk.
|
ChunkCoordIntPair |
getChunkCoordIntPair()
Gets a ChunkCoordIntPair representing the Chunk's position.
|
<T extends Entity> |
getEntitiesOfTypeWithinAAAB(java.lang.Class<? extends T> entityClass,
AxisAlignedBB aabb,
java.util.List<T> listToFill,
com.google.common.base.Predicate<? super T> p_177430_4_) |
void |
getEntitiesWithinAABBForEntity(Entity entityIn,
AxisAlignedBB aabb,
java.util.List<Entity> listToFill,
com.google.common.base.Predicate<? super Entity> p_177414_4_)
Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity.
|
ClassInheritanceMultiMap<Entity>[] |
getEntityLists() |
int |
getHeight(BlockPos pos) |
int[] |
getHeightMap() |
int |
getHeightValue(int x,
int z)
Returns the value in the height map at this x, z coordinate in the chunk
|
long |
getInhabitedTime() |
int |
getLightFor(EnumSkyBlock p_177413_1_,
BlockPos pos) |
int |
getLightSubtracted(BlockPos pos,
int amount) |
int |
getLowestHeight() |
BlockPos |
getPrecipitationHeight(BlockPos pos) |
java.util.Random |
getRandomWithSeed(long seed) |
TileEntity |
getTileEntity(BlockPos pos,
Chunk.EnumCreateEntityType p_177424_2_) |
java.util.Map<BlockPos,TileEntity> |
getTileEntityMap() |
int |
getTopFilledSegment()
Returns the topmost ExtendedBlockStorage instance for this Chunk that actually contains a block.
|
World |
getWorld() |
boolean |
isAtLocation(int x,
int z)
Checks whether the chunk is at the X/Z location specified
|
boolean |
isEmpty() |
boolean |
isLightPopulated() |
boolean |
isLoaded() |
boolean |
isPopulated() |
boolean |
isTerrainPopulated() |
boolean |
needsSaving(boolean p_76601_1_)
Returns true if this Chunk needs to be saved
|
void |
onChunkLoad()
Called when this Chunk is loaded by the ChunkProvider
|
void |
onChunkUnload()
Called when this Chunk is unloaded by the ChunkProvider
|
void |
populateChunk(IChunkProvider p_76624_1_,
IChunkProvider p_76624_2_,
int p_76624_3_,
int p_76624_4_) |
private void |
propagateSkylightOcclusion(int x,
int z)
Propagates a given sky-visible block's light value downward and upward to neighboring blocks as necessary.
|
private void |
recheckGaps(boolean p_150803_1_) |
private void |
relightBlock(int x,
int y,
int z)
Initiates the recalculation of both the block-light and sky-light for a given block inside a chunk.
|
void |
removeEntity(Entity entityIn)
removes entity using its y chunk coordinate as its index
|
void |
removeEntityAtIndex(Entity entityIn,
int p_76608_2_)
Removes entity at the specified index from the entity array.
|
void |
removeTileEntity(BlockPos pos) |
void |
resetRelightChecks()
Resets the relight check index to 0 for this Chunk.
|
void |
setBiomeArray(byte[] biomeArray)
Accepts a 256-entry array that contains a 16x16 mapping on the X/Z plane of block positions in this Chunk to
biome IDs.
|
IBlockState |
setBlockState(BlockPos pos,
IBlockState state) |
void |
setChunkLoaded(boolean loaded) |
void |
setChunkModified()
Sets the isModified flag for this Chunk
|
void |
setHasEntities(boolean hasEntitiesIn) |
void |
setHeightMap(int[] newHeightMap) |
void |
setInhabitedTime(long newInhabitedTime) |
void |
setLastSaveTime(long saveTime) |
void |
setLightFor(EnumSkyBlock p_177431_1_,
BlockPos pos,
int value) |
void |
setLightPopulated(boolean lightPopulated) |
void |
setModified(boolean modified) |
void |
setStorageArrays(ExtendedBlockStorage[] newStorageArrays) |
void |
setTerrainPopulated(boolean terrainPopulated) |
private void |
updateSkylightNeighborHeight(int x,
int z,
int startY,
int endY) |
private static final org.apache.logging.log4j.Logger logger
private final ExtendedBlockStorage[] storageArrays
private final byte[] blockBiomeArray
private final int[] precipitationHeightMap
private final boolean[] updateSkylightColumns
private boolean isChunkLoaded
private final World worldObj
private final int[] heightMap
public final int xPosition
public final int zPosition
private boolean isGapLightingUpdated
private final java.util.Map<BlockPos,TileEntity> chunkTileEntityMap
private final ClassInheritanceMultiMap<Entity>[] entityLists
private boolean isTerrainPopulated
private boolean isLightPopulated
private boolean field_150815_m
private boolean isModified
private boolean hasEntities
private long lastSaveTime
private int heightMapMinimum
private long inhabitedTime
private int queuedLightChecks
private java.util.concurrent.ConcurrentLinkedQueue<BlockPos> tileEntityPosQueue
public Chunk(World worldIn, int x, int z)
public Chunk(World worldIn, ChunkPrimer primer, int x, int z)
public boolean isAtLocation(int x, int z)
public int getHeight(BlockPos pos)
public int getHeightValue(int x, int z)
public int getTopFilledSegment()
public ExtendedBlockStorage[] getBlockStorageArray()
protected void generateHeightMap()
public void generateSkylightMap()
private void propagateSkylightOcclusion(int x, int z)
private void recheckGaps(boolean p_150803_1_)
private void checkSkylightNeighborHeight(int x, int z, int maxValue)
private void updateSkylightNeighborHeight(int x, int z, int startY, int endY)
private void relightBlock(int x, int y, int z)
public int getBlockLightOpacity(BlockPos pos)
private int getBlockLightOpacity(int x, int y, int z)
private Block getBlock0(int x, int y, int z)
public Block getBlock(int x, int y, int z)
public IBlockState getBlockState(BlockPos pos)
private int getBlockMetadata(int x, int y, int z)
public int getBlockMetadata(BlockPos pos)
public IBlockState setBlockState(BlockPos pos, IBlockState state)
public int getLightFor(EnumSkyBlock p_177413_1_, BlockPos pos)
public void setLightFor(EnumSkyBlock p_177431_1_, BlockPos pos, int value)
public int getLightSubtracted(BlockPos pos, int amount)
public void addEntity(Entity entityIn)
public void removeEntity(Entity entityIn)
public void removeEntityAtIndex(Entity entityIn, int p_76608_2_)
public boolean canSeeSky(BlockPos pos)
private TileEntity createNewTileEntity(BlockPos pos)
public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_)
public void addTileEntity(TileEntity tileEntityIn)
public void addTileEntity(BlockPos pos, TileEntity tileEntityIn)
public void removeTileEntity(BlockPos pos)
public void onChunkLoad()
public void onChunkUnload()
public void setChunkModified()
public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, java.util.List<Entity> listToFill, com.google.common.base.Predicate<? super Entity> p_177414_4_)
public <T extends Entity> void getEntitiesOfTypeWithinAAAB(java.lang.Class<? extends T> entityClass, AxisAlignedBB aabb, java.util.List<T> listToFill, com.google.common.base.Predicate<? super T> p_177430_4_)
public boolean needsSaving(boolean p_76601_1_)
public java.util.Random getRandomWithSeed(long seed)
public boolean isEmpty()
public void populateChunk(IChunkProvider p_76624_1_, IChunkProvider p_76624_2_, int p_76624_3_, int p_76624_4_)
public void func_150804_b(boolean p_150804_1_)
public boolean isPopulated()
public ChunkCoordIntPair getChunkCoordIntPair()
public boolean getAreLevelsEmpty(int startY, int endY)
public void setStorageArrays(ExtendedBlockStorage[] newStorageArrays)
public void fillChunk(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_)
public BiomeGenBase getBiome(BlockPos pos, WorldChunkManager chunkManager)
public byte[] getBiomeArray()
public void setBiomeArray(byte[] biomeArray)
public void resetRelightChecks()
public void enqueueRelightChecks()
public void func_150809_p()
private void func_177441_y()
private void func_180700_a(EnumFacing p_180700_1_)
private boolean func_150811_f(int x, int z)
public boolean isLoaded()
public void setChunkLoaded(boolean loaded)
public World getWorld()
public int[] getHeightMap()
public void setHeightMap(int[] newHeightMap)
public java.util.Map<BlockPos,TileEntity> getTileEntityMap()
public ClassInheritanceMultiMap<Entity>[] getEntityLists()
public boolean isTerrainPopulated()
public void setTerrainPopulated(boolean terrainPopulated)
public boolean isLightPopulated()
public void setLightPopulated(boolean lightPopulated)
public void setModified(boolean modified)
public void setHasEntities(boolean hasEntitiesIn)
public void setLastSaveTime(long saveTime)
public int getLowestHeight()
public long getInhabitedTime()
public void setInhabitedTime(long newInhabitedTime)