Jump to content

captainmk

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by captainmk

  1. I was structuring my code poorly. The event bus that I was using was registered to terraingen because of another feature I was working on, putting it on the proper bus solved it. Thank you, I appreciate the response ?
  2. Hello, I'm a fairly new modder, trying to work with 1.12 config annotations for the first time. Right now I have a working @Config class, and working mod functionality. When the game starts, it correctly loads a boolean from the .cfg, and the mod works as it should. However, when I change the value at runtime via mod options, it does literally nothing from what I can tell. Here's the relevant code snippets: @Config src @Config(modid = Reference.MODID, name = "touchofalpha", type = Type.INSTANCE) public class TOAConfig { @Comment ({ "Classic minecraft sunset where light drops in ticks (DEFAULT: true)" }) public static boolean tickingSunset = true; } Event handler (doesn't seem to do anything) @SubscribeEvent public void configChange(ConfigChangedEvent event) { if (event.getModID().equals(Reference.MODID)) { System.out.println(Reference.MODID + ": Configuration changed"); ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE); } } In the mod I replace the WorldProvider with a custom one, and run the following line in one of the methods: if (TOAConfig.tickingSunset) { // Functional Code Here } Any help would be appreciated. Bonus question: How do you ensure that the config option is strictly loaded from the client and not the server? Will the config loading always default to the server's cfg file? The tickingSunset option only needs to happen on the client.
  3. This is exactly what I was looking for, and infinitely simpler and way more efficient than what I was trying to do. Thank you!!
  4. Hello, first of all I'd like to lay out that I'm a brand new modder who is working on their first mod in 1.12, coming in with at least some amount of basic Java knowledge. I'm trying to add behavior that will negate any damage taken to tools/armor if it is a certain tool material. From what I can tell, there aren't any forge hooks that will fire if an item changes its damage value, so at the moment I only have implemented a block break event that will detect if the mainhand held item is DIAMOND and if so, set the items damage to 0, which works perfectly. So what's the problem? The event handler executes the code and then hands it over to the vanilla methods, which proceed to attempt to damage the item, essentially giving the tool a permanent 1 item damage. I wouldn't mind this since it does indeed make the tool unbreakable, but it also renders the durability bar over the item, which I dislike. Trying to figure out this problem has honestly been a head scratcher, especially since I'm still very new to modding and don't fully understand what Forge is fully capable of yet. I've considered the following options: 1. Somehow cancel the client rendering the durability bar 2. Cancel the block break event and then put in my own implementation so that the tool isn't damaged 3. Every tick check to see if a diamond tool is damaged and then reverse it (Which seems like a very wasteful use of resources) 4. See if a library exists which can handle item durability better (I currently have no idea when to use libraries like Mantle, Bookshelf, Crafttweaker, ect.) 5. Create a custom forge hook that will fire when Item.setDamage() executes (No idea where to even start on this one) Feedback would be a godsend since I've had little luck finding information related to this particular problem
×
×
  • Create New...

Important Information

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