Roughly Enough Items

KubeJS REI Integration

REI integration only works on Fabric in 1.16. In 1.18+, it works on both Forge and Fabric!

#Hide Items & Fluids

REIEvents.hide('item', event => {

REIEvents.hide('fluid', event => {

#Add Items & Fluids

REIEvents.add('item', event => {
  event.add(Item.of('example:item', {test: 123}))

REIEvents.add('fluid', event => {

#Add Information

REIEvents.information(event => {
  event.addItem('example:ingredient', ['Line 1', 'Line 2'])

#Hide Categories

REIEvents.removeCategories(event => {
  console.log(event.categoryIds) //log a list of all category ids to logs/kubejs/client.txt
  //event.remove works too, but yeeting is so much more fun 😉

#Grouping / Collapsible Entries

This will only work on version 1.18.2 and above!
REIEvents.groupEntries(event => {
  // This event allows you to add custom entry groups to REI, which can be used to clean up the entry list significantly.
  // As a simple example, we can add a 'Swords' group which will contain all (vanilla) swords
  // Note that each group will need an id (ResourceLocation) and a display name (Component / String)
  event.groupItems('kubejs:rei_groups/swords', 'Swords', [

  // An easy use case for grouping stuff together could be using tags:
  // In this case, we want all the Hanging Signs and Sign Posts from Supplementaries to be grouped together
  event.groupItemsByTag('supplementaries:rei_groups/hanging_signs', 'Hanging Signs', 'supplementaries:hanging_signs')
  event.groupItemsByTag('supplementaries:rei_groups/sign_posts', 'Sign Posts', 'supplementaries:sign_posts')

  // Another example: We want all of these items to be grouped together ignoring NBT,
  // so you don't have a bajillion potions and enchanted books cluttering up REI anymore
  const useNbt = ['potion', 'enchanted_book', 'splash_potion', 'tipped_arrow', 'lingering_potion']

  useNbt.forEach(id => {
    const item = Item.of(id)
    const { namespace, path } =
    event.groupSameItem(`kubejs:rei_groups/$==={namespace}===/$==={path}===`,, item)

  // Items can also be grouped using anything that can be expressed as an IngredientJS,
  // including for example regular expressions or lists of ingredients
  event.groupItems('kubejs:rei_groups/spawn_eggs', 'Spawn Eggs', [

  // you can even use custom predicates for grouping, like so:
  event.groupItemsIf('kubejs:rei_groups/looting_stuff', 'Stuff with Looting I', item =>
    // this would group together all items that have the Looting I enchantment on them
    item.hasEnchantment('minecraft:looting', 1)

  // you can also group fluids in much the same way as you can group items, for instance:
  event.groupFluidsByTag('kubejs:rei_groups/fluid_tagged_as_water', '\'Water\' (yeah right lmao)', 'minecraft:water')