Devan-Kerman / ARRP

A fabric api for creating resources and assets at runtime
Mozilla Public License 2.0
101 stars 25 forks source link

Problem when adding language resources #11

Closed yuesha-yc closed 4 years ago

yuesha-yc commented 4 years ago

Hello. I created such a method to register language localization for English and Chinese while registering the item.

    private static Item register(String path, String enName, String cnName, String enTooltip, String cnTooltip, Item item) {
        Identifier itemId = new Identifier("elt", path);
        ITEM_RESOURCE.addLang(new Identifier("elt", "en_us"), JLang.lang().translate("item.elt."+path, enName).translate("item.elt."+path+".tooltip", enTooltip));
        ITEM_RESOURCE.addLang(new Identifier("elt", "zh_cn"), JLang.lang().translate("item.elt."+path, cnName).translate("item.elt."+path+".tooltip", cnTooltip));
        return register(itemId, item);
    }

And I register the items:

    static {
        ELT_SYMBOL = register("symbol", "Symbol", "能级跃迁", "", "", new ItemBase((new Item.Settings()).group(ItemGroups_ELT.ELT_MISC)));
        BRANCH = register("oak_branch", "Oak Branch", "橡木树枝", "A branch", "一根树枝", new ItemBase((new Item.Settings()).group(ItemGroups_ELT.ELT_MATERIAL)));
        BRICH_BRANCH = register("birch_branch", "Birch Branch", "白桦树枝", "A branch", "一根树枝", new ItemBase((new Item.Settings()).group(ItemGroups_ELT.ELT_MATERIAL)));
    }

Problem occurs. ARRP seems to be only registering the translation the first item called (in this case is ELT_SYMBOL), leaving the subsequent items unlocalized in game. I noticed other resources like models and blockstates don't have this problem when I register a lot of items/blocks.