CommonLevelAccessor

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

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

Implements

CommonLevelAccessor implements the following interfaces:

LevelReader,LevelSimulatedRW,BlockAndTintGetter,BlockGetter,LevelWriter

Undocumented Interfaces

EntityGetter,CollisionGetter,SignalGetter,NoiseBiomeSource,IBlockAndTintGetterExtension,LevelHeightAccessor,IBlockGetterExtension,LevelSimulatedReader

Members

addFreshEntity(entity as Entity) as bool
add an entity to the world, return if the entity is added successfully.
script.zs
// CommonLevelAccessor.addFreshEntity(entity as Entity) as bool;
myCommonLevelAccessor.addFreshEntity(myEntity);

Parameters:

entity Type: Entity

Return Type: bool

canSeeSkyFromBelowWater(pos as BlockPos) as bool
script.zs
// CommonLevelAccessor.canSeeSkyFromBelowWater(pos as BlockPos) as bool;
myCommonLevelAccessor.canSeeSkyFromBelowWater(myBlockPos);

Parameters:

pos Type: BlockPos

Return Type: bool

destroyBlock(pos as BlockPos, doDrops as bool) as bool
Destroys a block within the world.

Returns: Whether the block was changed.

script.zs
// CommonLevelAccessor.destroyBlock(pos as BlockPos, doDrops as bool) as bool;
myCommonLevelAccessor.destroyBlock(new BlockPos(0, 1, 2), true);

Parameters:

pos Type: BlockPos - The position of the block.
doDrops Type: bool - Whether the block drops itself and it's loot.

Return Type: bool

destroyBlock(pos as BlockPos, doDrops as bool, breaker as Entity) as bool
Destroys a block within the world.

Returns: Whether the block was changed.

script.zs
// CommonLevelAccessor.destroyBlock(pos as BlockPos, doDrops as bool, breaker as Entity) as bool;
myCommonLevelAccessor.destroyBlock(new BlockPos(0, 1, 2), true, player);

Parameters:

pos Type: BlockPos - The position of the block.
doDrops Type: bool - Whether the block drops itself and it's loot.
breaker Type: Entity - The entity to break the block.

Return Type: bool

getBiome(pos as BlockPos) as Biome
Gets the biome at a given position.

Returns: The biome at the given position.

script.zs
// CommonLevelAccessor.getBiome(pos as BlockPos) as Biome;
myCommonLevelAccessor.getBiome(new BlockPos(0, 1, 2));

Parameters:

pos Type: BlockPos - The position to look up.

Return Type: Biome

getBlockEntityData(pos as BlockPos) as IData
Gets the tile entity data for a tile entity at a given position.

Returns: The data of the tile entity.

script.zs
// CommonLevelAccessor.getBlockEntityData(pos as BlockPos) as IData;
myCommonLevelAccessor.getBlockEntityData(new BlockPos(0, 1, 2));

Parameters:

pos Type: BlockPos - The position of the tile entity.

Return Type: IData

getBlockFloorHeight(pos as BlockPos) as double
script.zs
// CommonLevelAccessor.getBlockFloorHeight(pos as BlockPos) as double;
myCommonLevelAccessor.getBlockFloorHeight(myBlockPos);

Parameters:

pos Type: BlockPos

Return Type: double

getBlockState(pos as BlockPos) as BlockState
Gets the block state at a given position.

Returns: The block state at the position.

script.zs
// CommonLevelAccessor.getBlockState(pos as BlockPos) as BlockState;
myCommonLevelAccessor.getBlockState(new BlockPos(0, 1, 2));

Parameters:

pos Type: BlockPos - The position to look up.

Return Type: BlockState

getLightEmission(pos as BlockPos) as int
script.zs
// CommonLevelAccessor.getLightEmission(pos as BlockPos) as int;
myCommonLevelAccessor.getLightEmission(myBlockPos);

Parameters:

pos Type: BlockPos

Return Type: int

hasChunk(x as int, z as int) as bool
script.zs
// CommonLevelAccessor.hasChunk(x as int, z as int) as bool;
myCommonLevelAccessor.hasChunk(myInt, myInt);

Parameters:

x Type: int
z Type: int

Return Type: bool

Getter
script.zs
// CommonLevelAccessor.isClientSide as bool
myCommonLevelAccessor.isClientSide

Return Type: bool

isEmptyBlock(pos as BlockPos) as bool
Checks if the block at a given position is empty.

Returns: Whether the block is empty.

script.zs
// CommonLevelAccessor.isEmptyBlock(pos as BlockPos) as bool;
myCommonLevelAccessor.isEmptyBlock(new BlockPos(0, 1, 2));

Parameters:

pos Type: BlockPos - The position to look up.

Return Type: bool

isWaterAt(pos as BlockPos) as bool
script.zs
// CommonLevelAccessor.isWaterAt(pos as BlockPos) as bool;
myCommonLevelAccessor.isWaterAt(myBlockPos);

Parameters:

pos Type: BlockPos

Return Type: bool

Getter
script.zs
// CommonLevelAccessor.maxLightLevel as int
myCommonLevelAccessor.maxLightLevel

Return Type: int

Getter
Gets the height of the sea level.
script.zs
// CommonLevelAccessor.seaLevel as int
myCommonLevelAccessor.seaLevel

Return Type: int

Getter
script.zs
// CommonLevelAccessor.skyDarken as int
myCommonLevelAccessor.skyDarken

Return Type: int