CraftTweaker

CraftTweaker

151M Downloads

[1.16.5] Crafttweaker claims that existed tags are not existed and prevent tooltips loading

GoldenTotem opened this issue ยท 1 comments

commented

Issue description

In server, if you use a certain tag in the script, crt will give a waring that tag is not existed and prevent the code used to add tooltips loading.

Steps to reproduce

import crafttweaker.api.item.IItemStack;
import crafttweaker.api.item.IIngredient;
import crafttweaker.api.util.text.MCTextComponent;
 
//add a function used for recipe of environmental:sawmill
function addSawmillRecipe(name as string, itemOut as IItemStack, itemIn as IIngredient, quantity as int) as void {
    <recipetype:environmental:sawing>.addJSONRecipe(name, {
        "ingredient": itemIn,
        "result": itemOut.registryName,
        "count": quantity
    });
}
 
//add a function used for adding tooltips to items
function addItemDescription(item as IItemStack, description as string) as void {
    item.modifyTooltip((itemStack, tooltipList, advanced) => {
        tooltipList.insert(1, MCTextComponent.createTranslationTextComponent(description));
    });
}
 
//this line will give a warning("Tag <tag:items:byg:aspen_logs> does not exist, replacing with empty IItemStack") in the log and cause an error, that will prevent the addItemDescription funcion below this line working. If you change the order, make addItemDescription function prioritize execution with addSawmillRecipe function, tooltips will be visible but waring and error will still exist.
addSawmillRecipe("byg.aspen_planks_from_logs", <item:byg:aspen_planks>, <tag:items:byg:aspen_logs>, 4);
 
 
addItemDescription(<item:minecraft:diamond>, "itemGroup.misc");
  • Third, don't enter singleplayer, run a local server and run a client with same mods. Enter multiplayer with ip 127.0.0.1 (means self)
    If this bug is successfully reproduce, you can craft 4 aspen planks in sawmill but no tooltips on diamond. And warning and error will occur in crt client log like this https://mclo.gs/xl0Va4x

This bug have many strange points.

  • Crt log from server side will not give any error, only one error will occur at client crt log.
  • Crt claims that a tag is not existed, but this tag is existed and it comes from mod's inside datapack.
  • Not every mod will have this bug. In the script I use byg as an example, if you replace byg with twilightforest mod and use logs and planks from twilightforest in the script, the bug will still occur. But if you use betterendforge or blue skies mod to replace byg, this bug will disappear, everything is right. I don't think the bug come from those mods.
  • Only multiplayer will have this bug, like server or LAN, if you enter singleplayer world, everything is right.
  • If you enter singleplayer firstly, then enter multiplayer, this bug will disappear.

Script used

see above

The crafttweaker.log file

see above

Minecraft version

1.16

Modloader

Forge

Modloader version

36.2.35 see above

CraftTweaker version

see above

Other relevant information

No response

The latest.log file

see above

commented

I am not sure how no one has reported this issue already, as I can reproduce it.

I believe the issue is with how forge interacts with the vanilla tags, but I am not 100% sure.

1.16.5 is in a "if it is an easy fix that won't break anything, I'll do it" stage, and unfortunately this is not an easy fix, and it has a good chance to break things, so I am going to be closing this issue.

I think you can workaround it by adding an item to the tag it says is empty, but I have not tested that.