Package-level declarations

General extensions for entities

Properties

Link copied to clipboard
val Entity.blockPos: BlockPos

Shortcut property accessor for Entity.blockPosition.

Link copied to clipboard
val Entity.directionVector: Vec3

Returns a unit-vector pointing in the direction the entity is looking.

Link copied to clipboard
val Entity.pos: Vec3

Shortcut property accessor for Entity.position.

Link copied to clipboard
val Entity.posUnder: BlockPos

Returns the pos under the entities "feet".

Link copied to clipboard
val ServerPlayer.serverWorld: Level

Shortcut property accessor for ServerPlayer.serverLevel.

Link copied to clipboard

Returns an instance of BlockInfo of the block the entity is currently standing on or swimming in, else it will be the BlockInfo of air - use touchedBlockNoAir if you don't need any info about air.

Link copied to clipboard

Does the same as touchedBlock, but returns null if the block is air.

Link copied to clipboard
val Entity.world: Level

Shortcut property accessor for Entity.level.

Functions

Link copied to clipboard
fun Entity.changePos(x: Number = this.position().x, y: Number = this.position().y, z: Number = this.position().z, world: ServerLevel? = null, yaw: Float? = null, pitch: Float? = null)

Correctly handles teleports for all kinds of entities. Differentiates between ServerPlayer, LivingEntity and Entity and calls the correct function for each of them. Handles ServerLevel and direction changes.

Link copied to clipboard
fun Player.executeCommand(command: String)

Executes the given command for this player.

Link copied to clipboard
fun Entity.markVelocityDirty()

Schedules all necessary updates. Packets will be sent to the players to inform them about the new velocity.

Link copied to clipboard
inline fun Entity.modifyVelocity(block: (Vec3) -> Vec3)

Changes the velocity of this Entity using the given mutation logic in block. After that, markVelocityDirty is called.

fun Entity.modifyVelocity(vec: Vec3)

Sets the Entitys velocity to vec and calls markVelocityDirty.

fun Entity.modifyVelocity(x: Number = 0.0, y: Number = 0.0, z: Number = 0.0, add: Boolean = true)

Changes the velocity of this Entity and calls markVelocityDirty.