neoforged / NeoForge

Neo Modding API for Minecraft, based on Forge
https://projects.neoforged.net/neoforged/neoforge
Other
1.17k stars 172 forks source link

[1.21] Creative Category sorting methods don't work #1119

Closed KekeCreations closed 3 months ago

KekeCreations commented 3 months ago

Minecraft Version: {Minecraft version. *1.21}

NeoForge Version: {NeoForge version. 21.0.0-beta,}

Steps to Reproduce:

  1. Create an item
  2. Try and put it in a vanilla creative category with addafter or addbefore
  3. boot up the game

Description of issue: My code for sorting creative categories, this should work yet it doesn't

`private void addAfter(BuildCreativeModeTabContentsEvent event, Item beforeItem, Item item) {
event.getEntries().putAfter(beforeItem.getDefaultInstance(), item.getDefaultInstance(), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
}
private void addAfter(BuildCreativeModeTabContentsEvent event, Block beforeItem, Item item) {
event.getEntries().putAfter(beforeItem.asItem().getDefaultInstance(), item.getDefaultInstance(), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
}
private void addAfter(BuildCreativeModeTabContentsEvent event, Item beforeItem, Block item) {
event.getEntries().putAfter(beforeItem.getDefaultInstance(), item.asItem().getDefaultInstance(), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
}
private void addAfter(BuildCreativeModeTabContentsEvent event, Block beforeItem, Block item) {
event.getEntries().putAfter(beforeItem.asItem().getDefaultInstance(), item.asItem().getDefaultInstance(), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
}
private void addBefore(BuildCreativeModeTabContentsEvent event, Block beforeItem, Block item) {
event.getEntries().putBefore(beforeItem.asItem().getDefaultInstance(), item.asItem().getDefaultInstance(), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
}
private void addBefore(BuildCreativeModeTabContentsEvent event, Item beforeItem, Item item) {
event.getEntries().putBefore(beforeItem.getDefaultInstance(), item.getDefaultInstance(), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
}

public void creativeItemGroups(BuildCreativeModeTabContentsEvent event) {
    if (event.getTabKey() == CreativeModeTabs.COLORED_BLOCKS) {
        addAfter(event, Blocks.PINK_GLAZED_TERRACOTTA, KekeBlocks.TERRACOTTA_SHINGLES.get());
        addAfter(event, KekeBlocks.TERRACOTTA_SHINGLES.get(), KekeBlocks.TERRACOTTA_SHINGLE_STAIRS.get());
        addAfter(event, KekeBlocks.TERRACOTTA_SHINGLE_STAIRS.get(), KekeBlocks.TERRACOTTA_SHINGLE_SLAB.get());
        addAfter(event, KekeBlocks.TERRACOTTA_SHINGLE_SLAB.get(), KekeBlocks.TERRACOTTA_SHINGLE_WALL.get());
}`

Result is items being the correct category but unsorted image

I asked someone for help to see if my code was the issue and they said this! image image

TelepathicGrunt commented 3 months ago

Linking the other previous issue report for reference https://github.com/neoforged/NeoForge/issues/1040 https://github.com/neoforged/NeoForge/issues/886