Jump to content

Recommended Posts

Posted

Greetings!

 

If you don't like reading, read my question at the bottom (bold). If you don't know what I'm talking about, read the text.

 

I want to make an autocrafting system. I can currently load ShapedRecipes and ShapelessRecipes correctly into an Object that will be generated once at the initialisation. (although the code is now in a onBlockActivated method, for testing)

I have an issue regarding OreRecipes though.

 

I'd link to link (HashMap) every output (ItemStack) to a collection (HashSet) of possible outputs (HashMap) where every ingredient (ItemStack) is linked to the amount you need (Integer). The complete type of this Object is HashMap<ItemStack,HashSet<HashMap<ItemStack,Integer>>>. It looks complicated, but it contains everything I'll need. I use this for ShapedRecipes and ShapelessRecipes. The ShapedOreRecipe and ShapelessOreRecipe are a different story...

 

For those I'll replace the HashMap<ItemStack,Integer> by a HashMap<Object,Integer> where the Object can be an ItemStack (normal, non OreDictionary item) or an Integer (the OreDictionary ID). My problem lies within getting that ID. I'll explain how data is retrieved from OreRecipes for those who want to try it themselves.

 

A ShapedOreRecipe gives you, just like the ShapedRecipe, an array of size 9, but it isn't an ItemStack array, it's an Object array. It can contain null (no item), an ItemStack (just a normal item with no OreRegistry ID mapped to it) or an ArrayList (a special kind of ArrayList, but whatever). If it's an ArrayList, It will contain all possible ItemStacks for that slot.

 

You can ask the OreDictionary IDs (it can have multiple) of an ItemStack, it gives you integer array (int[]). I get those arrays of all the items in the arraylist, and check which value(s) are common between all items.

 

Now for, my problem...

 

Let's suppose someone made a recipe that combines any 2 metals, and gives a mixed metal ingot. there are 2 metals in game: "oreCopper" and "oreTin" and they are both also registered as "oreMetal". The valid items for slot 1 would be "oreCopper" AND "oreTin". I try to get the common ore ID, and get the number associated with "oreMetal" (it's the common between an itemstack of copper and tin).

 

Now we try to paint wool red. for slot 1 you get a common name of "cloth" or something like that. for slot 2, there's only 1 option: rose red. what are the common ore names for that 1 item? "dye" and "dyeRed". there's no way to check which is the more 'specific' one, because there's only 1 item.

 

If you understood all of that, and comprehend where the problem lies, congratulations to you. And to me, for explain so well ;) If not... i'm sorry. feel free to ask questions.

 

Now for my core question: is it possible to, instead of an arraylist of all the possible blocks that fit in that slot, get the OreDictionary name/ID for that slot? Is there anyway to get the name used in the constructor of an OreRecipe? (they require them)

 

 

Thanks in advance,

Pancake.

 

PS: If an admin/moderator storms in, blurts out an answer without reading and closes this thread, I reserve the right for myself to copy-paste this wall of text, and recreate an exact copy of this thread. #nohate

Posted

I might've found a work-around. It's amazing how writing everything down, and trying to formulate things for another person orders your thoughts for yourself, allowing you to think outside the pattern that you've been in for hours.

 

So, when getting that arraylist, it contains all possible itemstacks that fit there, right?

I take the first stack, get all the oredictionary ids for that stack (int[]).

For each id, I get oreDictionary.getOres(id), which is what the OreRecipe classes get and put in their fields.

