Files

1.9 KiB

IScriptEntityItem.setThrower

← IScriptEntityItem · ← Master

Parça 3/5 · önceki · sonraki

c.getSubject().send("You can pick up this item in " + entityItem.getPickupDelay() + " ticks."); }

Parameters: delay - In ticks

getLifespan

int getLifespan()

Get entity's lifespan (max age).

function main(c) { var item = mappet.createItem("minecraft:diamond_hoe"); var pos = c.getSubject().getPosition();

var entityItem = c.getWorld().dropItemStack(item, pos.x, pos.y + 3, pos.z); c.getSubject().send("Item disappear in " + (entityItem.getLifespan() - entityItem.getAge()) + " ticks."); }

Returns: How many ticks remains until someone can pick up this item

setLifespan

void setLifespan(int lifespan)

Set entity's lifespan (max age).

function main(c) { var item = mappet.createItem("minecraft:diamond_hoe"); var pos = c.getSubject().getPosition();

var entityItem = c.getWorld().dropItemStack(item, pos.x, pos.y + 3, pos.z); entityItem.setLifespan(1200); // 60 seconds c.getSubject().send("Item disappear in " + (entityItem.getLifespan() - entityItem.getAge()) + " ticks."); }

Parameters: lifespan - In ticks

getOwner

java.lang.String getOwner()

Get entity's owner nickname (Who can pick up this item). Returns empty string if anyone able to pick it up.

function main(c) { var item = mappet.createItem("minecraft:diamond_hoe"); var pos = c.getSubject().getPosition();

var entityItem = c.getWorld().dropItemStack(item, pos.x, pos.y + 3, pos.z); c.getSubject().send(entityItem.getOwner()); }

Returns: Nickname of player who can pick up this item.

setOwner

void setOwner(java.lang.String owner)

Set entity's owner nickname (Who can pick up this item). use with empty string, if you want anyone to be able to pick it up.