Posted March 12, 201312 yr I am wondering if anyone knows how to make smelting something have a bi-product. like i smelt say, iron ore, with coal, and as a result the iron ore becomes iron, but also the player is given a item. kinda like a dual output furnace i geuss
March 12, 201312 yr This is not easy. First understand how a furnace work. Then the explaining will be easier. Its a thing with an arraylist with 3 ItemStacks (1 input, 2 output) and then you have to extrackt them in the furnace. The rest is esay! But the Extracktion of the arraylist is not so easy! I have no clue how this work (at the moment. And i do not working with that.) But now you have a clue how this work. My Hints: Read the FurnaceTileEntity Try to understand how the smelting thing works. Look in opensource Mods which have furnaces in it. Because this will help a lot. Sources that helped me: IC2, RP2, Forestry(alot), Obsidian Ingots(Alot with multitile), Universal Electicty Addons. Try to build yourself a furnace. Than make try and error that is a good way to learn things. I know that does not help a lot at the moment but this is what i think will help. @Speiger
March 12, 201312 yr Do you mean if you smelt something in a vanilla furnace (f.e. Iron Ore), you get an Item (f.e. Stone) added to your inventory?
March 12, 201312 yr Author Yes exactly. i have uranium which can be used as a full, and when its used to smelt things i want it to "decay" into plutonium, so add a plutonium ingot to by inventory
March 12, 201312 yr Then try using a CraftingHandler. Put this in your load method: GameRegistry.registerCraftingHandler(new CraftingHandler()); Class CraftingHandler: public class CraftingHandler implements ICraftingHandler{ @Override public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) { } @Override public void onSmelting(EntityPlayer player, ItemStack item) { if(item.itemID == Item.ingotIron.itemID){ player.inventory.addItemStackToInventory(new ItemStack(Block.stone, 1)); } } } This will give you one stone if you pick up a iron ingot from the output stack of a furnace. Hope it helped
March 13, 201312 yr Slagfurnace vs craftinghandler I think make your own furnace would be better because with craftinghandler you can only per 1 item 1 extra drop. But with a slagfurnace (i know the name is out of factorisation.) you can make for every recipe a extra drop. like: Iron ore = iron ingot + stone iron dust = iron ingot + whatever mixed metall ingot (my version) = iron ingot + bronze ingot. That is the difference between make your own furnace and craftinghandler. If you only want add stone to ores the craftinghandler is the best way. but if you want like differend extra outputs on the same output than the extra furnace is better!
March 13, 201312 yr Author Thanks to both of you! for the time being im going to take the easy way out and use the crafting handler, but as my mod progresses i think i will go the custom furnace route. Thanks!
March 13, 201312 yr I think make your own furnace would be better because with craftinghandler you can only per 1 item 1 extra drop. Just use this: player.inventory.addItemStackToInventory(new ItemStack(Block.stone, item.stackSize)); It will give you as many items as you smelted But with a slagfurnace (i know the name is out of factorisation.) you can make for every recipe a extra drop. CraftingHandlers can do that too, just add multiple if statements. Also if you want to give multiple items, just use the player.inventory.addItemStackToInventory function multiple times with different items. I also think that making a custom furnace is better, but as a temporary solution the CraftingHandler should work fine.
March 13, 201312 yr I think make your own furnace would be better because with craftinghandler you can only per 1 item 1 extra drop. Just use this: player.inventory.addItemStackToInventory(new ItemStack(Block.stone, item.stackSize)); It will give you as many items as you smelted But with a slagfurnace (i know the name is out of factorisation.) you can make for every recipe a extra drop. CraftingHandlers can do that too, just add multiple if statements. Also if you want to give multiple items, just use the player.inventory.addItemStackToInventory function multiple times with different items. I also think that making a custom furnace is better, but as a temporary solution the CraftingHandler should work fine. first of all can you make it like this? if(furnacerecipes == ironore) { additemstack(stone) } elseif(furnacerecipes == mixedmetallingot) { additemstack(bronzeingot) } and i mean you can only one drop per item (like this) if(item == ironingot) { give stone } but you can not make an elseif with iron ingot. Because you can not detect which recipe was the last he used. when the same is the output but the drops are differend.
March 13, 201312 yr first of all can you make it like this? if(furnacerecipes == ironore) { additemstack(stone) } elseif(furnacerecipes == mixedmetallingot) { additemstack(bronzeingot) } and i mean you can only one drop per item (like this) if(item == ironingot) { give stone } but you can not make an elseif with iron ingot. Because you can not detect which recipe was the last he used. when the same is the output but the drops are differend. Yes you are right with this, you only can give an item based on the output of the furnace, not the input. If you ment that earlyer, then im sorry that i misunderstood you. This shouldnt be a problem though as long as he only has one recipe for the item he is using the crafting handler for, or all the recipes for that item are ment to give you an extra item.
March 13, 201312 yr Yup i meant it. I saw it on railcraft codes he is useing the crafting the carts back .
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.