January 3, 20169 yr So, I would be doing this? File json = new File("/assets/MyFile.json"); And, that's what I was thinking. I meant as an interface other mods can implement into their items if they so choose. Then, when running through the entire ItemRegistry (which I believe contains every block and item from every mod loaded?) if said item implements my IWeightedItem, add the weight. If it doesn't, add the item to the json, and give it a weight of 0.0F. I am also guessing I would have to run the json creator in post, so all mod items are loaded, and I don't miss any. No. File must be located in config directory with other configs. So config/MyFile.json . And better would be grabbing modConfigurationDir() from pre init. Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
January 3, 20169 yr Author Hm, alright. I'm not really sure why considering it doesn't correspond with configs though (as in, I am not using the Minecraft config manager). One last question, is it safe to create the json in post? Or, will that cause problems? I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
January 3, 20169 yr Author Alright, I tried this to test it: File jsonFile = new File("/assets/utils/WeightLimit.json"); JsonReader reader = new JsonReader(jsonFile); And, it says "jsonFile is undefined, change type to Reader?" which I am not seeming to understand. I know it can't take File, but is it suppose to? I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
January 3, 20169 yr Not to be rude, but have you considered actually learning how to use JSON? Any basic tutorial will give you proper introduction and rest can be easily found in docs or receive better help on StackOverflow. I am not saying anything bad but really - learn and understand is much better than "do this, do that". Might even come in handy if you'd ever expand outside MC. Please look into docs. As to current problem, you might want to use factory methods or actual Reader. 1.7.10 is no longer supported by forge, you are on your own.
January 3, 20169 yr Author Not rude at all, I completely understand where you're coming from. Could you point me to some docs or tutorials? The ones I found seemed to be outdated, I mean, they never even mentioned a JsonReader. I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
January 3, 20169 yr So it expects a Reader, but you have a File. Maybe there exist something like FileReader (hint: it does...)? Try looking a bit better in the future. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
January 4, 20169 yr Hm, alright. I'm not really sure why considering it doesn't correspond with configs though (as in, I am not using the Minecraft config manager). The config folder is a Forge thing not a vanilla thing. And just because you're using json not .config doesn't mean it isn't a config file. Add to that the fact that the /assets directory doesn't exist when you distribute your mod. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 4, 20169 yr Also, just to note, .json extension is not compulsory for gson to read. Internal structure is important. But using .json extension just makes users not that confused. As to code that i posted, it was pseudo code, to help you figure basics and how to encode maps (it's not always needed to use type tokens with gson). Also, as everybody said, now that you know what to use, learn how to use it. Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
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.