shmcrae Posted March 8, 2015 Share Posted March 8, 2015 I was wondering how to make a custom smelting recipe that allows 4 inputs, and say i wanted 4 iron in the first slot and 3 gold in the second and then have it consume all the iron and gold and output a diamond but if i put 7 iron and 4 gold it would only consume he 4 iron and 3 gold. Quote Link to comment Share on other sites More sharing options...
TheGreyGhost Posted March 8, 2015 Share Posted March 8, 2015 You will need to code a custom furnace for that. Here's an example of that for 1.8. 1.6.4 is quite similar. https://github.com/TheGreyGhost/MinecraftByExample (MBE31) -TGG Quote Link to comment Share on other sites More sharing options...
shmcrae Posted March 8, 2015 Author Share Posted March 8, 2015 Ive made a custom furnace called a forge and i made a GuiHandler class, a BlockForge class, a GuiForge class, and a TileEntityForge class, im just stuck on how to create a custom recipe for that and where to put it I haven't actually finished the furnace yet i still have to add things in most the classes but i just wanted to know how to do the recipes GuiHandler: http://pastebin.com/CxTSSH1C BlockForge: http://pastebin.com/kK8Muvjc GuiForge: http://pastebin.com/JJaq6iEC TileEntityForge: http://pastebin.com/VmDvAZRu Quote Link to comment Share on other sites More sharing options...
TheGreyGhost Posted March 9, 2015 Share Posted March 9, 2015 Hi Since your recipes are going to be rather different to the vanilla recipes, probably best to create your own. You could use the vanilla shapeless recipes as inspiration. Perhaps something as simple as FourInputFurnaceRecipe with eight fields eg public class FourInputFurnaceRecipe private ItemStack input1; // type of Item and the number required private ItemStack input2; private ItemStack input3; private ItemStack input4; private ItemStack output; public ItemStack getOutput(ItemStack slot1, ItemStack slot2, ItemStack slot3, ItemStack 4) { // check each slot against the input to see if item matches and slot contains at least the minimum required # of items. If so, return output, otherwise return null } } -TGG Quote Link to comment Share on other sites More sharing options...
shmcrae Posted March 9, 2015 Author Share Posted March 9, 2015 Thanks, ill give it a try once im finished with all the classes Quote Link to comment Share on other sites More sharing options...
shmcrae Posted March 9, 2015 Author Share Posted March 9, 2015 Im struggling with this can you give me an example of a recipe please, thanks Quote Link to comment Share on other sites More sharing options...
Awesome_Spider Posted March 9, 2015 Share Posted March 9, 2015 Well, if I understand the code TGG gave you, you would probably just call getOutput using the itemstacks in the gui, if that makes any sense. Then in getOutput, you put code to check what item each itemstack is then the quantity, then return the output made as an itemstack, if any. Quote Link to comment Share on other sites More sharing options...
shmcrae Posted March 9, 2015 Author Share Posted March 9, 2015 (This has nothing to do with the recipes) When i open my furnace (also known as the forge) the GUI displays but i cannot pickup items BlockForge: http://pastebin.com/qRUC59Nh GuiForge: http://pastebin.com/wNCeeb7x Quote Link to comment Share on other sites More sharing options...
larsgerrits Posted March 10, 2015 Share Posted March 10, 2015 Show us your container code. Quote Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/ Link to comment Share on other sites More sharing options...
shmcrae Posted March 10, 2015 Author Share Posted March 10, 2015 OK ContainerForge: http://pastebin.com/fdCaNjVC Quote Link to comment Share on other sites More sharing options...
larsgerrits Posted March 10, 2015 Share Posted March 10, 2015 Show us your TileEntity and IGuiHandler. Quote Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/ Link to comment Share on other sites More sharing options...
shmcrae Posted March 10, 2015 Author Share Posted March 10, 2015 TileEntityForge: http://pastebin.com/AEEsYQKw GuiHandler: http://pastebin.com/i1hg0gCc Quote Link to comment Share on other sites More sharing options...
61352151511 Posted March 10, 2015 Share Posted March 10, 2015 Nit Picks if(slot == 0) this.forge.cookTime = newValue; if(slot == 1) this.forge.cookTime = newValue; if(slot == 2) this.forge.cookTime = newValue; if(slot == 3) this.forge.cookTime = newValue; Why not if (slot >= 0 && slot <= 3) this.forge.cookTime = newValue; Also the reason it's not working probably has something to do with you checking the vanilla furnace recipes rather than the ones you registered. ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]); Make your own class for registering your recipes, keep them in an ArrayList (I'd assume) and then check that array list Quote Link to comment Share on other sites More sharing options...
shmcrae Posted March 10, 2015 Author Share Posted March 10, 2015 Don't i need to do all the slots though? because slots 0-3 are all the input slots. and also i still don't know how to create a custom recipe i know i have to see if the itemstack matches the slot but i just don't know how to write it out and how to check the amount that is in the slot Quote Link to comment Share on other sites More sharing options...
61352151511 Posted March 10, 2015 Share Posted March 10, 2015 If you don't realise that if (slot >= 0 && slot <= 3) this.forge.cookTime = newValue; Has the exact same functionality of if(slot == 0) this.forge.cookTime = newValue; if(slot == 1) this.forge.cookTime = newValue; if(slot == 2) this.forge.cookTime = newValue; if(slot == 3) this.forge.cookTime = newValue; And if you don't know how to write out code for what you want to do, you need to learn some java. We can give tips on how to do it (I.E saying what you already know, check if the item matches and the amount in the slot) but we won't write the code for you. It's actually quite simple to do, take a look at how vanilla recipes are stored. Quote Link to comment Share on other sites More sharing options...
shmcrae Posted March 10, 2015 Author Share Posted March 10, 2015 Yeah i know that your not gonna do it for me but the vanilla code doesn't have a recipe for 4 input slots and doesn't check if theres a certain amount, and also when i open my gui i can't move items Quote Link to comment Share on other sites More sharing options...
shmcrae Posted March 14, 2015 Author Share Posted March 14, 2015 sooo anybody??? Quote Link to comment Share on other sites More sharing options...
61352151511 Posted March 14, 2015 Share Posted March 14, 2015 Quick example code public ItemStack[] in; public ItemStack out; public MultiSmelt(ItemStack[] in, ItemStack out) { this.in = in; this.out = out; } Now you have recipes, the ItemStack's can store the stack size. Simple make an array list with multiple of these recipes, then whenever the furnace updates check through the recipes, check to see if there is a recipe with the items in the furnace and if the items in the furnace have a stack size more than or equal to the stack in the "in" list. If so, smelt it to the "out" item. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.