Object methods
To counter the verbosity of global functions, you can write code more compactly using object methods.
Object value types such as Blocks, Items, Fluids, ... will have methods attached to them when used in JavaScript.
Object methods are just plain functions, but their first argument is tied to the object value.
For example, the global function itemstackStackable takes a single Item argument and outputs a Boolean. This function is available as a method on Item values via the name stackable, which takes zero arguments.
Global functions that accept two or more arguments will be available as method on object values, with all arguments shifted by one. For example, the global function itemstackStrength accepts an Item and a Block argument, but is also available as method on Items with a single Block argument.
return item.isStackable() && item.size() >= 16;
}
return item.strength(block) > 10;
}
return item.nbt().Damage === 0;
}