Home Migration Guide Getting Started With Scripts Commands Examples
BracketHandlers

MCBlockDisplayReader

One of MCWorld’s supertype, used for display calculation.

Importing the class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

script.zs
import crafttweaker.api.world.MCBlockDisplayReader;

Methods

Gets if can see sky at a given position

Returns: The block state at the position.
Return Type: boolean

script.zs
// MCBlockDisplayReader.canSeeSky(pos as BlockPos) as boolean
myMCBlockDisplayReader.canSeeSky(new BlockPos(0, 1, 2));
ParameterTypeDescription
Parameter
pos
Type
BlockPos
Description
The position to look up.

Gets the block state at a given position.

Returns: The block state at the position.
Return Type: MCBlockState

script.zs
// MCBlockDisplayReader.getBlockState(pos as BlockPos) as MCBlockState
myMCBlockDisplayReader.getBlockState(new BlockPos(0, 1, 2));
ParameterTypeDescription
Parameter
pos
Type
BlockPos
Description
The position to look up.

Gets the light level at a given position

Returns: The light level at the position
Return Type: int

script.zs
// MCBlockDisplayReader.getLightValue(pos as BlockPos) as int
myMCBlockDisplayReader.getLightValue(new BlockPos(0, 1, 2));
ParameterTypeDescription
Parameter
pos
Type
BlockPos
Description
The position to look up.

Gets the tile entity at a given position.

Returns: The tile entity.
Return Type: MCTileEntity?

script.zs
// MCBlockDisplayReader.getTileEntity(pos as BlockPos) as MCTileEntity?
myMCBlockDisplayReader.getTileEntity(new BlockPos(0, 1, 2));
ParameterTypeDescription
Parameter
pos
Type
BlockPos
Description
The position of the tile entity.