Files

1.9 KiB

IScriptEntity.unlockRotation

← IScriptEntity · ← Master

Parça 11/17 · önceki · sonraki

You can use this method, by calling it with 0, to prevent fall damage when teleporting an entity which was already falling.

remove

void remove()

Remove this entity from the server without any dead effects (essentially despawn).

kill

void kill()

Kill this entity from the server by inflicting lots of damage (similar to /kill command).

swingArm

default void swingArm()

Swing entity's main hand.

swingArm

void swingArm(int arm)

Swing entity's arm.

Parameters: arm - 0 is primary (main), 1 is secondary (off-hand).

getLeashedEntities

java.util.List getLeashedEntities()

Returns leashed entities by this entity.

var leashedEntities = c.getSubject().getLeashedEntities(); leashedEntities.forEach(function(leashedEntity){ leashedEntity.kill(); });

Returns: leashed entities list

setLeashHolder

boolean setLeashHolder(IScriptEntity leashHolder)

Sets the leash holder of this entity.

// Leash all entities within 5 blocks of the subject function main(c){ var tracker = c.getSubject(); var trackedEntities = c.getServer().getEntities("@e[type=!player]"); trackedEntities.forEach(function(trackedEntity){ if (trackedEntity.isEntityInRadius(tracker, 5)){ trackedEntity.setLeashHolder(tracker); } }); }

Parameters: leashHolder - the entity to leash this entity to

Returns: whether the leash holder was set successfully

getLeashHolder

IScriptEntity getLeashHolder()

Returns the leash holder of this entity.

//in scripted item (player: on entity interaction) //this leashes the entity to the player if it is not already leashed function main(c) { var player = c.getSubject(); var entity = c.getObject();