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 . ServerLevel;
ServerLevel extends Level
.
ServerLevel
implements the following interfaces:
LevelAccessor
,ICapabilityProviderImpl <ICapabilityProviderImpl >
,ICapabilityProvider
,CommonLevelAccessor
,LevelReader
,LevelSimulatedRW
,BlockAndTintGetter
,BlockGetter
,LevelWriter
,ServerLevelAccessor
Undocumented Interfaces WorldGenLevel
, ILevelExtension
, LevelTimeAccess
, EntityGetter
, CollisionGetter
, SignalGetter
, NoiseBiomeSource
, IBlockAndTintGetterExtension
, LevelHeightAccessor
, IBlockGetterExtension
, LevelSimulatedReader
add an entity to the world, return if the entity is added successfully. // ServerLevel.addFreshEntity(entity as Entity) as bool;
myServerLevel . addFreshEntity(myEntity);
Return Type:
bool
// ServerLevel.addFreshEntityWithPassengers(entity as Entity);
myServerLevel . addFreshEntityWithPassengers(myEntity);
// ServerLevel.canSeeSkyFromBelowWater(pos as BlockPos) as bool;
myServerLevel . canSeeSkyFromBelowWater(myBlockPos);
Return Type:
bool
Gets the custom data that is saved/loaded to/from disk when the level is saved/loaded to/from disk. This lets you store data on this specific level, so data stored in the Overworld will not be accessible from the Nether.
// ServerLevel.customData as CraftTweakerSavedData
Return Type:
CraftTweakerSavedData
Gets the custom data that is saved/loaded to/from disk when the level is saved/loaded to/from disk. This lets you store data on this specific level, so data stored in the Overworld will not be accessible from the Nether.
Returns : The custom data for this world.
// ServerLevel.customData() as CraftTweakerSavedData;
myServerLevel . customData();
Return Type:
CraftTweakerSavedData
// ServerLevel.damageSources as DamageSources
myServerLevel . damageSources
Return Type:
DamageSources
// ServerLevel.daytime as long
Return Type:
long
// ServerLevel.daytime() as long;
Return Type:
long
Sets the time of the Minecraft day. // ServerLevel.dayTime = (time as long);
myServerLevel . dayTime = myLong;
Parameters:
time: long
Type: long
- The new time of day. Should be between 0 and 24000.
Destroys a block within the world. Returns : Whether the block was changed.
// ServerLevel.destroyBlock(pos as BlockPos, doDrops as bool) as bool;
myServerLevel . 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.
// ServerLevel.destroyBlock(pos as BlockPos, doDrops as bool, breaker as Entity) as bool;
myServerLevel . 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. // ServerLevel.difficulty as Difficulty
Return Type:
Difficulty
Gets the registry name of the dimension this world represents. // ServerLevel.dimension as ResourceLocation
Return Type:
ResourceLocation
// ServerLevel.gameTime as long
Return Type:
long
// ServerLevel.gameTime() as long;
myServerLevel . gameTime();
Return Type:
long
Gets the highest redstone signal available to a position from any of it's neighbors. Returns : The highest redstone signal available to the position.
// ServerLevel.getBestNeighborSignal(pos as BlockPos) as int;
myServerLevel . getBestNeighborSignal( new BlockPos( 0 , 1 , 2 ));
Return Type:
int
Gets the biome at a given position. Returns : The biome at the given position.
// ServerLevel.getBiome(pos as BlockPos) as Biome;
myServerLevel . getBiome( new BlockPos( 0 , 1 , 2 ));
Return Type:
Biome
// ServerLevel.getBlockEntity(pos as BlockPos) as BlockEntity;
myServerLevel . getBlockEntity(myBlockPos);
Return Type:
BlockEntity
Gets the tile entity data for a tile entity at a given position. Returns : The data of the tile entity.
// ServerLevel.getBlockEntityData(pos as BlockPos) as IData;
myServerLevel . getBlockEntityData( new BlockPos( 0 , 1 , 2 ));
Return Type:
IData
// ServerLevel.getBlockFloorHeight(pos as BlockPos) as double;
myServerLevel . getBlockFloorHeight(myBlockPos);
Return Type:
double
Gets the block state at a given position. Returns : The block state at the position.
// ServerLevel.getBlockState(pos as BlockPos) as BlockState;
myServerLevel . getBlockState( new BlockPos( 0 , 1 , 2 ));
Return Type:
BlockState
Gets the capability for the given side. Returns : The found capability or null.
// ServerLevel.getCapability<T>(cap as Capability<T>, side as Direction) as T?;
myServerLevel . getCapability < T>(Capabilities.ENERGY, <constant : minecraft:direction:north > );
Return Type:
T ?
Gets the capability. Returns : The found capability or null.
// ServerLevel.getCapability<T>(cap as Capability<T>) as T?;
myServerLevel . getCapability < T>( Capabilities . ENERGY);
Return Type:
T ?
// ServerLevel.getCurrentDifficultyAt(position as BlockPos) as DifficultyInstance;
myServerLevel . getCurrentDifficultyAt(myBlockPos);
Return Type:
DifficultyInstance
Gets the highest strong (direct) redstone signal of any neighboring block. Returns : The highest strong (direct) redstone signal of all directly neighboring blocks.
// ServerLevel.getDirectSignalTo(pos as BlockPos) as int;
myServerLevel . getDirectSignalTo( new BlockPos( 0 , 1 , 2 ));
Return Type:
int
Gets entities in the world that match the given Predicate and the given EntityType (if provided). Returns : A List of Entities that match.
// ServerLevel.getEntities(predicate as function(t as Entity) as bool, type as EntityType<Entity> = null) as List<Entity>;
myServerLevel . getEntities((entity as MCEntity) => entity . isImmuneToFire(), < entitytype : minecraft:sheep > );
Parameters:
predicate: function(t as Entity ) as bool
Type: function(t as Entity ) as bool
- The predicate to check against.
Return Type:
List <Entity >
Gets all entities in given area, excluding the one passed into it. // ServerLevel.getEntities(excludingEntity as Entity, x1 as double, y1 as double, z1 as double, x2 as double, y2 as double, z2 as double, predicate as function(t as Entity) as bool) as List<Entity>;
myServerLevel . getEntities(entity, 1.0 , 1.0 , 1.0 , 11.4 , 11.4 , 11.4 , (entityIn) => entityIn . isInWater());
Parameters:
x1: double
Type: double
y1: double
Type: double
z1: double
Type: double
x2: double
Type: double
y2: double
Type: double
z2: double
Type: double
predicate: function(t as Entity ) as bool
Type: function(t as Entity ) as bool
- the entity filter
Return Type:
List <Entity >
Gets all entities in given area, but the arguments are block poses. If pos2
is omitted, it will use pos1.add(1, 1, 1)
Returns : all entities in given area
// ServerLevel.getEntitiesInArea<T : Entity>(pos1 as BlockPos, pos2 as BlockPos = null) as List<Entity>;
myServerLevel . getEntitiesInArea < T>( new BlockPos( 0 , 1 , 2 ), new BlockPos( 3 , 4 , 5 ));
Return Type:
List <Entity >
// ServerLevel.getEntitiesInAreaExcluding(excludingEntity as Entity, predicate as function(t as Entity) as bool, pos1 as BlockPos, pos2 as BlockPos = null) as List<Entity>;
myServerLevel . getEntitiesInAreaExcluding(entity, (entityIn) => entityIn . isInWater(), new BlockPos( 0 , 1 , 2 ), new BlockPos( 3 , 4 , 5 ));
Parameters:
predicate: function(t as Entity ) as bool
Type: function(t as Entity ) as bool
Return Type:
List <Entity >
Gets all entities in given area. Returns : all entities in given area.
// ServerLevel.getEntitiesOfClass<T : Entity>(x1 as double, y1 as double, z1 as double, x2 as double, y2 as double, z2 as double) as List<Entity>;
myServerLevel . getEntitiesOfClass < T>( 1.0 , 1.0 , 1.0 , 11.4 , 11.4 , 11.4 );
Parameters:
x1: double
Type: double
y1: double
Type: double
z1: double
Type: double
x2: double
Type: double
y2: double
Type: double
z2: double
Type: double
Return Type:
List <Entity >
// ServerLevel.getLightEmission(pos as BlockPos) as int;
myServerLevel . getLightEmission(myBlockPos);
Return Type:
int
Gets the redstone signal strength available to a position from a given direction. Returns : The redstone signal strength available from that direction.
// ServerLevel.getSignal(pos as BlockPos, direction as Direction) as int;
myServerLevel . getSignal( new BlockPos( 0 , 1 , 2 ), < direction : north > );
Return Type:
int
Triggers a predetermined event on the client. Using this on a server or integrated server will send the event to all nearby players. // ServerLevel.globalLevelEvent(eventId as int, pos as BlockPos, data as int);
myServerLevel . globalLevelEvent( 2005 , new BlockPos( 0 , 1 , 2 ), 0 );
Parameters:
eventId: int
Type: int
- The ID of the event to play.
data: int
Type: int
- Four bytes of additional data encoded as an integer. This is generally unused.
// ServerLevel.hasChunk(x as int, z as int) as bool;
myServerLevel . hasChunk(myInt, myInt);
Parameters:
x: int
Type: int
z: int
Type: int
Return Type:
bool
Checks if a given position is receiving a redstone signal. Returns : Whether the position is receiving a redstone signal.
// ServerLevel.hasNeighborSignal(pos as BlockPos) as bool;
myServerLevel . hasNeighborSignal( new BlockPos( 0 , 1 , 2 ));
Return Type:
bool
// ServerLevel.isClientSide as bool
myServerLevel . isClientSide
Return Type:
bool
// ServerLevel.isDay as bool
Return Type:
bool
// ServerLevel.isDay() as bool;
Return Type:
bool
Checks if the block at a given position is empty. Returns : Whether the block is empty.
// ServerLevel.isEmptyBlock(pos as BlockPos) as bool;
myServerLevel . isEmptyBlock( new BlockPos( 0 , 1 , 2 ));
Return Type:
bool
Checks if the block at a given position is in a loaded chunk. Returns : Whether the position is in a loaded chunk.
// ServerLevel.isLoaded(pos as BlockPos) as bool;
myServerLevel . isLoaded( new BlockPos( 0 , 1 , 2 ));
Return Type:
bool
// ServerLevel.isNight as bool
Return Type:
bool
// ServerLevel.isNight() as bool;
Return Type:
bool
Checks if a position is within an active raid. Returns : Whether the position was inside an active raid.
// ServerLevel.isRaided(pos as BlockPos) as bool;
myServerLevel . isRaided( new BlockPos( 0 , 1 , 2 ));
Return Type:
bool
Checks if it is raining at a specific position. This can never be true if the position does not have direct line of sight to the sky. Returns : Whether it is raining at the current position.
// ServerLevel.isRainingAt(pos as BlockPos) as bool;
myServerLevel . isRainingAt( new BlockPos( 0 , 1 , 2 ));
Return Type:
bool
Checks if a position is within a chunk that is considered a slime chunk. Returns : Whether the position was inside a slime chunk.
// ServerLevel.isSlimeChunk(pos as BlockPos) as bool;
myServerLevel . isSlimeChunk( new BlockPos( 0 , 1 , 2 ));
Return Type:
bool
Checks if a position is within a village. Returns : Whether the position was inside a village.
// ServerLevel.isVillage(pos as BlockPos) as bool;
myServerLevel . isVillage( new BlockPos( 0 , 1 , 2 ));
Return Type:
bool
// ServerLevel.isWaterAt(pos as BlockPos) as bool;
myServerLevel . isWaterAt(myBlockPos);
Return Type:
bool
// ServerLevel.level as ServerLevel
Return Type:
ServerLevel
Gets the data for this level, holds information such as if it is raining, thundering, difficulty, etc // ServerLevel.levelData as 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. // ServerLevel.levelEvent(excluded as Player, event as int, position as BlockPos, extra as int);
myServerLevel . 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. // ServerLevel.levelEvent(event as int, position as BlockPos, extra as int);
myServerLevel . 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.
// ServerLevel.maxLightLevel as int
myServerLevel . maxLightLevel
Return Type:
int
// ServerLevel.playSound(player as Player, position as BlockPos, event as SoundEvent, source as SoundSource);
myServerLevel . playSound(myPlayer, myBlockPos, mySoundEvent, mySoundSource);
// ServerLevel.playSound(player as Player, position as BlockPos, event as SoundEvent, source as SoundSource, volume as float, pitch as float);
myServerLevel . playSound(myPlayer, myBlockPos, mySoundEvent, mySoundSource, myFloat, myFloat);
Parameters:
volume: float
Type: float
pitch: float
Type: float
Checks if it is raining. // ServerLevel.raining as bool
Return Type:
bool
Sets the current rain level. // ServerLevel.rainLevel = (level as float);
myServerLevel . rainLevel = myFloat;
Parameters:
level: float
Type: float
- The new rain level between 0 and 1
Sets the current rain level. // ServerLevel.rainLevel(level as float);
myServerLevel . rainLevel( 0.5 );
Parameters:
level: float
Type: float
- The new rain level between 0 and 1
// ServerLevel.random as RandomSource
Return Type:
RandomSource
Creates a ray trace from one vector to the other vector, which will stop at a block or a fluid. Returns : a BlockHitResult
holding the result, the position and facing the ray stops.
// ServerLevel.rayTraceBlocks(startVec as Vec3, endVec as Vec3, blockMode as Block, fluidMode as Fluid, entity as Entity = null) as BlockHitResult;
myServerLevel . rayTraceBlocks( new Vec3( 0.0 , 0.0 , 0.0 ), new Vec3( 1.1 , 4.5 , 1.4 ), RayTraceBlockMode . OUTLINE, RayTraceFluidMode . NONE, entity);
Parameters:
startVec: Vec3
Type: Vec3
- a vector which describes the starting point endVec: Vec3
Type: Vec3
- a vector which describes the direction and length we are searching in entity: Entity
(optional) Type: Entity
- the entity for selection context
Default Value: null
Return Type:
BlockHitResult
Gets the height of the sea level. // ServerLevel.seaLevel as int
Return Type:
int
Gets the random seed of the world. // ServerLevel.seed as long
Return Type:
long
Creates a new SequenceBuilder
for this level. SequenceBuilder
's let you compose scripted events such as waiting 5 ticks, then setting the weather to rain.
Returns : A new SequenceBuilder
for this level.
// ServerLevel.sequence(data as IData = new crafttweaker.api.data.MapData()) as SequenceBuilder<Level, IData>;
myServerLevel . sequence({version: "1.0.0" });
Parameters:
data: IData
(optional) Type: IData
Default Value: new crafttweaker.api.data.MapData()
Return Type:
SequenceBuilder <Level , IData >
Creates a new SequenceBuilder
for this level. SequenceBuilder
's let you compose scripted events such as waiting 5 ticks, then setting the weather to rain.
Returns : A new SequenceBuilder
for this level.
// ServerLevel.sequence<T>(data as T) as SequenceBuilder<Level, T>;
myServerLevel . sequence < T>({version: "1.0.0" });
Return Type:
SequenceBuilder <Level , T >
// ServerLevel.server as MinecraftServer
Return Type:
Server
Sets the block and its state at a given position. Returns : Whether the block was changed.
// ServerLevel.setBlockAndUpdate(pos as BlockPos, state as BlockState) as bool;
myServerLevel . setBlockAndUpdate( new BlockPos( 0 , 1 , 2 ), < blockstate : minecraft:iron_block > );
Return Type:
bool
Sets the time of the Minecraft day to day. This is like using the "time set day" command or setting the time to 1000. // ServerLevel.setTimeToDay();
myServerLevel . setTimeToDay();
Sets the time of the Minecraft day to midnight. This is like using the "time set midnight" command or setting the time to 18000. // ServerLevel.setTimeToMidnight();
myServerLevel . setTimeToMidnight();
Sets the time of the Minecraft day to night. This is like using the "time set night" command or setting the time to 13000. // ServerLevel.setTimeToNight();
myServerLevel . setTimeToNight();
Sets the time of the Minecraft day to noon. This is like using the "time set noon" command or setting the time to 6000. // ServerLevel.setTimeToNoon();
myServerLevel . setTimeToNoon();
// ServerLevel.skyDarken as int
Return Type:
int
Checks if there is a thunder storm. // ServerLevel.thundering as bool
Return Type:
bool