Jump to content

[Solved] Furnace Recipe (2 inputs) addRecipe


EarthGuardian

Recommended Posts

hey all im stuck at the recipe for 2 inputs furnace :(

 

old original code:

 

private FurnaceRecipes()
    {
        this.addSmelting(Block.oreIron.blockID, new ItemStack(Item.ingotIron), 0.7F);
        this.addSmelting(Block.oreGold.blockID, new ItemStack(Item.ingotGold), 1.0F);
    }

    /**
     * Adds a smelting recipe.
     */
    public void addSmelting(int par1, ItemStack par2ItemStack, float par3)
    {
        this.smeltingList.put(Integer.valueOf(par1), par2ItemStack);
        this.experienceList.put(Integer.valueOf(par2ItemStack.itemID), Float.valueOf(par3));
    }
/**
     * A metadata sensitive version of adding a furnace recipe.
     */
    public void addSmelting(int itemID, int metadata, ItemStack itemstack, float experience)
    {
        metaSmeltingList.put(Arrays.asList(itemID, metadata), itemstack);
        metaExperience.put(Arrays.asList(itemID, metadata), experience);
    }

    /**
     * Used to get the resulting ItemStack form a source ItemStack
     * @param item The Source ItemStack
     * @return The result ItemStack
     */
    public ItemStack getSmeltingResult(ItemStack item) 
    {
        if (item == null)
        {
            return null;
        }
        ItemStack ret = (ItemStack)metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage()));
        if (ret != null) 
        {
            return ret;
        }
        return (ItemStack)smeltingList.get(Integer.valueOf(item.itemID));
    }

 

 

 

new code:

 

private GemcutterRecipes()
    {
    	this.addSmelting(new ItemStack(Item.appleRed), new ItemStack(Item.goldenCarrot), new ItemStack(Item.appleGold));
    }

    /**
     * Adds a smelting recipe.
     */
    public void addSmelting(ItemStack input1, ItemStack input2, ItemStack output)
    {
    	this.SmeltingList1.put(Arrays.asList(input1.itemID, input1.getItemDamage()), output);
    	this.SmeltingList2.put(Arrays.asList(input2.itemID, input2.getItemDamage()), output);
    	this.SmeltingCheckList1.put(Arrays.asList(input1.itemID, input1.getItemDamage()), input1);
    	this.SmeltingCheckList2.put(Arrays.asList(input2.itemID, input2.getItemDamage()), input2);
    }
public ItemStack getGSmeltingResult(ItemStack item1, ItemStack item2)
    {
    	if(item1 == null){return null;}
    	if(item2 == null){return null;}
    	ItemStack ret = (ItemStack)SmeltingList1.get(Arrays.asList(item1.itemID, item2.getItemDamage()));
        if (ret != null) 
        {
            return ret;
        }
        ItemStack ret2 = (ItemStack)SmeltingList2.get(Arrays.asList(item1.itemID, item2.getItemDamage()));
        if (ret2 != null) 
        {
            return ret2;
        }

    	return (ItemStack)smeltingList.get(Integer.valueOf(item1.itemID));
    }

 

 

now the question is how do i make a recipe file witch uses 2 inputs and 1 output .. i know

the furnace recipe uses Int par1 Itemstack par2Itamstack for par1 as input and parItemStack as output .. and the  float par3 for exp when you get the output stack

 

how can i make a recipe list for 2 input ?? becose what i use the Itemstack item1, ItemStack item2, Itemstack item3 wont work .. the furnace will burn but it keeps the input slots and wont output and keeps doing the burnnig cycle. not consuming the inputslots at all.

 

anny sugestions ??

 

greets

 

