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 . Level;
Level extends CapabilityProvider <Level >
.
Level
implements the following interfaces:
LevelAccessor
,ICapabilityProviderImpl <ICapabilityProviderImpl >
,ICapabilityProvider
,CommonLevelAccessor
,LevelReader
,LevelSimulatedRW
,BlockAndTintGetter
,BlockGetter
,LevelWriter
Undocumented Interfaces ILevelExtension
, LevelTimeAccess
, EntityGetter
, CollisionGetter
, SignalGetter
, NoiseBiomeSource
, IBlockAndTintGetterExtension
, LevelHeightAccessor
, IBlockGetterExtension
, LevelSimulatedReader
add an entity to the world, return if the entity is added successfully. // Level.addFreshEntity(entity as Entity) as bool;
myLevel . addFreshEntity(myEntity);
Return Type:
bool
// Level.canSeeSkyFromBelowWater(pos as BlockPos) as bool;
myLevel . canSeeSkyFromBelowWater(myBlockPos);
Return Type:
bool
// Level.daytime() as long;
Return Type:
long
Destroys a block within the world. Returns : Whether the block was changed.
// Level.destroyBlock(pos as BlockPos, doDrops as bool) as bool;
myLevel . 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.
// Level.destroyBlock(pos as BlockPos, doDrops as bool, breaker as Entity) as bool;
myLevel . 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. // Level.difficulty as Difficulty
Return Type:
Difficulty
Gets the registry name of the dimension this world represents. // Level.dimension as ResourceLocation
Return Type:
ResourceLocation
// Level.gameTime as long
Return Type:
long
// Level.gameTime() as long;
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.
// Level.getBestNeighborSignal(pos as BlockPos) as int;
myLevel . getBestNeighborSignal( new BlockPos( 0 , 1 , 2 ));
Return Type:
int
Gets the biome at a given position. Returns : The biome at the given position.
// Level.getBiome(pos as BlockPos) as Biome;
myLevel . getBiome( new BlockPos( 0 , 1 , 2 ));
Return Type:
Biome
// Level.getBlockEntity(pos as BlockPos) as BlockEntity;
myLevel . 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.
// Level.getBlockEntityData(pos as BlockPos) as IData;
myLevel . getBlockEntityData( new BlockPos( 0 , 1 , 2 ));
Return Type:
IData
// Level.getBlockFloorHeight(pos as BlockPos) as double;
myLevel . getBlockFloorHeight(myBlockPos);
Return Type:
double
Gets the block state at a given position. Returns : The block state at the position.
// Level.getBlockState(pos as BlockPos) as BlockState;
myLevel . getBlockState( new BlockPos( 0 , 1 , 2 ));
Return Type:
BlockState
Gets the capability for the given side. Returns : The found capability or null.
// Level.getCapability<T>(cap as Capability<T>, side as Direction) as T?;
myLevel . getCapability < T>(Capabilities.ENERGY, <constant : minecraft:direction:north > );
Return Type:
T ?
Gets the capability. Returns : The found capability or null.
// Level.getCapability<T>(cap as Capability<T>) as T?;
myLevel . getCapability < T>( Capabilities . ENERGY);
Return Type:
T ?
// Level.getCurrentDifficultyAt(position as BlockPos) as DifficultyInstance;
myLevel . 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.
// Level.getDirectSignalTo(pos as BlockPos) as int;
myLevel . getDirectSignalTo( new BlockPos( 0 , 1 , 2 ));
Return Type:
int
Gets all entities in given area, excluding the one passed into it. // Level.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>;
myLevel . 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
// Level.getEntitiesInArea<T : Entity>(pos1 as BlockPos, pos2 as BlockPos = null) as List<Entity>;
myLevel . getEntitiesInArea < T>( new BlockPos( 0 , 1 , 2 ), new BlockPos( 3 , 4 , 5 ));
Return Type:
List <Entity >
// Level.getEntitiesInAreaExcluding(excludingEntity as Entity, predicate as function(t as Entity) as bool, pos1 as BlockPos, pos2 as BlockPos = null) as List<Entity>;
myLevel . 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.
// Level.getEntitiesOfClass<T : Entity>(x1 as double, y1 as double, z1 as double, x2 as double, y2 as double, z2 as double) as List<Entity>;
myLevel . 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 >
// Level.getLightEmission(pos as BlockPos) as int;
myLevel . 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.
// Level.getSignal(pos as BlockPos, direction as Direction) as int;
myLevel . 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. // Level.globalLevelEvent(eventId as int, pos as BlockPos, data as int);
myLevel . 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.
// Level.hasChunk(x as int, z as int) as bool;
myLevel . 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.
// Level.hasNeighborSignal(pos as BlockPos) as bool;
myLevel . hasNeighborSignal( new BlockPos( 0 , 1 , 2 ));
Return Type:
bool
// Level.isClientSide as bool
Return Type:
bool
// Level.isDay() as bool;
Return Type:
bool
Checks if the block at a given position is empty. Returns : Whether the block is empty.
// Level.isEmptyBlock(pos as BlockPos) as bool;
myLevel . 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.
// Level.isLoaded(pos as BlockPos) as bool;
myLevel . isLoaded( new BlockPos( 0 , 1 , 2 ));
Return Type:
bool
// Level.isNight() as bool;
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.
// Level.isRainingAt(pos as BlockPos) as bool;
myLevel . isRainingAt( new BlockPos( 0 , 1 , 2 ));
Return Type:
bool
// Level.isWaterAt(pos as BlockPos) as bool;
myLevel . isWaterAt(myBlockPos);
Return Type:
bool
Gets the data for this level, holds information such as if it is raining, thundering, difficulty, etc // Level.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. // Level.levelEvent(excluded as Player, event as int, position as BlockPos, extra as int);
myLevel . 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. // Level.levelEvent(event as int, position as BlockPos, extra as int);
myLevel . 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.
// Level.maxLightLevel as int
Return Type:
int
// Level.playSound(player as Player, position as BlockPos, event as SoundEvent, source as SoundSource);
myLevel . playSound(myPlayer, myBlockPos, mySoundEvent, mySoundSource);
// Level.playSound(player as Player, position as BlockPos, event as SoundEvent, source as SoundSource, volume as float, pitch as float);
myLevel . playSound(myPlayer, myBlockPos, mySoundEvent, mySoundSource, myFloat, myFloat);
Parameters:
volume: float
Type: float
pitch: float
Type: float
Checks if it is raining.
Return Type:
bool
Sets the current rain level. // Level.rainLevel = (level as float);
myLevel . rainLevel = myFloat;
Parameters:
level: float
Type: float
- The new rain level between 0 and 1
Sets the current rain level. // Level.rainLevel(level as float);
Parameters:
level: float
Type: float
- The new rain level between 0 and 1
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.
// Level.rayTraceBlocks(startVec as Vec3, endVec as Vec3, blockMode as Block, fluidMode as Fluid, entity as Entity = null) as BlockHitResult;
myLevel . 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.
Return Type:
int
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.
// Level.sequence(data as IData = new crafttweaker.api.data.MapData()) as SequenceBuilder<Level, IData>;
myLevel . 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.
// Level.sequence<T>(data as T) as SequenceBuilder<Level, T>;
myLevel . sequence < T>({version: "1.0.0" });
Return Type:
SequenceBuilder <Level , T >
Sets the block and its state at a given position. Returns : Whether the block was changed.
// Level.setBlockAndUpdate(pos as BlockPos, state as BlockState) as bool;
myLevel . setBlockAndUpdate( new BlockPos( 0 , 1 , 2 ), < blockstate : minecraft:iron_block > );
Return Type:
bool
// Level.skyDarken as int
Return Type:
int
Checks if there is a thunder storm. // Level.thundering as bool
Return Type:
bool