Jump to content

HappyKiller1O1

Members
  • Posts

    581
  • Joined

  • Last visited

Everything posted by HappyKiller1O1

  1. My God, I am so sorry for being this idiotic! Thank you Lex.
  2. I do know where the config directory method is (the preInit). But, I run through the ItemRegistry to add every item of every mod loaded to this json file. In order to do this, I believe I'd have to create it in postInit, or risk missing some of the items.
  3. So, here is what I am trying to do: I need to create a custom file using the File class within java. Trouble is, I can't figure out how to get the resource directory of Minecraft. Here is my code: public static void createJSON() throws IOException { Gson json = new GsonBuilder().setPrettyPrinting().create(); File jsonFile = new File(whatdoIputhere + "WeightLimit.json"); if(!jsonFile.exists()) { jsonFile.createNewFile(); }else { Writer jsonFileWriter = new FileWriter("/assets/utils/WeightLimit.json"); FMLControlledNamespacedRegistry<Item> itemRegistry = GameData.getItemRegistry(); for(Item item : itemRegistry.typeSafeIterable()) { String name = itemRegistry.getNameForObject(item).toString(); json.toJson(name, jsonFileWriter); //System.out.println(json.toJson(name).toString()); } jsonFileWriter.close(); } } Mainly take a look at where I'm trying to create the file (third line in the method). All I need is the resource directory so I can create the file, but also create it on the server if present. Any help would be appreciated!
  4. 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.
  5. 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?
  6. Hm, that might be your problem. A ghost item means it only spawned on client side. Are you sure you're spawning it on both sides? And you're probably right, just throwing suggestions.
  7. Well, you would honestly have to check for both. Solid blocks would have to be turned into entities before moving. And, everything besides a solid block IS an entity. So, if you want which one takes up less power; it would be the block checker. But, no matter what, you'll need both.
  8. diesieben can help you far more, but why not just spawn each spirit separately? I feel like that for loop is causing the problem.
  9. Both use the same. They both check the same amount of ticks, so they both use the same amount of processing power. Unless of course, you're talking about which one would find less items?
  10. 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?
  11. You made a mistake here: worldObj.createExplosion(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 100F, true); The first param is YOUR entity, if it is null it will not work. If it is in your Entity class put "this" instead of "null". If it is not, get an instance of your Entity class to pass in it.
  12. This: new ItemStack(ItemRegistry.ItemElvenSpirit, 1, sp) You have an amount of 1, and a metadata of a int set in a for loop? Switch those around.
  13. Perfect, thank you guy's so much! Also Dracos - I don't seem to understand why people think you're a jerk? You've been nothing but helpful, and not even blunt about it. So thank you for your time, and thank you Choonster for yours!
  14. 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.
  15. Those are integrated graphics, and you need to go on the Intel website, or check Windows update for an update for your processor.
  16. You need to update your graphics drivers. Do this, by going to your graphics card manufacture's website, and downloading the latest update.
  17. The "jsonFile" you pass in the JsonReader would just be a file I create with InputStream, correct?
  18. My only worry is writing this to the file. If I am writing Items and Blocks at the same time, won't they conflict?
  19. Considering I've never worked with this, could I get a slight example of how to utilize the information you gave me?
  20. Alright so, I have decided to use Gson to add a float value (weight) to every item in the game. Now I was thinking, would it be possible to fill the json with the information by running through the block/item registry, and gathering the unlocalized name of said block or item, along with checking if it implements my IWeightedItem interface. If it does, get the weight value from that and add it to the json; if not, return 0.0F. I feel this would make it easy to gather blocks and items from any mod loaded, and add them to the json. Plus, any mod implementing my interface on their item from my api, would have they values already set. Is this possible? Is there a better way?
  21. Hm, I understand it now, I believe. I would want to make an interface to implement in everyone of another person's items, but that seems quite tedious in my opinion, and might get annoying. Would there be any other good way of making it easy access to add this simple float to another person's mod items?
  22. I'll switch to json then. I used a text file because, while looking through the Journey of Legends source, I found how they use it to implement gold values for their mod. I'd rather not use forge config, as I feel I have a bit more control over a file I create. Thank you though!
  23. If you want to break a block automatically without the server having forge installed, you'd need to send packets from client to server in order to trick the server into thinking you did it (I think). Or, just have some button that sets the MOUSE1 (left click) as held always. Although, you saying it's for "your own Server" doesn't make sense considering you could install forge on your own server.
  24. So, you're trying to make a client only mod that mines for the player? That is actually called "hacking", and is not supported here.
  25. Oh, you should of said that in your post! You can do this easily with World#setBlock. If you want to delete a block, you simply set it to air.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.