Class Chunk

java.lang.Object
net.minecraft.src.Chunk
Direct Known Subclasses:
EmptyChunk

public class Chunk extends Object
  • Field Details

    • isLit

      public static boolean isLit
      Determines if the chunk is lit or not at a light value greater than 0.
    • precipitationHeightMap

      public int[] precipitationHeightMap
      A map, similar to heightMap, that tracks how far down precipitation can fall.
    • updateSkylightColumns

      public boolean[] updateSkylightColumns
      Which columns need their skylightMaps updated.
    • isChunkLoaded

      public boolean isChunkLoaded
      Whether or not this Chunk is currently loaded into the World
    • worldObj

      public World worldObj
      Reference to the World object.
    • heightMap

      public int[] heightMap
    • xPosition

      public final int xPosition
      The x coordinate of the chunk.
    • zPosition

      public final int zPosition
      The z coordinate of the chunk.
    • chunkTileEntityMap

      public Map chunkTileEntityMap
      A Map of ChunkPositions to TileEntities in this chunk
    • entityLists

      public List[] entityLists
      Array of Lists containing the entities in this Chunk. Each List represents a 16 block subchunk.
    • isTerrainPopulated

      public boolean isTerrainPopulated
      Boolean value indicating if the terrain is populated.
    • isModified

      public boolean isModified
      Set to true if the chunk has been modified and needs to be updated internally.
    • hasEntities

      public boolean hasEntities
      Whether this Chunk has any Entities and thus requires saving on every tick
    • lastSaveTime

      public long lastSaveTime
      The time according to World.worldTime when this chunk was last saved
    • sendUpdates

      public boolean sendUpdates
      Updates 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 heightMapMinimum
      Lowest value in the heightmap.
    • inhabitedTime

      public long inhabitedTime
      the cumulative number of ticks players have been in this chunk
  • Constructor Details

    • Chunk

      public Chunk(World par1World, int par2, int par3)
    • Chunk

      public Chunk(World par1World, short[] blockIDs, byte[] metadata, int par3, int par4)
  • 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

      public ExtendedBlockStorage[] 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

      public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4)
      Gets the amount of light saved in this block (doesn't adjust for daylight)
    • setLightValue

      public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5)
      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

      public void addEntity(Entity par1Entity)
      Adds an entity to the chunk. Args: entity
    • removeEntity

      public void removeEntity(Entity par1Entity)
      removes entity using its y chunk coordinate as its index
    • removeEntityAtIndex

      public void removeEntityAtIndex(Entity par1Entity, int par2)
      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

      public TileEntity getChunkBlockTileEntity(int par1, int par2, int par3)
      Gets the TileEntity for a given block in this chunk
    • addTileEntity

      public void addTileEntity(TileEntity par1TileEntity)
      Adds a TileEntity to a chunk
    • setChunkBlockTileEntity

      public void setChunkBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity)
      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

      public Random getRandomWithSeed(long par1)
    • 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

      public ChunkCoordIntPair 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

      public void setStorageArrays(ExtendedBlockStorage[] par1ArrayOfExtendedBlockStorage)
    • 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

      public void getClosestEntityMatchingCriteriaWithinRangeSq(ClosestEntityInfo closestEntityInfo)
    • 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