Level
Importing the class
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;
Extends
Level extends CapabilityProvider<Level>
.
Implements
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
Members
// Level.daytime as longmyLevel.daytime
Return Type:
long
// Level.daytime() as long;myLevel.daytime();
Return Type:
long
Returns: Whether the block was changed.
myLevel.destroyBlock(new BlockPos(0, 1, 2), true);
Parameters:
Return Type:
bool
Returns: Whether the block was changed.
myLevel.destroyBlock(new BlockPos(0, 1, 2), true, player);
Parameters:
Return Type:
bool
// Level.difficulty as DifficultymyLevel.difficulty
Return Type:
Difficulty
// Level.dimension as ResourceLocationmyLevel.dimension
Return Type:
ResourceLocation
// Level.gameTime as longmyLevel.gameTime
Return Type:
long
// Level.gameTime() as long;myLevel.gameTime();
Return Type:
long
Returns: The highest redstone signal available to the position.
myLevel.getBestNeighborSignal(new BlockPos(0, 1, 2));
Return Type:
int
myLevel.getBlockEntity(myBlockPos);
Return Type:
BlockEntity
Returns: The data of the tile entity.
myLevel.getBlockEntityData(new BlockPos(0, 1, 2));
Return Type:
IData
Returns: The block state at the position.
myLevel.getBlockState(new BlockPos(0, 1, 2));
Return Type:
BlockState
Returns: The found capability or null.
myLevel.getCapability<T>(Capabilities.ENERGY, <constant:minecraft:direction:north>);
Parameters:
Return Type:
T?
Returns: The found capability or null.
myLevel.getCapability<T>(Capabilities.ENERGY);
Parameters:
Return Type:
T?
myLevel.getCurrentDifficultyAt(myBlockPos);
Return Type:
DifficultyInstance
Returns: The highest strong (direct) redstone signal of all directly neighboring blocks.
myLevel.getDirectSignalTo(new BlockPos(0, 1, 2));
Return Type:
int
myLevel.getEntities(entity, 1.0, 1.0, 1.0, 11.4, 11.4, 11.4, (entityIn) => entityIn.isInWater());
Parameters:
Return Type:
List<Entity>
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));
Parameters:
Return Type:
List<Entity>
myLevel.getEntitiesInAreaExcluding(entity, (entityIn) => entityIn.isInWater(), new BlockPos(0, 1, 2), new BlockPos(3, 4, 5));
Parameters:
Return Type:
List<Entity>
Returns: all entities in given area.
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>
Returns: The redstone signal strength available from that direction.
myLevel.getSignal(new BlockPos(0, 1, 2), <direction:north>);
Parameters:
Return Type:
int
myLevel.globalLevelEvent(2005, new BlockPos(0, 1, 2), 0);
// 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
Returns: Whether the position is receiving a redstone signal.
myLevel.hasNeighborSignal(new BlockPos(0, 1, 2));
Return Type:
bool
// Level.isClientSide as boolmyLevel.isClientSide
Return Type:
bool
// Level.isDay as boolmyLevel.isDay
Return Type:
bool
// Level.isDay() as bool;myLevel.isDay();
Return Type:
bool
// Level.isNight as boolmyLevel.isNight
Return Type:
bool
// Level.isNight() as bool;myLevel.isNight();
Return Type:
bool
Returns: Whether it is raining at the current position.
myLevel.isRainingAt(new BlockPos(0, 1, 2));
Return Type:
bool
myLevel.levelEvent(player, myInt, myBlockPos, myInt);
Parameters:
myLevel.levelEvent(myInt, myBlockPos, myInt);
// Level.maxLightLevel as intmyLevel.maxLightLevel
Return Type:
int
// Level.playSound(player as Player, position as BlockPos, event as SoundEvent, source as SoundSource);myLevel.playSound(myPlayer, myBlockPos, mySoundEvent, mySoundSource);
Parameters:
event: SoundEvent
Type: SoundEvent
source: SoundSource
Type: SoundSource
// 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:
event: SoundEvent
Type: SoundEvent
source: SoundSource
Type: SoundSource
volume: float
Type: float
pitch: float
Type: float
// Level.raining as boolmyLevel.raining
Return Type:
bool
// Level.rainLevel = (level as float);myLevel.rainLevel = myFloat;
Parameters:
level: float
Type: float
- The new rain level between 0 and 1 // Level.rainLevel(level as float);myLevel.rainLevel(0.5);
Parameters:
level: float
Type: float
- The new rain level between 0 and 1 // Level.random as RandomSourcemyLevel.random
Return Type:
RandomSource
Returns: a BlockHitResult
holding the result, the position and facing the ray stops.
// Level.rayTraceBlocks(startVec as Vec3, endVec as Vec3, blockMode as BlockClipContext, fluidMode as FluidClipContext, 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:
blockMode: BlockClipContext
Type: BlockClipContext
- the type of block that the ray trace would stop at. fluidMode: FluidClipContext
Type: FluidClipContext
- the type of fluid that the ray trace would stop at.
Return Type:
BlockHitResult
// Level.seaLevel as intmyLevel.seaLevel
Return Type:
int
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"});
Return Type:
SequenceBuilder<Level, IData>
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.
myLevel.sequence<T>({version: "1.0.0"});
Parameters:
data: T
Type: T
Return Type:
SequenceBuilder<Level, T>
Returns: Whether the block was changed.
myLevel.setBlockAndUpdate(new BlockPos(0, 1, 2), <blockstate:minecraft:iron_block>);
Parameters:
Return Type:
bool
// Level.skyDarken as intmyLevel.skyDarken
Return Type:
int
// Level.thundering as boolmyLevel.thundering
Return Type:
bool