Jump to content

[1.8][Solved]Custom functional block not correctly converting items


The_Fireplace

Recommended Posts

I have been working on this feature of this mod for 5 hours straight now, first coding the function to process the items, then adapting code to make it all work, then finding and fixing issues with it. Now, I have hit one (hopefully final) issue that I just cannot figure out: When I put an item in the top slot and activate the redstone, the output stack is the wrong damage, and the stack size is 0(the number is in the normal spot for stack size, and it is a red 0). Example: I put 1 glass in the input slot, activate the redstone, and open the inventory, and sitting in the output slot is a stack of 0 Red Sand(it should be 1 regular sand)

Seeing as this probably isn't a simple fix, I am, once again, temporarily making my repository public for you to access, fork, and clone, if it will help you solve the problem.

Anyways, my code:

TileEntityPopFurnace

BlockPopFurnace

PopFurnaceRecipes

Any help is appreciated.

EDIT:

They are now outputting the correct amount, but the data values are getting set to 0.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Link to comment
Share on other sites

Ok, i don't know why you ate having the problem your seeing, but you have a huge amount of pointless ItemStack creation.

 

You get the result item twice (causing two lookups which have O(n) time; also the advantage of a hash map is lost by iterating over the key-value pairs this way,  but item stacks don't override hashcode, so your kind of stuck with this method, so look up the result once), so you can create a new stack with the same item and metadata (rather than cloning the stack). And you do the same thing when registering your recipes, creating a new stack from the parameter, rather than cloning.

 

You also don't need a separate HashTable for the output size: you can quite easily store that as the first hash's value-stack's size.

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.

Link to comment
Share on other sites

Strangely enough, this fixed it...

ILmAmtj.jpg

 

EDIT: the metadata is still wrong on some Items, I am looking in to it right using breakpoints right now.

EDIT 2: it seems that before, the data values were being set to the number of items to be output per input, and now, they are getting set to 0.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Link to comment
Share on other sites

Uh...

ItemStack(item, count, meta)

?

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.

Link to comment
Share on other sites

Uh...

ItemStack(item, count, meta)

?

I know, I just realized that when looking through my code and came back here to mark this as solved. I could've sworn it was (item, meta, count) at one point, but looking now, it isn't.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

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