#EnchantJS: how to specify enchant.setCategory?

7 messages · Page 1 of 1 (latest)

covert token
#

Looking through the source code in github, it seems that the setCategory function requires a Predicate<Item>, however I am unsure how to translate that to JavaScript. The example script on the modpage says enchant.setCategory(i=>true) should be the function, however this makes all items enchantable for an enchantment.

slow bridgeBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

analog moat
#

Predicate<Item> is just a function that takes an item as the argument and returns true or false

#

So something like

item => {
  if (item.something) {
    return true
  }
return false
}```
#

Or more simply

item => item.something```
covert token
#

okay, thank you. I just did not know how to put it in JS haha

covert token
#

figured it out!