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.
import crafttweaker . api.world . LevelAccessor;
LevelAccessor
implements the following interfaces:
CommonLevelAccessor
,LevelReader
,LevelSimulatedRW
,BlockAndTintGetter
,BlockGetter
,LevelWriter
Undocumented Interfaces LevelTimeAccess
, EntityGetter
, CollisionGetter
, SignalGetter
, NoiseBiomeSource
, IBlockAndTintGetterExtension
, LevelHeightAccessor
, IBlockGetterExtension
, LevelSimulatedReader
add an entity to the world, return if the entity is added successfully. // LevelAccessor.addFreshEntity(entity as Entity) as bool;
myLevelAccessor . addFreshEntity(myEntity);
Return Type:
bool
// LevelAccessor.canSeeSkyFromBelowWater(pos as BlockPos) as bool;
myLevelAccessor . canSeeSkyFromBelowWater(myBlockPos);
Return Type:
bool
Destroys a block within the world. Returns : Whether the block was changed.
// LevelAccessor.destroyBlock(pos as BlockPos, doDrops as bool) as bool;
myLevelAccessor . destroyBlock( new BlockPos( 0 , 1 , 2 ), true );
Parameters:
doDrops: bool
Type: bool
- Whether the block drops itself and it's loot.
Return Type:
bool
Destroys a block within the world. Returns : Whether the block was changed.
// LevelAccessor.destroyBlock(pos as BlockPos, doDrops as bool, breaker as Entity) as bool;
myLevelAccessor . destroyBlock( new BlockPos( 0 , 1 , 2 ), true , player);
Parameters:
doDrops: bool
Type: bool
- Whether the block drops itself and it's loot.
breaker: Entity
Type: Entity
- The entity to break the block.
Return Type:
bool
Gets the difficulty setting for the world. // LevelAccessor.difficulty as Difficulty
myLevelAccessor . difficulty
Return Type:
Difficulty
Gets the biome at a given position. Returns : The biome at the given position.
// LevelAccessor.getBiome(pos as BlockPos) as Biome;
myLevelAccessor . getBiome( new BlockPos( 0 , 1 , 2 ));
Return Type:
Biome
Gets the tile entity data for a tile entity at a given position. Returns : The data of the tile entity.
// LevelAccessor.getBlockEntityData(pos as BlockPos) as IData;
myLevelAccessor . getBlockEntityData( new BlockPos( 0 , 1 , 2 ));
Return Type:
IData
// LevelAccessor.getBlockFloorHeight(pos as BlockPos) as double;
myLevelAccessor . getBlockFloorHeight(myBlockPos);
Return Type:
double
Gets the block state at a given position. Returns : The block state at the position.
// LevelAccessor.getBlockState(pos as BlockPos) as BlockState;
myLevelAccessor . getBlockState( new BlockPos( 0 , 1 , 2 ));
Return Type:
BlockState
// LevelAccessor.getCurrentDifficultyAt(position as BlockPos) as DifficultyInstance;
myLevelAccessor . getCurrentDifficultyAt(myBlockPos);
Return Type:
DifficultyInstance
// LevelAccessor.getLightEmission(pos as BlockPos) as int;
myLevelAccessor . getLightEmission(myBlockPos);
Return Type:
int
// LevelAccessor.hasChunk(x as int, z as int) as bool;
myLevelAccessor . hasChunk(myInt, myInt);
Parameters:
x: int
Type: int
z: int
Type: int
Return Type:
bool
// LevelAccessor.isClientSide as bool
myLevelAccessor . isClientSide
Return Type:
bool
Checks if the block at a given position is empty. Returns : Whether the block is empty.
// LevelAccessor.isEmptyBlock(pos as BlockPos) as bool;
myLevelAccessor . isEmptyBlock( new BlockPos( 0 , 1 , 2 ));
Return Type:
bool
// LevelAccessor.isWaterAt(pos as BlockPos) as bool;
myLevelAccessor . isWaterAt(myBlockPos);
Return Type:
bool
Gets the data for this level, holds information such as if it is raining, thundering, difficulty, etc // LevelAccessor.levelData as LevelData
myLevelAccessor . levelData
Return Type:
LevelData
Triggers a predetermined event on the client. Using this on a server or integrated server will send the event to all nearby players. // LevelAccessor.levelEvent(excluded as Player, event as int, position as BlockPos, extra as int);
myLevelAccessor . levelEvent(player, myInt, myBlockPos, myInt);
Parameters:
excluded: Player
Type: Player
- An excluded player who will not receive the event. event: int
Type: int
- The ID of the event to play.
extra: int
Type: int
- Four bytes of additional data encoded as an integer. This is generally unused.
Triggers a predetermined event on the client. Using this on a server or integrated server will send the event to all nearby players. // LevelAccessor.levelEvent(event as int, position as BlockPos, extra as int);
myLevelAccessor . levelEvent(myInt, myBlockPos, myInt);
Parameters:
event: int
Type: int
- The ID of the event to play.
extra: int
Type: int
- Four bytes of additional data encoded as an integer. This is generally unused.
// LevelAccessor.maxLightLevel as int
myLevelAccessor . maxLightLevel
Return Type:
int
// LevelAccessor.playSound(player as Player, position as BlockPos, event as SoundEvent, source as SoundSource);
myLevelAccessor . playSound(myPlayer, myBlockPos, mySoundEvent, mySoundSource);
// LevelAccessor.playSound(player as Player, position as BlockPos, event as SoundEvent, source as SoundSource, volume as float, pitch as float);
myLevelAccessor . playSound(myPlayer, myBlockPos, mySoundEvent, mySoundSource, myFloat, myFloat);
Parameters:
volume: float
Type: float
pitch: float
Type: float
// LevelAccessor.random as RandomSource
Return Type:
RandomSource
Gets the height of the sea level. // LevelAccessor.seaLevel as int
Return Type:
int
// LevelAccessor.skyDarken as int
myLevelAccessor . skyDarken
Return Type:
int