the solution:

 

 private CombMachineRecipes()
    {
    	this.addSmelting(new ItemStack(Block.cobblestone), new ItemStack(Block.planks), new ItemStack(ModCore.CobbleScrap,4), 0.7F);
    	this.addSmelting(new ItemStack(Block.planks), new ItemStack(Block.cobblestone), new ItemStack(ModrCore.WoodScrap,4), 0.7F);

    }


    public void addSmelting(ItemStack slot1, ItemStack slot2, ItemStack slot3, float par3)
    {
    	this.SmeltingCombList.put(Arrays.asList(slot1.itemID, slot2.itemID), slot3);
    	this.experienceList.put(Integer.valueOf(slot3.itemID), Float.valueOf(par3));
    }

 

 

this wsnt the only thing that needed a fix also the tile entity needed a small realy small fix (felt stupit when i fount my litle mistake)

 

thx anny way for the litle tips but i found out my selve how it works :)

 

thx !!! :D

Link to comment
Share on other sites

make a new system that accepts 2 input recipe. there nothing in the vanilla smelting recipe system taht you can expand to use 2 items

 

thats my point exacly .. but what im lokking for is litle help and sugestion pointers to the right direction .. becouse iv bene stuck at this for 4 days in arow

and tryd about every thing i could come upwith. and i did rewrite a whole part of it

 

but i dont know how the recipe sould handle the inputs and outputs .. i got it the furnace burning again with 2 input ..

but the te inputs just stay there and wont get used en the output wont come .. but still the furnace is burning and refueling with fuel that still works ..

 

a good point in the right direction would be nice.

Link to comment
Share on other sites

make a list of "TwoInputFurnaceRecipe" and whenever one of the 2 input slot changes (an item is added or removed) send both the item in a method that will check 1 by 1 every TwoInputFurnaceRecipe and try to find a match

if it finds a match place that recipe output in the output slot of the furnace

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

If you have been stuck for 4 days at this, I would suggest you try looking more into java first as that will help you immensely and will end up saving you a lot of time and frustration :) Learning java is not only about the syntax it's about the way you think and about OOP ways of doing things. Mastering the fundamentals of OOP will make you able to solve such logical problems easier!

 

Your earlier questions and threads indicate that you may would have the need for some re-reading of java mate,

I would suggest you follow my "highly detailed guide" which I believe I linked earlier to you. It should teach you the things you need and after that things like this will be easy as cake, or well at least as pie ;)

 

Just my 2 cents.

 

 

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

If you have been stuck for 4 days at this, I would suggest you try looking more into java first as that will help you immensely and will end up saving you a lot of time and frustration :) Learning java is not only about the syntax it's about the way you think and about OOP ways of doing things. Mastering the fundamentals of OOP will make you able to solve such logical problems easier!

 

Your earlier questions and threads indicate that you may would have the need for some re-reading of java mate,

I would suggest you follow my "highly detailed guide" which I believe I linked earlier to you. It should teach you the things you need and after that things like this will be easy as cake, or well at least as pie ;)

 

Just my 2 cents.

 

would gladly read that guide but you dint send me that link.

 

and eehm i said i was stuck 4 days because the recipe wouldn't let me get Any futher iv try different ways do do this and this is the closed i could get.

i know i sould learn java alot more. and i am I'm looking for guides all the time.

 

but if i even do learn more java still dusnt mean i know how to add 2input recipe lol because of how MC handles it is the point i guess ..

 

and is it ironic you all awnser me like learn more java ... let me ask you this it seems like you know what i am asking .. do you or do you not know how i sould start? because a simple NO will do the same trick as telling me i sould learn more java lol

 

greets

Link to comment
Share on other sites

but if i even do learn more java still dusnt mean i know how to add 2input recipe lol because of how MC handles it is the point i guess ..

That is the point, you shouldn't copy or use MC way of handling 2inputs, since they don't support. You have to handle it yourself.

As hydroflame suggested, you may want to make a unique map for both inputs, with the keys being an array, or list, of ItemStacks (or another custom Object containing them).

Hope that helped :)

Link to comment
Share on other sites

but if i even do learn more java still dusnt mean i know how to add 2input recipe lol because of how MC handles it is the point i guess ..

