Skip to main content

TagEventJS

Information

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

EventJS

Can be cancelled

No

Fields

Name Type Info
type String Tag collection type 

Methods

Name Return Type Info
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'

TagWrapper class

Fields

Name Type Info

Methods

Name Return 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

Tags

// example

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') })