TagEventJS
This event is fired when a tag collection is loaded, to modify it with script. You can add and remove tags for items, blocks, fluids and entity types.
Parent class
Can be cancelled
No
Variables and Functions
Name | Type | Info |
type | final String | Tag collection type. |
get(String tag) | TagWrapper | Returns specific tag container which you can use to add or remove objects to. tag parameter can be something like 'forge:ingots/copper'. If tag doesn't exist, it will create a new one. |
TagWrapper class
Variables and Functions
Name | Type | Info |
add(String id) | TagWrapper (itself) | Adds an object to this tag. If string starts with # then it will add all objects from the second tag. |
remove(String id) | TagWrapper (itself) | Removes an object from tag, works the same as add(). |
Examples
// Listen to item tag event
events.listen('item.tags', function (event) {
// Get the #forge:cobblestone tag collection and add Diamond Ore to it
event.get('forge:cobblestone').add('minecraft:diamond_ore')
// Get the #forge:cobblestone tag collection and remove Mossy Cobblestone from it
event.get('forge:cobblestone').remove('minecraft:mossy_cobblestone')
})
Be aware that recipes use item tags, not block or fluid, even if items representing those are. Like minecraft:cobblestone
even if it's a block, it will still be an item tag for recipes.