@ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class Cube extends java.lang.Object implements ICube
ICube.SIZE, aligned to multiples of that length and stored within columns.| Modifier and Type | Class and Description |
|---|---|
static interface |
Cube.ICubeLightTrackingInfo |
ICube.ForcedLoadReason| Modifier and Type | Field and Description |
|---|---|
protected static net.minecraft.world.chunk.storage.ExtendedBlockStorage |
NULL_STORAGE |
protected int |
updateLCG
Contains the current Linear Congruential Generator seed for block updates.
|
| Modifier | Constructor and Description |
|---|---|
|
Cube(net.minecraft.world.chunk.Chunk column,
int cubeY)
Create a new cube in the specified column at the specified location.
|
|
Cube(net.minecraft.world.chunk.Chunk column,
int cubeY,
CubePrimer primer)
Create a new cube at the specified location by copying blocks from a cube primer.
|
protected |
Cube(TicketList tickets,
net.minecraft.world.World world,
net.minecraft.world.chunk.Chunk column,
CubePos coords,
net.minecraft.world.chunk.storage.ExtendedBlockStorage storage,
EntityContainer entities,
java.util.Map<net.minecraft.util.math.BlockPos,net.minecraft.tileentity.TileEntity> tileEntityMap,
java.util.concurrent.ConcurrentLinkedQueue<net.minecraft.util.math.BlockPos> tileEntityPosQueue,
Cube.ICubeLightTrackingInfo cubeLightData)
Constructor to be used from subclasses to provide all field values
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEntity(net.minecraft.entity.Entity entity) |
void |
addTileEntity(net.minecraft.tileentity.TileEntity tileEntityIn)
Add a tile entity to this cube
|
boolean |
checkAndUpdateTick(long totalTime)
Returns true if the cube still needs to be ticked this tick.
|
boolean |
containsBlockPos(net.minecraft.util.math.BlockPos blockPos)
Check whether a given global block position is contained in this cube
|
net.minecraft.world.biome.Biome |
getBiome(net.minecraft.util.math.BlockPos pos) |
byte[] |
getBiomeArray() |
net.minecraft.block.state.IBlockState |
getBlockState(net.minecraft.util.math.BlockPos pos)
Retrieve the block state at the specified location
|
net.minecraft.block.state.IBlockState |
getBlockState(int blockX,
int localOrBlockY,
int blockZ)
Retrieve the block state at the specified location
|
int |
getCachedLightFor(net.minecraft.world.EnumSkyBlock type,
net.minecraft.util.math.BlockPos pos) |
net.minecraftforge.common.capabilities.CapabilityDispatcher |
getCapabilities() |
<T> T |
getCapability(net.minecraftforge.common.capabilities.Capability<T> capability,
net.minecraft.util.EnumFacing facing) |
<T extends net.minecraft.world.chunk.Chunk & IColumn> |
getColumn() |
CubePos |
getCoords() |
Cube.ICubeLightTrackingInfo |
getCubeLightData() |
EntityContainer |
getEntityContainer() |
net.minecraft.util.ClassInheritanceMultiMap<net.minecraft.entity.Entity> |
getEntitySet()
Returns the internal entity container.
|
java.util.EnumSet<ICube.ForcedLoadReason> |
getForceLoadStatus()
Returns a set of reasons this cube is forced to remain loaded if it's forced to remain loaded,
or empty enum set if it can be unloaded.
|
int |
getLightFor(net.minecraft.world.EnumSkyBlock type,
net.minecraft.util.math.BlockPos pos)
Retrieve the raw light level at the specified location
|
net.minecraft.world.chunk.storage.ExtendedBlockStorage |
getStorage() |
TicketList |
getTickets()
Retrieve a list of tickets currently holding this cube loaded
|
net.minecraft.tileentity.TileEntity |
getTileEntity(net.minecraft.util.math.BlockPos pos,
net.minecraft.world.chunk.Chunk.EnumCreateEntityType createType)
Retrieve the tile entity at the specified location
|
java.util.Map<net.minecraft.util.math.BlockPos,net.minecraft.tileentity.TileEntity> |
getTileEntityMap()
Retrieve a map of positions to their respective tile entities
|
<T extends net.minecraft.world.World & ICubicWorld> |
getWorld() |
int |
getX()
Retrieve this cube's x coordinate in cube space
|
int |
getY()
Retrieve this cube's y coordinate in cube space
|
int |
getZ()
Retrieve this cube's z coordinate in cube space
|
boolean |
hasBeenTicked() |
boolean |
hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability,
net.minecraft.util.EnumFacing facing) |
boolean |
hasLightUpdates() |
boolean |
isCubeLoaded() |
boolean |
isEmpty()
Check if there are any non-air blocks in this cube
|
boolean |
isFullyPopulated()
Check whether this cube was fully populated, i.e.
|
boolean |
isInitialLightingDone()
Check whether this cube's initial diffuse skylight has been calculated
|
boolean |
isPopulated()
Check whether this cube was populated, i.e.
|
boolean |
isSurfaceTracked()
Gets internal isSurfaceTracked value.
|
net.minecraft.util.math.BlockPos |
localAddressToBlockPos(int localAddress)
Convert an integer-encoded address to a local block to a global block position
|
void |
markDirty()
Mark this cube as one, who need to be saved to disk
|
void |
markForRenderUpdate() |
void |
markSaved()
Mark this cube as saved to disk
|
boolean |
needsSaving()
Check if any modifications happened to this cube since it was loaded from disk
|
void |
onLoad()
Finish the cube loading process
|
void |
onUnload()
Mark this cube as no longer part of this world
|
boolean |
removeEntity(net.minecraft.entity.Entity entity) |
void |
setBiome(int localBiomeX,
int localBiomeY,
int localBiomeZ,
net.minecraft.world.biome.Biome biome)
Set biome at a cube-local 4x4x4 block segment.
|
void |
setBiomeArray(byte[] biomeArray) |
net.minecraft.block.state.IBlockState |
setBlockState(net.minecraft.util.math.BlockPos pos,
net.minecraft.block.state.IBlockState newstate)
Set the block state at the specified location
|
void |
setClientCube()
Mark this cube as a client side cube.
|
void |
setCubeLoaded() |
void |
setFullyPopulated(boolean populated)
Mark this cube as fully populated.
|
void |
setInitialLightingDone(boolean initialLightingDone)
Notify this cube that it's initial diffuse skylight has been calculated
|
void |
setLightFor(net.minecraft.world.EnumSkyBlock lightType,
net.minecraft.util.math.BlockPos pos,
int light)
Set the raw light level at the specified location
|
void |
setPopulated(boolean populated)
Mark this cube as populated.
|
net.minecraft.world.chunk.storage.ExtendedBlockStorage |
setStorage(net.minecraft.world.chunk.storage.ExtendedBlockStorage ebs) |
void |
setStorageFromSave(net.minecraft.world.chunk.storage.ExtendedBlockStorage ebs) |
void |
setSurfaceTracked(boolean value)
Sets internal isSurfaceTracked value.
|
void |
tickCubeCommon(java.util.function.BooleanSupplier tryToTickFaster)
Update light and tile entities of cube
|
void |
tickCubeServer(java.util.function.BooleanSupplier tryToTickFaster,
java.util.Random rand)
Tick this cube on server side.
|
void |
trackSurface() |
@Nullable protected static final net.minecraft.world.chunk.storage.ExtendedBlockStorage NULL_STORAGE
protected int updateLCG
public Cube(net.minecraft.world.chunk.Chunk column,
int cubeY)
column - column of this cubecubeY - cube y positionpublic Cube(net.minecraft.world.chunk.Chunk column,
int cubeY,
CubePrimer primer)
column - column of this cubecubeY - cube y positionprimer - primer containing the blocks for this cubeprotected Cube(TicketList tickets, net.minecraft.world.World world, net.minecraft.world.chunk.Chunk column, CubePos coords, net.minecraft.world.chunk.storage.ExtendedBlockStorage storage, EntityContainer entities, java.util.Map<net.minecraft.util.math.BlockPos,net.minecraft.tileentity.TileEntity> tileEntityMap, java.util.concurrent.ConcurrentLinkedQueue<net.minecraft.util.math.BlockPos> tileEntityPosQueue, Cube.ICubeLightTrackingInfo cubeLightData)
tickets - cube ticket listworld - the world instancecolumn - the column this cube belongs tocoords - position of this cubestorage - block storageentities - entity containertileEntityMap - tile entity storagetileEntityPosQueue - queue for updating tile entitiescubeLightData - cube light tracking datapublic net.minecraft.block.state.IBlockState getBlockState(net.minecraft.util.math.BlockPos pos)
ICubegetBlockState in interface ICubepos - target locationICube.getBlockState(int, int, int)@Nullable
public net.minecraft.block.state.IBlockState setBlockState(net.minecraft.util.math.BlockPos pos,
net.minecraft.block.state.IBlockState newstate)
ICubesetBlockState in interface ICubepos - target locationnewstate - target state of the block at that positionChunk.setBlockState(BlockPos, IBlockState)public net.minecraft.block.state.IBlockState getBlockState(int blockX,
int localOrBlockY,
int blockZ)
ICubegetBlockState in interface ICubeblockX - block x positionlocalOrBlockY - block or local y positionblockZ - block z positionICube.getBlockState(BlockPos)public int getLightFor(net.minecraft.world.EnumSkyBlock type,
net.minecraft.util.math.BlockPos pos)
ICubegetLightFor in interface ICubetype - The type of light (sky or block light)pos - The position at which light should be checkedpublic int getCachedLightFor(net.minecraft.world.EnumSkyBlock type,
net.minecraft.util.math.BlockPos pos)
public void setLightFor(net.minecraft.world.EnumSkyBlock lightType,
net.minecraft.util.math.BlockPos pos,
int light)
ICubesetLightFor in interface ICubelightType - The type of light (sky or block light)pos - The position at which light should be updatedlight - the light level@Nullable
public net.minecraft.tileentity.TileEntity getTileEntity(net.minecraft.util.math.BlockPos pos,
net.minecraft.world.chunk.Chunk.EnumCreateEntityType createType)
ICubegetTileEntity in interface ICubepos - target locationcreateType - how fast the tile entity is needednull if there is no entity and
createType was not Chunk.EnumCreateEntityType#IMMEDIATEpublic void addTileEntity(net.minecraft.tileentity.TileEntity tileEntityIn)
ICubeaddTileEntity in interface ICubetileEntityIn - The tile entity to addpublic void tickCubeCommon(java.util.function.BooleanSupplier tryToTickFaster)
tryToTickFaster - Whether costly calculations should be skipped in order to catch up with tickspublic void tickCubeServer(java.util.function.BooleanSupplier tryToTickFaster,
java.util.Random rand)
tryToTickFaster - - returns true when running out of reserved tick timerand - - World specific Randompublic net.minecraft.world.biome.Biome getBiome(net.minecraft.util.math.BlockPos pos)
getBiome in interface ICubeblockBiomeArray is not generated by
cube generatorpublic void setBiome(int localBiomeX,
int localBiomeY,
int localBiomeZ,
net.minecraft.world.biome.Biome biome)
ICube@Nullable public byte[] getBiomeArray()
public void setBiomeArray(byte[] biomeArray)
public boolean isEmpty()
ICubepublic net.minecraft.util.math.BlockPos localAddressToBlockPos(int localAddress)
ICubelocalAddressToBlockPos in interface ICubelocalAddress - the address of the blockpublic <T extends net.minecraft.world.World & ICubicWorld> T getWorld()
getWorld in interface ICubeT - dummy generic parameter to return a type that is both World and ICubicWorldpublic <T extends net.minecraft.world.chunk.Chunk & IColumn> T getColumn()
public int getX()
ICubegetX in interface XYZAddressablegetX in interface ICubepublic int getY()
ICubegetY in interface XYZAddressablegetY in interface ICubepublic int getZ()
ICubegetZ in interface XYZAddressablegetZ in interface ICubepublic CubePos getCoords()
public boolean containsBlockPos(net.minecraft.util.math.BlockPos blockPos)
ICubecontainsBlockPos in interface ICubeblockPos - the position of the blocktrue if the position is within this cube, false otherwise@Nullable public net.minecraft.world.chunk.storage.ExtendedBlockStorage getStorage()
getStorage in interface ICube@Nullable
public net.minecraft.world.chunk.storage.ExtendedBlockStorage setStorage(@Nullable
net.minecraft.world.chunk.storage.ExtendedBlockStorage ebs)
public void setStorageFromSave(@Nullable
net.minecraft.world.chunk.storage.ExtendedBlockStorage ebs)
public java.util.Map<net.minecraft.util.math.BlockPos,net.minecraft.tileentity.TileEntity> getTileEntityMap()
ICubegetTileEntityMap in interface ICubepublic net.minecraft.util.ClassInheritanceMultiMap<net.minecraft.entity.Entity> getEntitySet()
ICubegetEntitySet in interface ICubepublic void addEntity(net.minecraft.entity.Entity entity)
public boolean removeEntity(net.minecraft.entity.Entity entity)
removeEntity in interface ICubepublic EntityContainer getEntityContainer()
public boolean checkAndUpdateTick(long totalTime)
totalTime - world timepublic void onLoad()
public void trackSurface()
public void onUnload()
public boolean needsSaving()
ICubeneedsSaving in interface ICubetrue if this cube should be written back to diskpublic void markSaved()
public void markDirty()
public TicketList getTickets()
public void markForRenderUpdate()
public Cube.ICubeLightTrackingInfo getCubeLightData()
public void setClientCube()
public boolean isPopulated()
ICubeICubeGenerator.populate(ICube). Check there for more information regarding
population.isPopulated in interface ICubetrue if this cube has been populated, false otherwisepublic void setPopulated(boolean populated)
ICubeGenerator.populate(ICube). Check there for more information regarding
population.populated - whether this cube was populatedpublic boolean isFullyPopulated()
ICubeICubeGenerator.populate(ICube). Check there for more
information regarding populationisFullyPopulated in interface ICubetrue if this cube has been populated, false otherwisepublic void setFullyPopulated(boolean populated)
ICubeGenerator.populate(ICube). Check there for more
information regarding populationpopulated - whether this cube was fully populatedpublic void setSurfaceTracked(boolean value)
value - true if surface is already trackedpublic boolean isSurfaceTracked()
ICubeisSurfaceTracked in interface ICubepublic boolean isInitialLightingDone()
ICubeisInitialLightingDone in interface ICubetrue if it has been calculated, false otherwisepublic void setInitialLightingDone(boolean initialLightingDone)
initialLightingDone - true if initial lighting is donepublic void setCubeLoaded()
public boolean isCubeLoaded()
isCubeLoaded in interface ICubepublic boolean hasLightUpdates()
hasLightUpdates in interface ICubepublic boolean hasBeenTicked()
@Nullable public net.minecraftforge.common.capabilities.CapabilityDispatcher getCapabilities()
getCapabilities in interface ICubepublic java.util.EnumSet<ICube.ForcedLoadReason> getForceLoadStatus()
ICubegetForceLoadStatus in interface ICubepublic boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability,
@Nullable
net.minecraft.util.EnumFacing facing)
hasCapability in interface net.minecraftforge.common.capabilities.ICapabilityProvider@Nullable
public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability,
@Nullable
net.minecraft.util.EnumFacing facing)
getCapability in interface net.minecraftforge.common.capabilities.ICapabilityProvider