Posted May 12, 20169 yr My mod requires localization based on JSON files. I am going to go about this by having a subfolder under assets/myMod which contains more subfolders named after the languages (IE: en_US), which the contains a load of different json files. The JSON files are loaded whenever the language is changed and stored somewhere, allowing for localization whilst giving me more power to customize the content of what I am loading.
May 12, 20169 yr Did you have a question or problem? Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 12, 20169 yr Author Did you have a question or problem? I forgot that! How can I do this? There isn't a "language changed" event.
May 13, 20169 yr Author Why do you need these JSON files? Why can you not use the normal language system? Its for a sort of book, and the information that it contains is quite complex, with text where some lines can have their own font, it can display images, crafting and furnace recipes in the middle of pages and some lines, paragraphs, images, etc can be disabled/enabled by some arbitrary conditions. This is what a typical file could contain: { "title": "This is the title of the page", "tooltip": "This is viewed when hovering over the title in the selection menu", "content": [ { "type": "text", "text": "This is a text fragment." }, { "type": "text", "text": "This renders in the Standard Galactic Alphabet font.", "font": "sga" }, { "type": "itemname", "item": "minecraft:pickaxe", "meta": 0 }, { "type": "item", "item": "minecraft:pickaxe", "meta": 0, "nbt": { "display": { "name": "name" } } }, { "type": "crafting_table", "item": "minecraft:pickaxe" }, { "type": "furnace", "name": "minecraft:iron_ingot" }, { "type": "image", "location": "minecraft:textures/environment/end_sky" } ] }
May 13, 20169 yr Why not have the content JSON be locale-independent and use translation keys for the text? Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 13, 20169 yr Author Why not have the content JSON be locale-independent and use translation keys for the text? Because I had not thought of that, of course!
May 13, 20169 yr Author Is there an event which fires when Resource Packs are reloaded for reloading custom content?
May 13, 20169 yr Is there an event which fires when Resource Packs are reloaded for reloading custom content? It's not an event, but you can implement IResourceManagerReloadListener and register it by calling IReloadableResourceManager#registerReloadListener on the return value of Minecraft#getResourceManager . Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 14, 20169 yr Author Does Minecraft ever use a non-IReloadableResourceManager? Because it doesn't return one.
May 14, 20169 yr The Minecraft#mcResourceManager field returned by Minecraft#getResourceManager is of type IReloadableResourceManager , so it's safe to assume that the method will always return an IReloadableResourceManager . Forge itself makes this assumption in ModelLoaderRegistry#registerLoader . Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 15, 20169 yr Nitpicky, but this isn't an assumption. The method cannot ever return something else, that's what a return type means. The method's return type is IResourceManager , not IReloadableResourceManager . It could theoretically return a completely different IResourceManager implementation (though it doesn't in practice). Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.