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 AttachmentHolder
.
Level
implements the following interfaces:
LevelAccessor
,ILevelExtension
,IAttachmentHolder
,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. // 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.
Return Type:
Difficulty
Gets the registry name of the dimension this world represents.
Return Type:
ResourceLocation
// Level.gameTime as long
Return Type:
long
// Level.gameTime() as long;
Return Type:
long
myLevel . getAttachmentData < T>(myAttachmentType);
Return Type:
T
// Level.getAttachmentData<T>(type as Supplier< AttachmentType <T>>) as T; myLevel . getAttachmentData < T>(mySupplier);
Return Type:
T
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.
myLevel . getBiome( new BlockPos( 0 , 1 , 2 ));
Return Type:
Biome
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.
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.
myLevel . getBlockState( new BlockPos( 0 , 1 , 2 ));
Return Type:
BlockState
myLevel . getCapability < C, T>(myBlockCapability, myBlockPos, myC);
Return Type:
T ?
myLevel . getCapability < C, T>(myBlockCapability, myBlockPos, myBlockState, myBlockEntity, myC);
Return Type:
T ?
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
myLevel . getEntitiesInArea < T>( new BlockPos( 0 , 1 , 2 ), new BlockPos( 3 , 4 , 5 ));
Return Type:
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.
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.
myLevel . hasAttachmentData < T>(myAttachmentType);
Return Type:
bool
// Level.hasAttachmentData<T>(type as Supplier< AttachmentType <T>>) as bool; myLevel . hasAttachmentData < T>(mySupplier);
Return Type:
bool
// 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
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
myLevel . playSound(myPlayer, myBlockPos, mySoundEvent, mySoundSource);
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.
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
// Level.setAttachmentData<T>(type as AttachmentType <T>, data as T) as T?; myLevel . setAttachmentData < T>(myAttachmentType, myT);
Return Type:
T ?
// Level.setAttachmentData<T>(type as Supplier< AttachmentType <T>>, data as T) as T?; myLevel . setAttachmentData < T>(mySupplier, myT);
Return Type:
T ?
Sets the block and its state at a given position. Returns : Whether the block was changed.
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