Package net.minecraft.src
Class Chunk
java.lang.Object
net.minecraft.src.Chunk
- Direct Known Subclasses:
EmptyChunk
-
Field Summary
FieldsModifier and TypeFieldDescriptionA Map of ChunkPositions to TileEntities in this chunkList[]Array of Lists containing the entities in this Chunk.booleanWhether this Chunk has any Entities and thus requires saving on every tickint[]intLowest value in the heightmap.longthe cumulative number of ticks players have been in this chunkbooleanWhether or not this Chunk is currently loaded into the Worldstatic booleanDetermines if the chunk is lit or not at a light value greater than 0.booleanSet to true if the chunk has been modified and needs to be updated internally.booleanBoolean value indicating if the terrain is populated.longThe time according to World.worldTime when this chunk was last savedint[]A map, similar to heightMap, that tracks how far down precipitation can fall.booleanUpdates to this chunk will not be sent to clients if this is false.boolean[]Which columns need their skylightMaps updated.Reference to the World object.final intThe x coordinate of the chunk.final intThe z coordinate of the chunk. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an entity to the chunk.voidaddTileEntity(TileEntity par1TileEntity) Adds a TileEntity to a chunkbooleancanBlockSeeTheSky(int par1, int par2, int par3) Returns whether is not a block above this one blocking sight to the sky (done via checking against the heightmap)voidCalled once-per-chunk-per-tick, and advances the round-robin relight check index per-storage-block by up to 8 blocks at a time.voidfillChunk(byte[] par1ArrayOfByte, int par2, int par3, boolean par4) Initialise this chunk with new binary datavoidGenerates the height map for a chunk from scratchvoidGenerates the initial skylight map for the chunk upon generation or load.booleangetAreLevelsEmpty(int par1, int par2) Returns whether the ExtendedBlockStorages containing levels (in blocks) from arg 1 to arg 2 are fully empty (true) or not (false).byte[]Returns an array containing a 16x16 mapping on the X/Z of block positions in this Chunk to biome IDs.getBiomeGenForWorldCoords(int par1, int par2, WorldChunkManager par3WorldChunkManager) This method retrieves the biome at a set of coordinatesintgetBlockID(int par1, int par2, int par3) Return the ID of a block in the chunk.intgetBlockLightOpacity(int par1, int par2, int par3) intgetBlockLightValue(int par1, int par2, int par3, int par4) Gets the amount of light on a block taking into account sunlightintgetBlockLightValueNoSky(int x, int y, int z) Gets the amount of light on a block ignoring sunlightintgetBlockMetadata(int par1, int par2, int par3) Return the metadata corresponding to the given coordinates inside a chunk.intgetBlockNaturalLightValue(int x, int y, int z, int skylightSubtracted) Modified version of getBlockLightValue that only considers natural lightReturns the ExtendedBlockStorage array for this Chunk.getChunkBlockTileEntity(int par1, int par2, int par3) Gets the TileEntity for a given block in this chunkGets a ChunkCoordIntPair representing the Chunk's position.voidgetClosestEntityMatchingCriteriaWithinRangeSq(ClosestEntityInfo closestEntityInfo) voidgetEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) Gets all entities that can be assigned to the specified class.voidgetEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity Args: entity, aabb, listToFillintgetHeightValue(int par1, int par2) Returns the value in the height map at this x, z coordinate in the chunkintgetPrecipitationHeight(int par1, int par2) Gets the height to which rain/snow will fall.getRandomWithSeed(long par1) intgetSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4) Gets the amount of light saved in this block (doesn't adjust for daylight)intReturns the topmost ExtendedBlockStorage instance for this Chunk that actually contains a block.booleanisAtLocation(int par1, int par2) Checks whether the chunk is at the X/Z location specifiedbooleanisEmpty()booleanneedsSaving(boolean par1) Returns true if this Chunk needs to be savedvoidCalled when this Chunk is loaded by the ChunkProvidervoidCalled when this Chunk is unloaded by the ChunkProvidervoidpopulateChunk(IChunkProvider par1IChunkProvider, IChunkProvider par2IChunkProvider, int par3, int par4) voidremoveChunkBlockTileEntity(int par1, int par2, int par3) Removes the TileEntity for a given block in this chunkvoidremoveEntity(Entity par1Entity) removes entity using its y chunk coordinate as its indexvoidremoveEntityAtIndex(Entity par1Entity, int par2) Removes entity at the specified index from the entity array.voidResets the relight check index to 0 for this Chunk.voidsetBiomeArray(byte[] par1ArrayOfByte) Accepts a 256-entry array that contains a 16x16 mapping on the X/Z plane of block positions in this Chunk to biome IDs.booleansetBlockIDWithMetadata(int par1, int par2, int par3, int par4, int par5) Sets a blockID of a position within a chunk with metadata.booleansetBlockMetadata(int par1, int par2, int par3, int par4) Set the metadata of a block in the chunkvoidsetChunkBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity) Sets the TileEntity for a given block in this chunkvoidSets the isModified flag for this ChunkvoidsetLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5) Sets the light value at the coordinate.voidsetStorageArrays(ExtendedBlockStorage[] par1ArrayOfExtendedBlockStorage) voidChecks whether skylight needs updated; if it does, calls updateSkylight_do
-
Field Details
-
isLit
public static boolean isLitDetermines if the chunk is lit or not at a light value greater than 0. -
precipitationHeightMap
public int[] precipitationHeightMapA map, similar to heightMap, that tracks how far down precipitation can fall. -
updateSkylightColumns
public boolean[] updateSkylightColumnsWhich columns need their skylightMaps updated. -
isChunkLoaded
public boolean isChunkLoadedWhether or not this Chunk is currently loaded into the World -
worldObj
Reference to the World object. -
heightMap
public int[] heightMap -
xPosition
public final int xPositionThe x coordinate of the chunk. -
zPosition
public final int zPositionThe z coordinate of the chunk. -
chunkTileEntityMap
A Map of ChunkPositions to TileEntities in this chunk -
entityLists
Array of Lists containing the entities in this Chunk. Each List represents a 16 block subchunk. -
isTerrainPopulated
public boolean isTerrainPopulatedBoolean value indicating if the terrain is populated. -
isModified
public boolean isModifiedSet to true if the chunk has been modified and needs to be updated internally. -
hasEntities
public boolean hasEntitiesWhether this Chunk has any Entities and thus requires saving on every tick -
lastSaveTime
public long lastSaveTimeThe time according to World.worldTime when this chunk was last saved -
sendUpdates
public boolean sendUpdatesUpdates to this chunk will not be sent to clients if this is false. This field is set to true the first time the chunk is sent to a client, and never set to false. -
heightMapMinimum
public int heightMapMinimumLowest value in the heightmap. -
inhabitedTime
public long inhabitedTimethe cumulative number of ticks players have been in this chunk
-
-
Constructor Details
-
Chunk
-
Chunk
-
-
Method Details
-
isAtLocation
public boolean isAtLocation(int par1, int par2) Checks whether the chunk is at the X/Z location specified -
getHeightValue
public int getHeightValue(int par1, int par2) Returns the value in the height map at this x, z coordinate in the chunk -
getTopFilledSegment
public int getTopFilledSegment()Returns the topmost ExtendedBlockStorage instance for this Chunk that actually contains a block. -
getBlockStorageArray
Returns the ExtendedBlockStorage array for this Chunk. -
generateHeightMap
public void generateHeightMap()Generates the height map for a chunk from scratch -
generateSkylightMap
public void generateSkylightMap()Generates the initial skylight map for the chunk upon generation or load. -
getBlockLightOpacity
public int getBlockLightOpacity(int par1, int par2, int par3) -
getBlockID
public int getBlockID(int par1, int par2, int par3) Return the ID of a block in the chunk. -
getBlockMetadata
public int getBlockMetadata(int par1, int par2, int par3) Return the metadata corresponding to the given coordinates inside a chunk. -
setBlockIDWithMetadata
public boolean setBlockIDWithMetadata(int par1, int par2, int par3, int par4, int par5) Sets a blockID of a position within a chunk with metadata. Args: x, y, z, blockID, metadata -
setBlockMetadata
public boolean setBlockMetadata(int par1, int par2, int par3, int par4) Set the metadata of a block in the chunk -
getSavedLightValue
Gets the amount of light saved in this block (doesn't adjust for daylight) -
setLightValue
Sets the light value at the coordinate. If enumskyblock is set to sky it sets it in the skylightmap and if its a block then into the blocklightmap. Args enumSkyBlock, x, y, z, lightValue -
getBlockLightValue
public int getBlockLightValue(int par1, int par2, int par3, int par4) Gets the amount of light on a block taking into account sunlight -
addEntity
Adds an entity to the chunk. Args: entity -
removeEntity
removes entity using its y chunk coordinate as its index -
removeEntityAtIndex
Removes entity at the specified index from the entity array. -
canBlockSeeTheSky
public boolean canBlockSeeTheSky(int par1, int par2, int par3) Returns whether is not a block above this one blocking sight to the sky (done via checking against the heightmap) -
getChunkBlockTileEntity
Gets the TileEntity for a given block in this chunk -
addTileEntity
Adds a TileEntity to a chunk -
setChunkBlockTileEntity
Sets the TileEntity for a given block in this chunk -
removeChunkBlockTileEntity
public void removeChunkBlockTileEntity(int par1, int par2, int par3) Removes the TileEntity for a given block in this chunk -
onChunkLoad
public void onChunkLoad()Called when this Chunk is loaded by the ChunkProvider -
onChunkUnload
public void onChunkUnload()Called when this Chunk is unloaded by the ChunkProvider -
setChunkModified
public void setChunkModified()Sets the isModified flag for this Chunk -
getEntitiesWithinAABBForEntity
public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity Args: entity, aabb, listToFill -
getEntitiesOfTypeWithinAAAB
public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) Gets all entities that can be assigned to the specified class. Args: entityClass, aabb, listToFill -
needsSaving
public boolean needsSaving(boolean par1) Returns true if this Chunk needs to be saved -
getRandomWithSeed
-
isEmpty
public boolean isEmpty() -
populateChunk
public void populateChunk(IChunkProvider par1IChunkProvider, IChunkProvider par2IChunkProvider, int par3, int par4) -
getPrecipitationHeight
public int getPrecipitationHeight(int par1, int par2) Gets the height to which rain/snow will fall. Calculates it if not already stored. -
updateSkylight
public void updateSkylight()Checks whether skylight needs updated; if it does, calls updateSkylight_do -
getChunkCoordIntPair
Gets a ChunkCoordIntPair representing the Chunk's position. -
getAreLevelsEmpty
public boolean getAreLevelsEmpty(int par1, int par2) Returns whether the ExtendedBlockStorages containing levels (in blocks) from arg 1 to arg 2 are fully empty (true) or not (false). -
setStorageArrays
-
fillChunk
public void fillChunk(byte[] par1ArrayOfByte, int par2, int par3, boolean par4) Initialise this chunk with new binary data -
getBiomeGenForWorldCoords
public BiomeGenBase getBiomeGenForWorldCoords(int par1, int par2, WorldChunkManager par3WorldChunkManager) This method retrieves the biome at a set of coordinates -
getBiomeArray
public byte[] getBiomeArray()Returns an array containing a 16x16 mapping on the X/Z of block positions in this Chunk to biome IDs. -
setBiomeArray
public void setBiomeArray(byte[] par1ArrayOfByte) Accepts a 256-entry array that contains a 16x16 mapping on the X/Z plane of block positions in this Chunk to biome IDs. -
resetRelightChecks
public void resetRelightChecks()Resets the relight check index to 0 for this Chunk. -
enqueueRelightChecks
public void enqueueRelightChecks()Called once-per-chunk-per-tick, and advances the round-robin relight check index per-storage-block by up to 8 blocks at a time. In a worst-case scenario, can potentially take up to 1.6 seconds, calculated via (4096/(8*16))/20, to re-check all blocks in a chunk, which could explain both lagging light updates in certain cases as well as Nether relight -
getClosestEntityMatchingCriteriaWithinRangeSq
-
getBlockNaturalLightValue
public int getBlockNaturalLightValue(int x, int y, int z, int skylightSubtracted) Modified version of getBlockLightValue that only considers natural light -
getBlockLightValueNoSky
public int getBlockLightValueNoSky(int x, int y, int z) Gets the amount of light on a block ignoring sunlight
-