Skip to content

Commit

Permalink
fix: add books to modonomicon tab by default on forge and fabric
Browse files Browse the repository at this point in the history
to match neo behaviour
  • Loading branch information
klikli-dev committed Oct 5, 2024
1 parent c216753 commit 8411bf0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static void onModifyEntries(CreativeModeTab group, FabricItemGroupEntries

BookDataManager.get().getBooks().values().forEach(b -> {
if (tabKey == CreativeModeTabs.SEARCH ||
MODONOMICON == group ||
BuiltInRegistries.CREATIVE_MODE_TAB.get(ResourceLocation.parse(b.getCreativeTab())) == group) {
if (b.generateBookItem()) {
ItemStack stack = new ItemStack(ItemRegistry.MODONOMICON.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ public static void onCreativeModeTabBuildContents(BuildCreativeModeTabContentsEv
if (tabName == null)
return;

var modonomiconTab = CreativeModeTabRegistry.MODONOMICON.get();

//From: Neo EventHooks#onCreativeModeTabBuildContents
//we need to use it here to test before inserting, because event.getEntries().contains uses a different hashing strategy and is thus not reliable
final var searchDupes = new ObjectLinkedOpenCustomHashSet<ItemStack>(ItemStackLinkedSet.TYPE_AND_TAG);

BookDataManager.get().getBooks().values().forEach(b -> {
if (event.getTabKey() == CreativeModeTabs.SEARCH || net.minecraftforge.common.CreativeModeTabRegistry.getTab(ResourceLocation.parse(b.getCreativeTab())) == event.getTab()) {
if (event.getTabKey() == CreativeModeTabs.SEARCH ||
modonomiconTab == event.getTab() ||
net.minecraftforge.common.CreativeModeTabRegistry.getTab(ResourceLocation.parse(b.getCreativeTab())) == event.getTab()) {
if (b.generateBookItem()) {
ItemStack stack = new ItemStack(ItemRegistry.MODONOMICON.get());

Expand Down

0 comments on commit 8411bf0

Please sign in to comment.