[1.17] Changes to items' tags not being applied in-game
Vichoriz0 opened this issue ยท 5 comments
Issue description
I tried to add and remove items from different tags using item.tags
event, but the scripts didn't work and nothing got added nor removed.
What happens:
Nothing. The log shows no errors related to that script and the changes written on the script weren't applied in-game.
What you expected to happen:
Items specified on the script being added and removed from the tags in-game. For example, the item above should include
#fabric:tools
, #fabric:tools/knives
, #farmersdelight:tools/knives
and #farmersdelight:straw_harversters
, and also have #fabric:swords
removed.
Script
The script is named tags.js
and it's located in kubejs/server_scripts
onEvent('item.tags', event => {
['copper', 'diamond', 'flint', 'golden', 'iron', 'netherite'].forEach(material => {
if( material === 'copper' || material === 'flint') {
event.get('fabric:tools').add(`earlygame:${material}_knife`);
event.get('fabric:tools/knives').add(`earlygame:${material}_knife`);
event.get('farmersdelight:tools/knives').add(`earlygame:${material}_knife`);
event.get('farmersdelight:straw_harvesters').add(`earlygame:${material}_knife`);
}
if( material !== 'copper' ) {
event.get('earlygame:knives').add(`farmersdelight:${material}_knife`);
}
event.get('fabric:swords').remove(`earlygame:${material}_knife`);
});
});
Also tried the syntax shown in the wiki but it didn't work either.
Environment
- Minecraft 1.17
- Fabric Loader 0.11.6
- Fabric API 0.36.0
- Architectury API 2.0.11
- Rhino 1605.1.1-build.23
- KubeJS 1605.3.10-build.9999
KubeJS server log
https://pastebin.com/Gd0y0dzu
(I have no idea where those warnings are coming from. I don't even have some of the mods listed there and haven't touched any one of those with my scripts either)
@Vichoriz0 KubeJS 1.17 was released on Alpha and is unsupported. 1.16.5 is the currently long term support version, until 1.18 becomes stable and is migrated to.
Er, we don't currently have any actual 1.17 builds, so I'm interested to know where you got that from honestly :P
@shedaniel angery