Jump to content

Cookiehook

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by Cookiehook

  1. That'd do it, thanks! I knew the Minecraft was obfuscated, just didn't put two and two together here. As to code quailty, I've not been proud of this code for a while, I know it's got a lot of problems, the most of which being I'm learning how to use Forge through YouTube tutorials, so there's a quite an amount of strange code that I really don't like. Thanks for the feedback, I'll be taking all of these into my code, and reading into the Forge docs to properly understand how to use proxies. The only real rebuttal I want to make is regarding exception handling. I know full well that you shouldn't just throw away exceptions. I've intentionally thrown them away during the dev cycle so I can reproduce and pin them down without having to restart the game every time I hit one. That code would NOT end up in the release.
  2. Here's the log from a server run: https://pastebin.com/NyBqL3ZU I've tweaked the code to also print the stacktrace when this occurs, result: https://pastebin.com/gCziedDe
  3. More information (OP was pre-coffee): The purpose of this getting of private variables is a workaround for using potion's NBT data in crafting recipes, which is not supported by the JSON format. On item initialisation, the ItemPotionArmor's material, slot and potion name are added to a dictionary, using these concatenated strings as a key, and the instance of the ItemPotionArmor as a value. This dictionary is later used by the ShapedArmorUpgradeRecipe crafting recipe class. Once it has confirmed that the right vanilla items are present in crafting grid, it takes the previously mentioned values from the vanilla armor / potions in the grid, concatenates them together, and retrieves the relevant ItemPotionArmor instance to pass back as a result. The ModItems.getMaterialName is called during item initialisation, in the preInit stage of mod loading. You can see the exceptions being thrown and printed in the server logs at this time. It is also called again when the final item in the recipe is placed in the crafting grid. To test, I've been using standard fire resistance potions and any armor piece.
  4. Hello all, I've written a couple of methods that use reflection to access private variables from ItemArmor, as their getter methods have been marked as ClientSide only, and don't work on dedicated servers. Line 96: https://github.com/Cookiehook/Minecraft-Liquid-Enchanting/blob/MC-1.12.2/src/main/java/com/cookiehook/liquidenchanting/init/ModItems.java I'm writing my code using Jetbrains IntellliJ. When I run this code through the IDE, everything behaves as intended. Yet when I build the mod (using gralde build) and run the compiled JAR through a Forge server, I get NoSuchField exceptions thrown. I'm honestly baffled by this. Can anyone help me understand why the two versions are behaving differently? Cross-posted to MinecraftForum: https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/modification-development/2941131-compiled-mod-throws-exception-yet-works-fine-from
×
×
  • Create New...

Important Information

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