UberWaffe Posted November 19, 2012 Share Posted November 19, 2012 I've made a fork of LepkoQQ EasyCraft mod (https://github.com/UberWaffe/EasyCrafting), and in my own capacity I've been trying to add Forge ore dictionary support into it. I looked into "ShapedOreRecipe.java", since I need to grab the list of ingredients a recipe is made up of. I need this in order to be able to do a scan of the player's inventory for the ingredients (or their equivalents). This check in turn determines what easycraft recipes are allowed (you have the stuff needed to craft them). But I've hit a bit of a wall with getting the "private Object[] input = null;" field data, because of that little hiccup in bold. It's private. Which in itself is not an issue, except there is also no function in the class to expose a copy of the data inside the "input" field. A Google search revealed that one can use reflection and other tricks to get access to a private variable, but these seem to be more on the "I'm-hacking-this-to-bits-now" approach. Is there something obvious I am missing, or is there just no allowance made for checking the ingredients for an ore dictionary recipe? I've noted functions for checking if the items in a given crafting grid are equal to the recipe, but this is not entirely what I want. There is no crafting grid... well, at least not in the easycraft mod's easycraft table. [EDIT] I've managed to do all the other coding work for supporting Object[] recipes. (New commit on Github). So I'm going ahead with creating a manual list of ore-dictionary recipes (as sucky as that is), since I do not wish to mess around with java security to get reflection to work for private variables. Still, if anyone knows of a better way, please let me know. I'd love to automatically clone and convert all ore dictionary recipes (i.e. automatic mod support of other mods). [/EDIT] Quote People just can't stay away from me... but that is because I'm so fat I have my own gravitational field. It's the flying cutlery that stresses me out. Link to comment Share on other sites More sharing options...
LexManos Posted November 19, 2012 Share Posted November 19, 2012 .setAccessible(true) Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon Link to comment Share on other sites More sharing options...
UberWaffe Posted November 20, 2012 Author Share Posted November 20, 2012 If the reflection method is the prescribed one, then cool. I'll use it. Thanks for the reply. [EDIT] Reflection working fine. Ore dictionary support tested and working. Thanks for the help. [/EDIT] Quote People just can't stay away from me... but that is because I'm so fat I have my own gravitational field. It's the flying cutlery that stresses me out. Link to comment Share on other sites More sharing options...
Recommended Posts
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.