This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
api:creative_tabs [2022/09/17 13:19] – format code shedaniel | api:creative_tabs [2023/05/09 11:31] – shedaniel | ||
---|---|---|---|
Line 5: | Line 5: | ||
The first argument is the id of the new tab, which will be used to define the translation key. | The first argument is the id of the new tab, which will be used to define the translation key. | ||
The second argument is the icon of the new tab, which is a supplier to a '' | The second argument is the icon of the new tab, which is a supplier to a '' | ||
+ | |||
+ | **1.19.3 to 1.19.4** | ||
+ | <code java> | ||
+ | public static final CreativeTabRegistry.TabSupplier MY_TAB = CreativeTabRegistry.create( | ||
+ | new ResourceLocation(“modid”, | ||
+ | () -> new ItemStack(Items.STONE) // Icon | ||
+ | ); | ||
+ | </ | ||
+ | |||
+ | **1.19.2 or below** | ||
<code java> | <code java> | ||
Line 11: | Line 21: | ||
() -> new ItemStack(Items.STONE) // Icon | () -> new ItemStack(Items.STONE) // Icon | ||
); | ); | ||
+ | </ | ||
+ | |||
+ | ===== Using the tab ===== | ||
+ | To add an item to the tab, you can use the `tab` method in Item.Properties, | ||
+ | |||
+ | **1.19.3 to 1.19.4** | ||
+ | <code java> | ||
+ | new Item.Properties().arch$tab(MY_TAB); | ||
+ | </ | ||
+ | |||
+ | **1.19.2 or below** | ||
+ | <code java> | ||
+ | new Item.Properties().tab(MY_TAB); | ||
</ | </ |