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 . ServerLevelAccessor;
ServerLevelAccessor
implements the following interfaces:
LevelAccessor
,CommonLevelAccessor
,LevelReader
,LevelSimulatedRW
,BlockAndTintGetter
,BlockGetter
,LevelWriter
Undocumented Interfaces LevelTimeAccess
, EntityGetter
, CollisionGetter
, SignalGetter
, NoiseBiomeSource
, ILevelReaderExtension
, IBlockAndTintGetterExtension
, LevelHeightAccessor
, IBlockGetterExtension
, LevelSimulatedReader
add an entity to the world, return if the entity is added successfully. // ServerLevelAccessor.addFreshEntity(entity as Entity) as bool;
myServerLevelAccessor . addFreshEntity(myEntity);
Return Type:
bool
// ServerLevelAccessor.addFreshEntityWithPassengers(entity as Entity);
myServerLevelAccessor . addFreshEntityWithPassengers(myEntity);
// ServerLevelAccessor.canSeeSkyFromBelowWater(pos as BlockPos) as bool;
myServerLevelAccessor . canSeeSkyFromBelowWater(myBlockPos);
Return Type:
bool
Destroys a block within the world. Returns : Whether the block was changed.
// ServerLevelAccessor.destroyBlock(pos as BlockPos, doDrops as bool) as bool;
myServerLevelAccessor . 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.
// ServerLevelAccessor.destroyBlock(pos as BlockPos, doDrops as bool, breaker as Entity) as bool;
myServerLevelAccessor . 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. // ServerLevelAccessor.difficulty as Difficulty
myServerLevelAccessor . difficulty
Return Type:
Difficulty
Gets the biome at a given position. Returns : The biome at the given position.
// ServerLevelAccessor.getBiome(pos as BlockPos) as Biome;
myServerLevelAccessor . 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.
// ServerLevelAccessor.getBlockEntityData(pos as BlockPos) as IData;
myServerLevelAccessor . getBlockEntityData( new BlockPos( 0 , 1 , 2 ));
Return Type:
IData
// ServerLevelAccessor.getBlockFloorHeight(pos as BlockPos) as double;
myServerLevelAccessor . getBlockFloorHeight(myBlockPos);
Return Type:
double
Gets the block state at a given position. Returns : The block state at the position.
// ServerLevelAccessor.getBlockState(pos as BlockPos) as BlockState;
myServerLevelAccessor . getBlockState( new BlockPos( 0 , 1 , 2 ));
Return Type:
BlockState
// ServerLevelAccessor.getCurrentDifficultyAt(position as BlockPos) as DifficultyInstance;
myServerLevelAccessor . getCurrentDifficultyAt(myBlockPos);
Return Type:
DifficultyInstance
// ServerLevelAccessor.getLightEmission(pos as BlockPos) as int;
myServerLevelAccessor . getLightEmission(myBlockPos);
Return Type:
int
// ServerLevelAccessor.hasChunk(x as int, z as int) as bool;
myServerLevelAccessor . hasChunk(myInt, myInt);
Parameters:
x: int
Type: int
z: int
Type: int
Return Type:
bool
// ServerLevelAccessor.isClientSide as bool
myServerLevelAccessor . isClientSide
Return Type:
bool
Checks if the block at a given position is empty. Returns : Whether the block is empty.
// ServerLevelAccessor.isEmptyBlock(pos as BlockPos) as bool;
myServerLevelAccessor . isEmptyBlock( new BlockPos( 0 , 1 , 2 ));
Return Type:
bool
// ServerLevelAccessor.isWaterAt(pos as BlockPos) as bool;
myServerLevelAccessor . isWaterAt(myBlockPos);
Return Type:
bool
// ServerLevelAccessor.level as ServerLevel
myServerLevelAccessor . level
Return Type:
ServerLevel
Gets the data for this level, holds information such as if it is raining, thundering, difficulty, etc // ServerLevelAccessor.levelData as LevelData
myServerLevelAccessor . 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. // ServerLevelAccessor.levelEvent(excluded as Player, event as int, position as BlockPos, extra as int);
myServerLevelAccessor . 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. // ServerLevelAccessor.levelEvent(event as int, position as BlockPos, extra as int);
myServerLevelAccessor . 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.
// ServerLevelAccessor.maxLightLevel as int
myServerLevelAccessor . maxLightLevel
Return Type:
int
// ServerLevelAccessor.playSound(player as Player, position as BlockPos, event as SoundEvent, source as SoundSource);
myServerLevelAccessor . playSound(myPlayer, myBlockPos, mySoundEvent, mySoundSource);
// ServerLevelAccessor.playSound(player as Player, position as BlockPos, event as SoundEvent, source as SoundSource, volume as float, pitch as float);
myServerLevelAccessor . playSound(myPlayer, myBlockPos, mySoundEvent, mySoundSource, myFloat, myFloat);
Parameters:
volume: float
Type: float
pitch: float
Type: float
// ServerLevelAccessor.random as RandomSource
myServerLevelAccessor . random
Return Type:
RandomSource
Gets the height of the sea level. // ServerLevelAccessor.seaLevel as int
myServerLevelAccessor . seaLevel
Return Type:
int
// ServerLevelAccessor.skyDarken as int
myServerLevelAccessor . skyDarken
Return Type:
int