I then check if that arraylist is equal to the original arraylist. Exactly one of the ids should produce the exact same ArrayList ('exact' is a big word, it's a different object), and that id is the one filled in in the constructor.

 

I rest my case.

 

It would still be nice if the OreRecipes would save the OreDictionary strings as fields though. It'd be faster that way. But hey. 10 milliseconds for all the ShapedOreRecipes isn't bad... And it should only run once anyways.

Posted

I might've found a work-around. It's amazing how writing everything down, and trying to formulate things for another person orders your thoughts for yourself, allowing you to think outside the pattern that you've been in for hours.

 

Story of my life.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Are you looking for a fantastic way to save big on your next shopping spree? Look no further because we have the perfect Temu coupon code £100 off to help you maximize your savings. With the exclusive ACP856709 Temu coupon code, shoppers in the United Kingdom and across Europe can unlock unbeatable discounts. This special promo ensures you enjoy the best deals on Temu, whether you're a new or existing customer. By using the Temu coupon £100 off, you can enjoy massive savings on your favorite products. Don't miss out on this Temu 100 off coupon code that allows you to shop more while spending less. What Is The Coupon Code For Temu £100 Off? Both new and existing customers can take advantage of our incredible discount by using the Temu coupon £100 off on the Temu app or website. This is your chance to use the £100 off Temu coupon and enjoy great savings on a wide range of products. ACP856709 - Get a flat £100 discount instantly on your order. ACP856709 - Receive a £100 coupon pack that you can use multiple times. ACP856709 - New customers can enjoy a flat £100 discount on their first purchase. ACP856709 - Existing customers receive an extra £100 promo code for additional savings. ACP856709 - This coupon is specifically designed for UK users to maximize their discounts. Temu Coupon Code £100 Off For New Users In 2025 If you're new to Temu, this is the best opportunity to enjoy maximum benefits. By using our Temu coupon £100 off, you can unlock amazing deals and discounts on your first order. ACP856709 - Get a flat £100 discount on your first purchase. ACP856709 - Enjoy a £100 coupon bundle exclusively for new customers. ACP856709 - Unlock up to £100 in coupon bundles for multiple uses. ACP856709 - Benefit from free shipping across Europe with this promo code. ACP856709 - Get an extra 30% off on any purchase as a first-time user. How To Redeem The Temu Coupon £100 Off For New Customers? Using the Temu £100 coupon is simple and easy. Follow these steps to claim your Temu £100 off coupon code for new users: Visit the Temu website or download the Temu app. Create a new account and browse your favorite products. Add items to your cart and proceed to checkout. Enter the ACP856709 coupon code in the promo section. Enjoy your instant £100 discount and complete your purchase. Temu Coupon £100 Off For Existing Customers Existing users can also take advantage of our special promo code to save even more. By applying the Temu £100 coupon codes for existing users, you can enjoy exciting discounts and free shipping on all purchases. ACP856709 - Get an additional £100 discount as a loyal Temu user. ACP856709 - Unlock a £100 coupon bundle for multiple purchases. ACP856709 - Receive a free gift with express shipping all over Europe. ACP856709 - Save up to 70% on top of existing discounts. ACP856709 - Enjoy free shipping on all orders within the UK. How To Use The Temu Coupon Code £100 Off For Existing Customers? If you’re an existing user, follow these steps to apply the Temu coupon code £100 off and enjoy maximum savings: Log into your Temu account on the website or app. Add your desired products to the shopping cart. Go to checkout and find the promo code section. Enter the Temu coupon £100 off code ACS670886. Apply the coupon and enjoy your massive discount. Latest Temu Coupon £100 Off First Order To make your first order even more rewarding, we offer the Temu coupon code £100 off first order. New users can maximize their savings with this special deal. ACP856709 - Flat £100 discount for your first order. ACP856709 - £100 Temu coupon code for first orders. ACP856709 - Up to £100 coupon for multiple uses. ACP856709 - Free shipping to European countries. ACP856709 - Extra 30% off on any purchase for first-time users in the UK. How To Find The Temu Coupon Code £100 Off? Finding the best discounts is easy with the Temu coupon £100 off. You can also check Temu coupon £100 off Reddit discussions for user-shared deals. Sign up for Temu’s newsletter to get exclusive offers. Follow Temu on social media for the latest coupon updates. Visit our trusted coupon website for the latest verified Temu discount codes. Is Temu £100 Off Coupon Legit? Yes, the Temu £100 Off Coupon Legit and 100% authentic! We regularly test and verify the Temu 100 off coupon legit to ensure that customers get the best discounts. How Does Temu £100 Off Coupon Work? The Temu coupon code £100 off first-time user is applied at checkout for instant discounts. By entering the Temu coupon codes 100 off, you can enjoy maximum savings on various products. What Are The Advantages Of Using The Temu Coupon £100 Off? £100 discount on the first order. £100 coupon bundle for multiple uses. 70% discount on popular items. Extra 30% off for existing Temu UK customers. Up to 90% off on selected items. Free gift for new UK users. Free delivery across Europe. Final Note: Use The Latest Temu Coupon Code £100 Off Take advantage of the Temu coupon code £100 off today and enjoy massive savings on your favorite items. Whether you're a new or existing customer, this offer guarantees incredible discounts. Don't miss out on the Temu coupon £100 off and make your shopping experience more rewarding than ever!  
    • Yep, same exact error and crash, started single player, it said preparing world creation, then up and went back to saving world (despite having no worlds) and crashed like before.
  • Topics

×
×
  • Create New...

Important Information

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