public class Chunk extends java.lang.Object implements ICapabilityProvider
Modifier and Type | Class and Description |
---|---|
static class |
Chunk.EnumCreateEntityType |
Modifier and Type | Field and Description |
---|---|
private byte[] |
blockBiomeArray |
private CapabilityDispatcher |
capabilities |
private boolean |
dirty |
private ClassInheritanceMultiMap<Entity>[] |
entityLists |
private boolean |
hasEntities |
private int[] |
heightMap |
private int |
heightMapMinimum |
private long |
inhabitedTime |
private boolean |
isGapLightingUpdated |
private boolean |
isLightPopulated |
private boolean |
isTerrainPopulated |
private long |
lastSaveTime |
private boolean |
loaded |
private static org.apache.logging.log4j.Logger |
LOGGER |
static ExtendedBlockStorage |
NULL_BLOCK_STORAGE |
private static ChunkPos |
populating |
private int[] |
precipitationHeightMap |
private int |
queuedLightChecks |
private ExtendedBlockStorage[] |
storageArrays |
private boolean |
ticked |
private java.util.Map<BlockPos,TileEntity> |
tileEntities |
private java.util.concurrent.ConcurrentLinkedQueue<BlockPos> |
tileEntityPosQueue |
boolean |
unloadQueued |
private boolean[] |
updateSkylightColumns |
private World |
world |
int |
x |
int |
z |
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) |
void |
addTileEntity(BlockPos pos,
TileEntity tileEntityIn) |
void |
addTileEntity(TileEntity tileEntityIn) |
boolean |
canSeeSky(BlockPos pos) |
void |
checkLight() |
private boolean |
checkLight(int x,
int z) |
private void |
checkLightSide(EnumFacing facing) |
private void |
checkSkylightNeighborHeight(int x,
int z,
int maxValue) |
private TileEntity |
createNewTileEntity(BlockPos pos) |
void |
enqueueRelightChecks() |
protected void |
generateHeightMap() |
void |
generateSkylightMap() |
Biome |
getBiome(BlockPos pos,
BiomeProvider provider) |
byte[] |
getBiomeArray() |
int |
getBlockLightOpacity(BlockPos pos) |
private int |
getBlockLightOpacity(int x,
int y,
int z) |
IBlockState |
getBlockState(BlockPos pos) |
IBlockState |
getBlockState(int x,
int y,
int z) |
ExtendedBlockStorage[] |
getBlockStorageArray() |
CapabilityDispatcher |
getCapabilities() |
<T> T |
getCapability(Capability<T> capability,
EnumFacing facing)
Retrieves the handler for the capability requested on the specific side.
|
<T extends Entity> |
getEntitiesOfTypeWithinAABB(java.lang.Class<? extends T> entityClass,
AxisAlignedBB aabb,
java.util.List<T> listToFill,
com.google.common.base.Predicate<? super T> filter) |
void |
getEntitiesWithinAABBForEntity(Entity entityIn,
AxisAlignedBB aabb,
java.util.List<Entity> listToFill,
com.google.common.base.Predicate<? super Entity> filter) |
ClassInheritanceMultiMap<Entity>[] |
getEntityLists() |
int |
getHeight(BlockPos pos) |
int[] |
getHeightMap() |
int |
getHeightValue(int x,
int z) |
long |
getInhabitedTime() |
private ExtendedBlockStorage |
getLastExtendedBlockStorage() |
int |
getLightFor(EnumSkyBlock type,
BlockPos pos) |
int |
getLightSubtracted(BlockPos pos,
int amount) |
int |
getLowestHeight() |
ChunkPos |
getPos() |
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() |
World |
getWorld() |
boolean |
hasCapability(Capability<?> capability,
EnumFacing facing)
Determines if this object has support for the capability in question on the specific side.
|
boolean |
isAtLocation(int x,
int z) |
boolean |
isEmpty() |
boolean |
isEmptyBetween(int startY,
int endY) |
boolean |
isLightPopulated() |
boolean |
isLoaded() |
boolean |
isPopulated() |
boolean |
isTerrainPopulated() |
private void |
logCascadingWorldGeneration() |
void |
markDirty() |
void |
markLoaded(boolean loaded) |
boolean |
needsSaving(boolean p_76601_1_) |
void |
onLoad() |
void |
onTick(boolean skipRecheckGaps) |
void |
onUnload() |
protected void |
populate(IChunkGenerator generator) |
void |
populate(IChunkProvider chunkProvider,
IChunkGenerator chunkGenrator) |
private void |
propagateSkylightOcclusion(int x,
int z) |
void |
read(PacketBuffer buf,
int availableSections,
boolean groundUpContinuous) |
private void |
recheckGaps(boolean onlyOne) |
private void |
relightBlock(int x,
int y,
int z) |
void |
removeEntity(Entity entityIn) |
void |
removeEntityAtIndex(Entity entityIn,
int index) |
void |
removeInvalidTileEntity(BlockPos pos)
Removes the tile entity at the specified position, only if it's
marked as invalid.
|
void |
removeTileEntity(BlockPos pos) |
void |
resetRelightChecks() |
void |
setBiomeArray(byte[] biomeArray) |
IBlockState |
setBlockState(BlockPos pos,
IBlockState state) |
void |
setHasEntities(boolean hasEntitiesIn) |
void |
setHeightMap(int[] newHeightMap) |
void |
setInhabitedTime(long newInhabitedTime) |
void |
setLastSaveTime(long saveTime) |
void |
setLightFor(EnumSkyBlock type,
BlockPos pos,
int value) |
void |
setLightPopulated(boolean lightPopulated) |
void |
setModified(boolean modified) |
private void |
setSkylightUpdated() |
void |
setStorageArrays(ExtendedBlockStorage[] newStorageArrays) |
void |
setTerrainPopulated(boolean terrainPopulated) |
private void |
updateSkylightNeighborHeight(int x,
int z,
int startY,
int endY) |
boolean |
wasTicked() |
private static final org.apache.logging.log4j.Logger LOGGER
public static final ExtendedBlockStorage NULL_BLOCK_STORAGE
private final ExtendedBlockStorage[] storageArrays
private final byte[] blockBiomeArray
private final int[] precipitationHeightMap
private final boolean[] updateSkylightColumns
private boolean loaded
private final World world
private final int[] heightMap
public final int x
public final int z
private boolean isGapLightingUpdated
private final java.util.Map<BlockPos,TileEntity> tileEntities
private final ClassInheritanceMultiMap<Entity>[] entityLists
private boolean isTerrainPopulated
private boolean isLightPopulated
private boolean ticked
private boolean dirty
private boolean hasEntities
private long lastSaveTime
private int heightMapMinimum
private long inhabitedTime
private int queuedLightChecks
private final java.util.concurrent.ConcurrentLinkedQueue<BlockPos> tileEntityPosQueue
public boolean unloadQueued
private static ChunkPos populating
private final CapabilityDispatcher capabilities
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)
@Nullable private ExtendedBlockStorage getLastExtendedBlockStorage()
public int getTopFilledSegment()
public ExtendedBlockStorage[] getBlockStorageArray()
protected void generateHeightMap()
public void generateSkylightMap()
private void propagateSkylightOcclusion(int x, int z)
private void recheckGaps(boolean onlyOne)
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)
public IBlockState getBlockState(BlockPos pos)
public IBlockState getBlockState(int x, int y, int z)
@Nullable public IBlockState setBlockState(BlockPos pos, IBlockState state)
public int getLightFor(EnumSkyBlock type, BlockPos pos)
public void setLightFor(EnumSkyBlock type, 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 index)
public boolean canSeeSky(BlockPos pos)
@Nullable private TileEntity createNewTileEntity(BlockPos pos)
@Nullable 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 onLoad()
public void onUnload()
public void markDirty()
public void getEntitiesWithinAABBForEntity(@Nullable Entity entityIn, AxisAlignedBB aabb, java.util.List<Entity> listToFill, com.google.common.base.Predicate<? super Entity> filter)
public <T extends Entity> void getEntitiesOfTypeWithinAABB(java.lang.Class<? extends T> entityClass, AxisAlignedBB aabb, java.util.List<T> listToFill, com.google.common.base.Predicate<? super T> filter)
public boolean needsSaving(boolean p_76601_1_)
public java.util.Random getRandomWithSeed(long seed)
public boolean isEmpty()
public void populate(IChunkProvider chunkProvider, IChunkGenerator chunkGenrator)
protected void populate(IChunkGenerator generator)
public void onTick(boolean skipRecheckGaps)
public boolean isPopulated()
public boolean wasTicked()
public ChunkPos getPos()
public boolean isEmptyBetween(int startY, int endY)
public void setStorageArrays(ExtendedBlockStorage[] newStorageArrays)
public void read(PacketBuffer buf, int availableSections, boolean groundUpContinuous)
public Biome getBiome(BlockPos pos, BiomeProvider provider)
public byte[] getBiomeArray()
public void setBiomeArray(byte[] biomeArray)
public void resetRelightChecks()
public void enqueueRelightChecks()
public void checkLight()
private void setSkylightUpdated()
private void checkLightSide(EnumFacing facing)
private boolean checkLight(int x, int z)
public boolean isLoaded()
public void markLoaded(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)
public void removeInvalidTileEntity(BlockPos pos)
private void logCascadingWorldGeneration()
@Nullable public CapabilityDispatcher getCapabilities()
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing)
ICapabilityProvider
ICapabilityProvider.getCapability(Capability, EnumFacing)
.
Basically, this method functions analogously to Map.containsKey(Object)
.
Example: A Pipe getting a cover placed on one side causing it lose the Inventory attachment function for that side.
This is a light weight version of getCapability, intended for metadata uses.
hasCapability
in interface ICapabilityProvider
capability
- The capability to checkfacing
- The Side to check from:
CAN BE NULL. Null is defined to represent 'internal' or 'self'ICapabilityProvider.getCapability(Capability, EnumFacing)
must not return null.@Nullable public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
ICapabilityProvider
Basically, this method functions analogously to Map.get(Object)
.
getCapability
in interface ICapabilityProvider
capability
- The capability to checkfacing
- The Side to check from,
CAN BE NULL. Null is defined to represent 'internal' or 'self'ICapabilityProvider.hasCapability(Capability, EnumFacing)
would return true.