-
Notifications
You must be signed in to change notification settings - Fork 8
Creative Tab Modifiers
This feature allows you to edit the content of a creative tab. This inclues:
- Adding new items (at a certain position)
- Removing existing items
- Changing icon
- Adding a new tab (WIP)
- Removing a tab entirely (WIP)
To start you'll need to create a .json file in your resource pack folder in assets/[tab namespace]/polytone/creative_tab_modifiers/[tab name].json
.
For example if you want to modify minecraft:combat
you can do so with a file located in assets/minecraft/polytone/biome_effects/combat.json
Alternatively, if you want to manually specify your targets you can place this json in assets/[your pack namespace]/polytone/creative_tab_modifiers/[some name].json
(Any path will work but this is recommended to avoid overwriting Implicit defined targets).
Then you can add the targets
field to the json containing a list of valid Dimension ids as follows:
{
"targets": ["minecraft:combat", "minecraft:building_blocks"]
}
Here are all the parameters that you can include in your modifier. All fields are optional
field | explanation |
---|---|
icon |
An ItemStack. Will modify the tab icon |
can_scroll |
If tab can scroll or not |
show_title |
If tab has a title or not |
name |
A Component. Tab name |
removals |
A list of Item Predicates (see below) that will determine which items to remove |
additions |
A list of Item Additions (see below) that will determing which items to add |
targets |
A list of IDS to use for explicit targeting |
Here's an example of how a basic modifier could look
{
"removals": [
{
"type": "tag_match",
"tag": "swords"
}
],
"additions": [
{
"items": "minecraft:diamond"
}
]
}
The removals
block contains a list of Item Predicate objects.
Each predicate is essentially a Tester that returns True or False when queried with an item. These are used to determine WHICH item to target (in this case remove)
Each Item Predicate has the following syntax:
field | explanation |
---|---|
type |
The type of the predicate |
[value] |
The value(s) of the predicate. Each predicate type has its own and are listed below |
Here's a list of all the types you can use:
predicate name | value(s) | explanation |
---|---|---|
or |
predicates . A list of Item Predicates objects |
Returns true if just one of its predicates is true |
all |
predicates . A list of Item Predicates objects |
Returns true if all of its predicates are true |
not |
predicate . A single predicate object |
Returns true if that predicate is false |
tag_match |
tag . An item tag |
Returns true if an item belongs to that tag |
items_match |
items . A list of Items |
Returns true if an item is contained in that list |
itemstack_match |
itemstack . An ItemStack (using vanilla syntax) |
Returns true if an item matches the entire itemstack, this include its nbt |
id_match |
namespace , path . Two Regular Expression strings. Only one is required |
Returns true if the item ID's namespace and path both match those regular expressions |
Here's an example defining a predicate that targets all items that do NOT contain "block" in their name:
{
"type": "not",
"predicate": {
"type": "id_match",
"path": "block"
}
}
The additions
block contains a list of Item Addition objects.
The purpose of each of these is to determine WHICH items to add and WHERE to add it to.
An Item Addition object has the following syntax:
field | explanation |
---|---|
items |
A or a single of either an Item or an Itemstack to be added to the Tab |
before |
Optional, Boolean. Wether to add these items before or after the items targeted by predicate
|
predicate |
Optional. An Item Predicate (explained above). Determines before or after which item these items will be added |
As you can see the Item Predicate object from before was reused here. Check it out above.
If predicate
is left out, the items will be added at the end of the tab.
Here's an example of some items added after the Iron Axe item
{
"items": [
"iron_shovel",
"iron_sword"
],
"before": false,
"predicate": {
"type": "item_match",
"items": [
"minecraft:iron_axe"
]
}
}
The icon
field takes a single itemstack.