From 2e724e977432ce01f6eece06636cb2eb333cd420 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sun, 25 Dec 2022 00:47:57 +0800 Subject: [PATCH] Close #903 --- .../plugin/client/DefaultClientPlugin.java | 20 +++++++++++++++++++ .../assets/roughlyenoughitems/lang/en_us.json | 2 ++ 2 files changed, 22 insertions(+) diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java index 335c9cb63..101b837bf 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java @@ -36,12 +36,14 @@ import me.shedaniel.rei.api.client.plugins.REIClientPlugin; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; +import me.shedaniel.rei.api.client.registry.entry.CollapsibleEntryRegistry; import me.shedaniel.rei.api.client.registry.entry.EntryRegistry; import me.shedaniel.rei.api.client.registry.screen.ExclusionZones; import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry; import me.shedaniel.rei.api.client.registry.transfer.TransferHandlerRegistry; import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.entry.EntryStack; +import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes; import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.impl.ClientInternals; @@ -152,6 +154,24 @@ public void registerEntries(EntryRegistry registry) { } } + @Override + public void registerCollapsibleEntries(CollapsibleEntryRegistry registry) { + registry.group(new ResourceLocation("roughlyenoughitems", "enchanted_book"), new TranslatableComponent("item.minecraft.enchanted_book"), + stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.castValue().is(Items.ENCHANTED_BOOK)); + registry.group(new ResourceLocation("roughlyenoughitems", "potion"), new TranslatableComponent("item.minecraft.potion"), + stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.castValue().is(Items.POTION)); + registry.group(new ResourceLocation("roughlyenoughitems", "splash_potion"), new TranslatableComponent("item.minecraft.splash_potion"), + stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.castValue().is(Items.SPLASH_POTION)); + registry.group(new ResourceLocation("roughlyenoughitems", "lingering_potion"), new TranslatableComponent("item.minecraft.lingering_potion"), + stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.castValue().is(Items.LINGERING_POTION)); + registry.group(new ResourceLocation("roughlyenoughitems", "spawn_egg"), new TranslatableComponent("text.rei.spawn_egg"), + stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.castValue().getItem() instanceof SpawnEggItem); + registry.group(new ResourceLocation("roughlyenoughitems", "tipped_arrow"), new TranslatableComponent("item.minecraft.tipped_arrow"), + stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.castValue().is(Items.TIPPED_ARROW)); + registry.group(new ResourceLocation("roughlyenoughitems", "music_disc"), new TranslatableComponent("text.rei.music_disc"), + stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.castValue().getItem() instanceof RecordItem); + } + @Override public void registerCategories(CategoryRegistry registry) { registry.add( diff --git a/runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json b/runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json index d0cb485ea..21f017573 100755 --- a/runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json +++ b/runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json @@ -198,6 +198,8 @@ "text.rei.collapsed.entry.hint.expand.macos": "Option-Click to expand all %s (%d entries)", "text.rei.collapsed.entry.hint.collapse": "Alt-Click to collapse all %s (%d entries)", "text.rei.collapsed.entry.hint.collapse.macos": "Option-Click to collapse all %s (%d entries)", + "text.rei.spawn_egg": "Spawn Egg", + "text.rei.music_disc": "Music Disc", "favorite.section.gamemode": "Game Mode", "favorite.section.weather": "Weather", "favorite.section.time": "Time",