That is the point, you shouldn't copy or use MC way of handling 2inputs, since they don't support. You have to handle it yourself.

As hydroflame suggested, you may want to make a unique map for both inputs, with the keys being an array, or list, of ItemStacks (or another custom Object containing them).

Hope that helped :)

 

to awnser your question i did start from scratch :) .. but it was made eazyer to look at some code that alredy exist .. inorder to make my own code work :)

hehe i finaly got my custom furnace with 2 input hehe :D working and all :D

 

hehe lol im so happy :D:D

Link to comment
Share on other sites

i know i sould learn java alot more. and i am I'm looking for guides all the time.

I'm sorry I was sure I had responded to another thread of yours with the guide link, here it is:

http://www.minecraftforum.net/topic/1892328-need-a-highly-detailed-152-guide/

 

Following the guide I replied with in post #2 should aid you greatly, it did so for me ages ago ;)

 

So on to responding to you:

but if i even do learn more java still dusnt mean i know how to add 2input recipe lol because of how MC handles it is the point i guess ..

True you won't learn how MC handles things by learning java alone, but once you know Java then you can look at the code for Minecraft and UNDERSTAND why and how it works. Therefore it will give you quite the advantage for understanding how MC handles stuff!

 

And MC doesn't handle two inputs as said above, but you did solve it by creating it yourself and that's good :)

 

do you or do you not know how i sould start? because a simple NO will do the same trick as telling me i sould learn more java lol

Yes I do know how I would go about creating this, the same does the others I'm sure and if they don't know they can probably think of a way based on their java knowledge.  I have never tried to do this before but I'm sure I could implement this in a few minutes.

 

If I gave you the full source code for my mods, would you learn from it anymore than you could from the minecraft source which you already have? I doubt it, if you could leverage the minecraft src you would have done so already. What you need is to go back and learn some more basics, it sucks but it WILL HELP YOU immensely later on!

 

 

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

but if i even do learn more java still dusnt mean i know how to add 2input recipe lol because of how MC handles it is the point i guess ..

 

you do realise that by this logic nothing would ever get created?

 

the person who invented the first game didnt have a manual on how to create games. the person who made the first operating system didnt ahve an OS creation manual

but they knew how computer works (approximatelly)

notch didnt have a manual on "how to make furnace in code"

 

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

When I started coding I knew very little programming, I knew the basic keywords for C++ and that's it.

After weeks of working on my simple little game I hit such a wall that I gave up completely!

 

Later I found some nice programming courses online and learned more than the syntax, and then I revisited the old project and what I before created in weeks I realized I could create the same in a few days instead!!!

 

 

I'm not saying it's impossible to mod and learn programming while you do, sure you can do it!

But it's so much more frustrating and time consuming, and you end up being quite dependent on others for simple problems.

The time you spend learning about Java and Object Oriented Programming is well spent, you will be able to catch up to yourself rather quickly and surpass what you where going to do by a factor of 10!

 

So do yourself a favor and learn programming, it will benefit you in ways you can't begin to imagine!

If you don't it's up to you and you will lose time and your mods won't reach the unique and awesome level of programmers, but you can create what ever you want in the end, it will just take forever compared to the time you would have used as a programmer ;)

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

BTW, what is the TileEntity fix? I made a fuser for my mod and am upgrading the recipes. I need to know what the fix is.

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
Link to comment
Share on other sites

BTW, what is the TileEntity fix? I made a fuser for my mod and am upgrading the recipes. I need to know what the fix is.

 

if you dint know how i set up my tile entity .. its rater useless what fix i needed to help your tile entity so yeah.

 

that little fix if i would compair it with the furnace tile entity in the updateEntity part where it takes the cooktime and when its 200 it will do the smeltitem() part..

i dint clarify that part in my tilentity and it made my custom furnace burn but not take out the recipes and outputting my output item

 

so that was a little derp of mine :)

 

 

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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