You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, there is no way to interact with the player.getItemCooldownManager().set(item, ticks) method via the Scarpet API. It would be great if there was, as that would allow Scarpet scripts to set cooldowns on items when they are used for custom abilities in similar ways that other Fabric mods such as Identity (example use) do it.
The text was updated successfully, but these errors were encountered:
put("item_cooldown", (e, v) ->
{
if (e instanceof ItemEntity)
{
if(!(v instanceof ListValue))
throw new InternalExpressionException("'item_cooldown' expected a list as a second argument");
ListValue lv = ((ListValue) v);
Value playersVal = lv.getItems().get(0);
int duration = ((NumericValue)lv.getItems().get(1)).getInt();
if(playersVal instanceof ListValue){
for(Value playerVal:((ListValue) playersVal).getItems()){
PlayerEntity player = EntityValue.getPlayerByValue(e.getServer(),playerVal);
player.getItemCooldownManager().set(((ItemEntity)e).getStack().getItem(),duration);
}
} else {//if its just 1 player
PlayerEntity player = EntityValue.getPlayerByValue(e.getServer(),playersVal);
player.getItemCooldownManager().set(((ItemEntity)e).getStack().getItem(),duration);
}
}
});
This is solution, allowing for: modify(item_entity,'cooldown',[player/player_list, duration]) cos its a per-player thing but we want cooldown to be per-item. too lazy to pr rn tho.
Currently, there is no way to interact with the
player.getItemCooldownManager().set(item, ticks)
method via the Scarpet API. It would be great if there was, as that would allow Scarpet scripts to set cooldowns on items when they are used for custom abilities in similar ways that other Fabric mods such as Identity (example use) do it.The text was updated successfully, but these errors were encountered: