Level
Importing the class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
Extending CapabilityProvider<Level>
Level extends CapabilityProvider<Level>. That means all methods available in CapabilityProvider<Level> are also available in Level
Implemented Interfaces
Level implements the following interfaces. That means all methods defined in these interfaces are also available in Level
- AutoCloseable
Methods
add an entity to the world, return if the entity is added successfully.
Return Type: boolean
Parameter | Type |
---|---|
Parameter entity | Type Entity |
Destroys a block within the world.
Returns: Whether the block was changed.
Return Type: boolean
Parameter | Type | Description |
---|---|---|
Parameter pos | Type BlockPos | Description The position of the block. |
Parameter doDrops | Type boolean | Description Whether the block drops itself and it’s loot. |
Destroys a block within the world.
Returns: Whether the block was changed.
Return Type: boolean
Parameter | Type | Description |
---|---|---|
Parameter pos | Type BlockPos | Description The position of the block. |
Parameter doDrops | Type boolean | Description Whether the block drops itself and it’s loot. |
Parameter breaker | Type Entity? | Description The entity to break the block. |
Gets the highest redstone signal available to a position from any of it’s neighbors.
Returns: The highest redstone signal available to the position.
Return Type: int
Parameter | Type | Description |
---|---|---|
Parameter pos | Type BlockPos | Description The position to check. |
Return Type: BlockEntity?
Parameter | Type |
---|---|
Parameter pos | Type BlockPos |
Gets the block state at a given position.
Returns: The block state at the position.
Return Type: BlockState
Parameter | Type | Description |
---|---|---|
Parameter pos | Type BlockPos | Description The position to look up. |
Return Type: long
Gets the highest strong (direct) redstone signal of any neighboring block.
Returns: The highest strong (direct) redstone signal of all directly neighboring blocks.
Return Type: int
Parameter | Type | Description |
---|---|---|
Parameter pos | Type BlockPos | Description The position to check. |
Gets all entities in given area, excluding the one passed into it.
Return Type: stdlib.List<Entity>
Parameter | Type | Description |
---|---|---|
Parameter excludingEntity | Type Entity? | Description |
Parameter x1 | Type double | Description |
Parameter y1 | Type double | Description |
Parameter z1 | Type double | Description |
Parameter x2 | Type double | Description |
Parameter y2 | Type double | Description |
Parameter z2 | Type double | Description |
Parameter predicate | Type Predicate<Entity> | Description the entity filter |
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
Return Type: stdlib.List<T>
Parameter | Type | Optional |
---|---|---|
Parameter pos1 | Type BlockPos | Optional false |
Parameter pos2 | Type BlockPos | Optional true |
Parameter T | Type Entity | Optional |
Gets all entities in given area.
Returns: all entities in given area.
Return Type: stdlib.List<T>
Parameter | Type |
---|---|
Parameter x1 | Type double |
Parameter y1 | Type double |
Parameter z1 | Type double |
Parameter x2 | Type double |
Parameter y2 | Type double |
Parameter z2 | Type double |
Parameter T | Type Entity |
Return Type: long
Gets the redstone signal strength available to a position from a given direction.
Returns: The redstone signal strength available from that direction.
Return Type: int
Parameter | Type | Description |
---|---|---|
Parameter pos | Type BlockPos | Description The position to check. |
Parameter direction | Type Direction | Description The direction to query. |
Triggers a predetermined event on the client. Using this on a server or integrated server will send the event to all nearby players.
Parameter | Type | Description |
---|---|---|
Parameter eventId | Type int | Description The ID of the event to play. |
Parameter pos | Type BlockPos | Description The position of the event. |
Parameter data | Type int | Description Four bytes of additional data encoded as an integer. This is generally unused. |
Checks if a given position is receiving a redstone signal.
Returns: Whether the position is receiving a redstone signal.
Return Type: boolean
Parameter | Type | Description |
---|---|---|
Parameter pos | Type BlockPos | Description The position to check. |
Return Type: boolean
Return Type: boolean
Checks if the block at a given position is empty.
Returns: Whether the block is empty.
Return Type: boolean
Parameter | Type | Description |
---|---|---|
Parameter pos | Type BlockPos | Description The position to look up. |
Checks if the block at a given position is in a loaded chunk.
Returns: Whether the position is in a loaded chunk.
Return Type: boolean
Parameter | Type | Description |
---|---|---|
Parameter pos | Type BlockPos | Description The position to look up. |
Return Type: boolean
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.
Return Type: boolean
Parameter | Type | Description |
---|---|---|
Parameter pos | Type BlockPos | Description The position to check. |
Triggers a predetermined event on the client. Using this on a server or integrated server will send the event to all nearby players.
Parameter | Type | Description |
---|---|---|
Parameter excluded | Type Player? | Description An excluded player who will not receive the event. |
Parameter eventId | Type int | Description The ID of the event to play. |
Parameter pos | Type BlockPos | Description The position of the event. |
Parameter data | Type int | Description Four bytes of additional data encoded as an integer. This is generally unused. |
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.
Return Type: BlockHitResult
Parameter | Type | Description | Optional |
---|---|---|---|
Parameter startVec | Type Vec3 | Description a vector which describes the starting point | Optional false |
Parameter endVec | Type Vec3 | Description a vector which describes the direction and length we are searching in | Optional false |
Parameter blockMode | Type BlockClipContext | Description the type of block that the ray trace would stop at. | Optional false |
Parameter fluidMode | Type FluidClipContext | Description the type of fluid that the ray trace would stop at. | Optional false |
Parameter entity | Type Entity | Description the entity for selection context | Optional true |
Creates a new SequenceBuilder<T,U> for this level.
SequenceBuilder<T,U>‘s let you compose scripted events such as waiting 5 ticks, then setting the weather to rain.
Returns: A new SequenceBuilder<T,U> for this level.
Return Type: SequenceBuilder<Level,MapData>
Parameter | Type | Optional | Default Value |
---|---|---|---|
Parameter data | Type MapData | Optional true | Default Value new crafttweaker.api.data.MapData() |
Creates a new SequenceBuilder<T,U> for this level.
SequenceBuilder<T,U>‘s let you compose scripted events such as waiting 5 ticks, then setting the weather to rain.
Returns: A new SequenceBuilder<T,U> for this level.
Return Type: SequenceBuilder<Level,T>
Parameter | Type |
---|---|
Parameter data | Type T |
Parameter T | Type Object |
Sets the block and its state at a given position.
Returns: Whether the block was changed.
Return Type: boolean
Parameter | Type | Description |
---|---|---|
Parameter pos | Type BlockPos | Description The position to set the block at. |
Parameter state | Type BlockState | Description The new state of the block. |
Sets the current rain level.
Parameter | Type | Description |
---|---|---|
Parameter level | Type float | Description The new rain level between 0 and 1 |
Properties
Name | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
Name daytime | Type long | Has Getter true | Has Setter false | Description |
Name difficulty | Type string | Has Getter true | Has Setter false | Description Gets the difficulty setting for the world. |
Name difficultyLocked | Type boolean | Has Getter true | Has Setter false | Description Checks if the difficulty of the world has been locked. |
Name dimension | Type ResourceLocation | Has Getter true | Has Setter false | Description Gets the registry name of the dimension this world represents. |
Name gameTime | Type long | Has Getter true | Has Setter false | Description |
Name hardcore | Type boolean | Has Getter true | Has Setter false | Description Checks if hardcore mode is enabled. |
Name isClientSide | Type boolean | Has Getter true | Has Setter false | Description |
Name isDay | Type boolean | Has Getter true | Has Setter false | Description |
Name isNight | Type boolean | Has Getter true | Has Setter false | Description |
Name rainLevel | Type Level | Has Getter false | Has Setter true | Description Sets the current rain level. |
Name raining | Type boolean | Has Getter true | Has Setter false | Description Checks if it is raining. |
Name random | Type RandomSource | Has Getter true | Has Setter false | Description |
Name seaLevel | Type int | Has Getter true | Has Setter false | Description Gets the height of the sea level. |
Name thundering | Type boolean | Has Getter true | Has Setter false | Description Checks if there is a thunder storm. |