Jump to content

Recommended Posts

Posted

Hey,

Just a little intro - I'm a graduating Computer Science Major with an avid love of Minecraft, and am picking up Modding one of my all time favorite games.

 

While I was attempting to create specific recipes for different purposes, I realized that I would have to copy-paste the existing Recipe Manager, or create my own class to manage recipes, if I only wanted them craftable from certain block containers. 

 

Long story short, I created a few modifications to the original CraftingManager that, instead of maintaining a singular RecipeList, changes it to managing an arbitrary number of different Lists, mapped by keys.  I only added methods, and all existing methods use a default key of "minecraft", which allows this to be dropped in as a replacement for the CraftingManager class and continue to have it work as advertised.

 

I'm not sure how useful others will find it, but I found it added quite a bit of functionality without breaking anything existing, and with only a small bit of code.  Also, having the ability to have separate crafting lists is something I feel Forge should support 'out of the box'.

 

Code is as follows:

https://gist.github.com/Itszuvalex/7409109

Posted

Meh, there really isnt much need for a special wrapper around an array list. The functionality is fairly basic, just a couple of loops over the list.

Also, a note about your implemnetation:

1) It breaks compatibility with anyone who reads the list from the field.

2) It should of been submitted in a Pull request

3) Please be a bit more efficient in your implementation. Only one lookup is needed. A single map.get(key) instead of hasKey, get, put, over and over.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Fair enough.  I only threw this together in a couple hours and figured it was more of a reference to what I was talking about than a final code structure (as I am barely beginning Java).

 

 

Will do as you suggested.

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.

Announcements



×
×
  • Create New...

Important Information

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