Creative Tab
Link to creative-tab
This allows you to add Creative Tabs to the game!
Creating the ICreativeTab object
Link to creating-the-icreativetab-object
Before you can add the tab, you need to create a representation which will allow you to set the properties of the tab you want to add.
This is where the VanillaFactory comes in:
ZenScript Copymods.contenttweaker.VanillaFactory.createCreativeTab(String unlocalizedName, IItemStack iItemStack);
mods.contenttweaker.VanillaFactory.createCreativeTab(String unlocalizedName, ItemRepresentation iItem);
mods.contenttweaker.VanillaFactory.createCreativeTab(String unlocalizedName, BlockRepresentation iBlock);
mods.contenttweaker.VanillaFactory.createCreativeTab(String unlocalizedName, IItemStackSupplier supplier);
The String is in each of the three methods the same: It's the unlocalized name the Tab will later have.
The second parameter is the symbol your tab will carry later on (e.g. a lava bucket for "misc").
You can decide wheter you want to use an itemRepresentation, an itemStack, a blockrepresentation or an itemStackSupplier function.
Calling an existing ICreativeTab object
Link to calling-an-existing-icreativetab-object
You can also call an existing creative tab, though you cannot change any of it's properties.
Why would you need this, you ask?
You will need this if you want to add a newly created block or item to an existing tab!
Свойства
Link to свойства
You can call and set all these properties using the normal ZenGetters and ZenSetters
tab.unlocalizedName = "hh";
Note that you will probably hardly ever need the Setters as these Properties are already initialized to your wanted values when you create the ICreativeTab object.
Also, you can neither set nor get properties from an existing ICreativeTab(one that you retrieved using the Bracket handler)!
Property Name | Тип | Required | Default Value | Description/Notes |
---|---|---|---|---|
Property Name unlocalizedName | Тип string | Required YES | Default Value | Description/Notes The Creative Tab's name |
Property Name iconStack | Тип IItemStack | Required YES/NO | Default Value | Description/Notes The Creative Tab's icon |
Property Name iconStackSupplier | Тип IItemStackSupplier | Required NO/YES | Default Value null | Description/Notes Determines something? |
Registering the creative tab
Link to registering-the-creative-tab
You need to call this method to register the creative Tab in the game!
Otherwise nothing will happen!
After you have called this function, you cannot un-register the tab or change any of it's properties!
ZenScript Copytab.register();
Example Script
Link to example-script
ZenScript Copy#loader contenttweaker
import mods.contenttweaker.CreativeTab;
import mods.contenttweaker.VanillaFactory;
val zsTab = VanillaFactory.createCreativeTab("contenttweaker", <item:minecraft:dragon_egg>);
zsTab.register();