KubeJS (Old)

KubeJS (Old)

3M Downloads

Changing block tags by targeting other tags doesn't seem to work

DaeTheDerg opened this issue ยท 2 comments

commented

Minecraft Version

1.20.1

KubeJS Version

2001.6.4-build.138

Rhino Version

2001.2.2-build.18

Architectury Version

9.2.14

Forge/Fabric Version

NeoForge 47.1.101

Describe your issue

ServerEvents.tags('block'... does not seem to allow the use of tags to identify targets.

This script works as expected, changing the tool requirement of copper ore:

ServerEvents.tags('block', event => {
  event.remove('minecraft:needs_stone_tool', 'minecraft:copper_ore')
  event.add('forge:needs_wood_tool', 'minecraft:copper_ore')
})

This script does not seem to work as expected; despite the wiki saying that tags can be added through other tags, no changes are made to any blocks with the #forge:ores/copper tag:

ServerEvents.tags('block', event => {
  event.remove('minecraft:needs_stone_tool', '#forge:ores/copper')
  event.add('forge:needs_wood_tool', '#forge:ores/copper')
})

Crash report/logs

No response

commented

Looks like it is working as intended.
When you add/remove something to a tag, you do to the tag, not to items inside the tag.
If you want to expand the tag you do Block.getTaggedIds("forge:ores/copper") or event.get('forge:ores/copper').objectIds instead

ServerEvents.tags('block', event => {
  let copperOres = event.get('forge:ores/copper').objectIds
  event.remove('minecraft:needs_stone_tool', copperOres)
  event.add('forge:needs_wood_tool', copperOres)
})
commented

Hiya!! thanks for the information, that works!
I had tried to figure out why this wasn't working the past couple days & couldn't find this information on the wiki, perhaps it's just me but maybe there could be some clearer guidance to explain this difference between block & item tagging?
As it is the wiki only gives a single example, which it doesn't even explain, which doesn't seem very intuitive!