I followed a tutorial off of youtube to build a custom furnace that has 2 inputs. I made 1 of the inputs be for casts and the other be for the metal to cast. I want to be able to set the amount of metal necessary for casting, but everything I have tried on my own has not worked. The furnace works in every other way, it just always takes only one item and won't wait until there is more than one item. Any help would be greatly appreciated.
I have to admit that my experience with custom furnaces is limited, but I will try to help you. Did you add the the inputCount variable in the ForgeRecipes class in an attempt to fix your problem? It will not work, because inputCount is static and there only exists one, but you need an inputCount for every recipe. What I would do is create a new Map, which maps from Item to count. Then you fill this map in addForgeRecipe(), just like the other Maps. And last, in canSmelt() you check if the inserted item has a higher (or equal) count that specified in the Map.
Are you meaning using a new hashmap? Cause if so I'm 98% sure I can set that up properly, I'm now just confused about how to get it to check in canSmelt(). I'll try messing around and see what I can do though. Thanks!
Are you meaning using a new hashmap? Cause if so I'm 98% sure I can set that up properly, I'm now just confused about how to get it to check in canSmelt(). I'll try messing around and see what I can do though. Thanks!
Yes exactly, a hashmap. Then you could add a method in ForgeRecipes similar to getForgeExperience() (but returns a count instead of course), which you could use in canSmelt() to check if the inserted item count is high enough.
I've updated the github with my attempts, I don't have any language errors so I'm pretty sure I got it working in ForgeRecipes but I must have messed something up in TileEntityForge because It is checking for 2 items before smelting and removing two every time and not actually taking the count that I added.
Hmm, I see no obvious errors in the code. I think your best bet is to use the IDE debugger and/or insert print statements to debug the code to see where the error is.
Well, after troubleshooting and googling lots about maps and hashmaps, I decided I was confusing myself and decided to mess around with some if statements and figured out away. It's not pretty, and I would definitely like to fix it and make it look a little better, but for now, it works and that's what I need. If you want to check, all the code is in my TileEntity class. Thank you so much for all the help!
I followed a tutorial off of youtube to build a custom furnace that has 2 inputs. I made 1 of the inputs be for casts and the other be for the metal to cast. I want to be able to set the amount of metal necessary for casting, but everything I have tried on my own has not worked. The furnace works in every other way, it just always takes only one item and won't wait until there is more than one item. Any help would be greatly appreciated.
All Files Used for Furnace
I have to admit that my experience with custom furnaces is limited, but I will try to help you. Did you add the the inputCount variable in the ForgeRecipes class in an attempt to fix your problem? It will not work, because inputCount is static and there only exists one, but you need an inputCount for every recipe. What I would do is create a new Map, which maps from Item to count. Then you fill this map in addForgeRecipe(), just like the other Maps. And last, in canSmelt() you check if the inserted item has a higher (or equal) count that specified in the Map.
Are you meaning using a new hashmap? Cause if so I'm 98% sure I can set that up properly, I'm now just confused about how to get it to check in canSmelt(). I'll try messing around and see what I can do though. Thanks!
Yes exactly, a hashmap. Then you could add a method in ForgeRecipes similar to getForgeExperience() (but returns a count instead of course), which you could use in canSmelt() to check if the inserted item count is high enough.
I've updated the github with my attempts, I don't have any language errors so I'm pretty sure I got it working in ForgeRecipes but I must have messed something up in TileEntityForge because It is checking for 2 items before smelting and removing two every time and not actually taking the count that I added.
Hmm, I see no obvious errors in the code. I think your best bet is to use the IDE debugger and/or insert print statements to debug the code to see where the error is.
Well, after troubleshooting and googling lots about maps and hashmaps, I decided I was confusing myself and decided to mess around with some if statements and figured out away. It's not pretty, and I would definitely like to fix it and make it look a little better, but for now, it works and that's what I need. If you want to check, all the code is in my TileEntity class. Thank you so much for all the help!
I am glad you managed to solve the problem! I might take a peep at your code later to see how you solved it.