Jump to content

[SOLVED] OreDict - Private struggles with ShapedOreRecipe.Input


UberWaffe

Recommended Posts

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]

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

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]

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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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