mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 19:15:32 +00:00
Add unordered creative tabs after vanilla and perform a second level sorting of tabs by registry name to ensure tabs are ordered the same between game restarts (#9612)
This commit is contained in:
1 parent
77cd7043c9
commit
ccbc697bad
2 files changed
+48
-22
No files matched your search
@@ -5,6 +5,7 @@
|
||||
|
||||
package net.minecraftforge.debug;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
@@ -16,6 +17,7 @@ import net.minecraft.world.item.DyeColor;
|
||||
import net.minecraft.world.item.DyeItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
@@ -82,6 +84,18 @@ public class CreativeModeTabTest
|
||||
.withTabsBefore(CreativeModeTabs.COLORED_BLOCKS)
|
||||
.build()
|
||||
);
|
||||
|
||||
List<Block> blocks = List.of(Blocks.GRANITE, Blocks.DIORITE, Blocks.ANDESITE, Blocks.COBBLESTONE);
|
||||
for (int i = 0; i < blocks.size(); i++)
|
||||
{
|
||||
Block block = blocks.get(i);
|
||||
helper.register(new ResourceLocation(MOD_ID, "dummy" + i), CreativeModeTab.builder()
|
||||
.title(Component.literal("Dummy " + i))
|
||||
.icon(() -> new ItemStack(block))
|
||||
.displayItems((params, output) -> output.accept(block))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user