[Bug] Grouping of items breaks if there's only item to display
Laifsyn opened this issue ยท 0 comments
What happened?
What mod loaders are you seeing the problem on?
Fabric
What do you think this bug is of?
- Visual
- Recipe Lookup
- Cheat Mode
- Plugin Integration / JEI Plugin Compatibility
- Others
Relevant log output
(?)
Anything else?
The KubeJS I used(sorry, I just copy-pasted an example, so idk what the heq is happening)
onEvent("rei.group", (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", [
"minecraft:wooden_sword",
"minecraft:stone_sword",
"minecraft:iron_sword",
"minecraft:diamond_sword",
"minecraft:golden_sword",
"minecraft:netherite_sword",
]);
// 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 } = Utils.id(item.id);
console.info(id)
console.info(id + 'asdasdasdasd \n' + namespace)
event.groupSameItem(`kubejs:rei_groups/${namespace}/${path}`, item.getName(), 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", [
/spawn_egg/,
]);
event.groupItems("kubejs:rei_groups/beds", "Beds", [
/_bed/,
]);
// 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");
});
By submitting this issue, I have included the necessary logs by pasting the contents into the correct location or attaching the file as an upload.
- Yes, and I did not use any paste services other than GitHub Gists.
By submitting this issue, I have confirmed my REI and REI's dependencies are up to date.
- Yes