1.9 KiB
IScriptEntity.unlockRotation
Parça 12/17 · önceki · sonraki
if (entity.getLeashHolder()!=null) return; c.scheduleScript(0, function (c) { entity.setLeashHolder(player); }); }
Returns: the leash holder of this entity
clearLeashHolder
boolean clearLeashHolder(boolean dropLead)
Clears the leash holder of this entity.
//free all leashed entities in the world function main(c) { c.getServer().getEntities("@e[type=!player]").forEach(function(entity){ entity.clearLeashHolder(true); //true to drop the lead }); }
Parameters: dropLead - whether to drop the lead item
Returns: whether the leash holder was cleared successfully
setModifier
void setModifier(java.lang.String modifierName, double value)
Set entity's modifier to a certain value.
c.getSubject().setModifier("generic.movementSpeed", 0.5);
getModifier
double getModifier(java.lang.String modifierName)
Return an entity's modifier.
c.send(c.getSubject().getModifier("generic.movementSpeed"));
removeModifier
void removeModifier(java.lang.String modifierName)
Remove entity's modifier.
c.getSubject().removeModifier("generic.movementSpeed");
removeAllModifiers
void removeAllModifiers()
Remove all the modifiers of the entity.
c.getSubject().removeAllModifiers();
applyPotion
void applyPotion(Potion potion, int duration, int amplifier, boolean particles)
Apply given potion effect on the entity for given duration, with given amplifier, and optionally with particles.
Attention: potion effects work only with living base entities, so check for isLivingBase()! You can get the potion effect using IScriptFactory.getPotion(String).
var slowness = mappet.getPotion("slowness"); var subject = c.getSubject();