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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I'm developing a dimension, but it's kinda resource intensive so some times during player teleporting it lags behind making the player phase down into the void, so im trying to implement some kind of pregeneration to force the game loading a small set of chunks in the are the player will teleport to. Some of the things i've tried like using ServerLevel and ServerChunkCache methods like getChunk() dont actually trigger chunk generation if the chunk isn't already on persistent storage (already generated) or placing tickets, but that doesn't work either. Ideally i should be able to check when the task has ended too. I've peeked around some pregen engines, but they're too complex for my current understanding of the system of which I have just a basic understanding (how ServerLevel ,ServerChunkCache  and ChunkMap work) of. Any tips or other classes I should be looking into to understand how to do this correctly?
    • https://mclo.gs/4UC49Ao
    • Way back in the Forge 1.17 days, work started for adding JPMS (Java Platform Module Support) to ModLauncher and ForgeModLoader. This has been used internally by Forge and some libraries for a while now, but mods (those with mods.toml specifically) have not been able to take advantage of it. As of Forge 1.21.1 and 1.21.3, this is now possible!   What is JPMS and what does it mean for modders? JPMS is the Java Platform Module System, introduced in Java 9. It allows you to define modules, which are collections of packages and resources that can be exported or hidden from other modules. This allows for much more fine-tuned control over visibility, cleaner syntax for service declarations and support for sealed types across packages. For example, you might have a mod with a module called `com.example.mod` that exports `com.example.mod.api` and `com.example.mod.impl` to other mods, but hides `com.example.mod.internal` from them. This would allow you to have a clean API for other mods to use, while keeping your internal implementation details hidden from IDE hints, helping prevent accidental usage of internals that might break without prior notice. This is particularly useful if you'd like to use public records with module-private constructors or partially module-private record components, as you can create a sealed interface that only your record implements, having the interface be exported and the record hidden. It's also nice for declaring and using services, as you'll get compile-time errors from the Java compiler for typos and the like, rather than deferring to runtime errors. In more advanced cases, you can also have public methods that are only accessible to specific other modules -- handy if you want internal interactions between multiple of your own mods.   How do I bypass it? We understand there may be drama in implementing a system that prevents mods from accessing each other's internals when necessary (like when a mod is abandoned or you need to fix a compat issue) -- after all, we are already modding a game that doesn't have explicit support for Java mods yet. We have already thought of this and are offering APIs from day one to selectively bypass module restrictions. Let me be clear: Forge mods are not required to use JPMS. If you don't want to use it, you don't have to. The default behaviour is to have fully open, fully exported automatic modules. In Java, you can use the `Add-Opens` and `Add-Exports` manifest attributes to selectively bypass module restrictions of other mods at launch time, and we've added explicit support for these when loading your Forge mods. At compile-time, you can use existing solutions such as the extra-java-module-info Gradle plugin to deal with non-modular dependencies and add extra opens and exports to other modules. Here's an example on how to make the internal package `com.example.examplemod.internal` open to your mod in your build.gradle: tasks.named('jar', Jar) { manifest { attributes([ 'Add-Opens' : 'com.example.examplemod/com.example.examplemod.internal' 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors // (...) ]) } } With the above in your mod's jar manifest, you can now reflectively access the classes inside that internal package. Multiple entries are separated with a space, as per Java's official spec. You can also use Add-Exports to directly call without reflection, however you'd need to use the Gradle plugin mentioned earlier to be able to compile. The syntax for Add-Exports is the same as Add-Opens, and instructions for the compile-time step with the Gradle plugin are detailed later in this post. Remember to prefer the opens and exports keywords inside module-info.java for sources you control. The Add-Opens/Add-Exports attributes are only intended for forcing open other mods.   What else is new with module support? Previously, the runtime module name was always forced to the first mod ID in your `mods.toml` file and all packages were forced fully open and exported. Module names are now distinguished from mod IDs, meaning the module name in your module-info.java can be different from the mod ID in your `mods.toml`. This allows you to have a more descriptive module name that doesn't have to be the same as your mod ID, however we strongly recommend including your mod ID as part of your module name to aid troubleshooting. The `Automatic-Module-Name` manifest attribute is now also honoured, allowing you to specify a module name for your mod without needing to create a `module-info.java` file. This is particularly useful for mods that don't care about JPMS features but want to have a more descriptive module name and easier integration with other mods that do use JPMS.   How do I use it? The first step is to create a `module-info.java` file in your mod's source directory. This file should be in the same package as your main mod class, and should look something like this: open module com.example.examplemod { requires net.minecraftforge.eventbus; requires net.minecraftforge.fmlcore; requires net.minecraftforge.forge; requires net.minecraftforge.javafmlmod; requires net.minecraftforge.mergetool.api; requires org.slf4j; requires logging; } For now, we're leaving the whole module open to reflection, which is a good starting point. When we know we want to close something off, we can remove the open modifier from the module and open or export individual packages instead. Remember that you need to be open to Forge (module name net.minecraftforge.forge), otherwise it can't call your mod's constructor. Next is fixing modules in Gradle. While Forge and Java support modules properly, Gradle does not put automatic modules on the module path by default, meaning that the logging module (from com.mojang:logging) is not found. To fix this, add the Gradle plugin and add a compile-time module definition for that Mojang library: plugins { // (...) id 'org.gradlex.extra-java-module-info' version "1.9" } // (...) extraJavaModuleInfo { failOnMissingModuleInfo = false automaticModule("com.mojang:logging", "logging") } The automatic module override specified in your build.gradle should match the runtime one to avoid errors. You can do the same for any library or mod dependency that is missing either a module-info or explicit Automatic-Module-Name, however be aware that you may need to update your mod once said library adds one. That's all you need to get started with module support in your mods. You can learn more about modules and how to use them at dev.java.
    • Faire la mise à jour grâce à ce lien m'a aider personnellement, merci à @Paint_Ninja. https://www.amd.com/en/support 
    • When I came across the 'Exit Code: I got a 1 error in my Minecraft mods, so I decided to figure out what was wrong. First, I took a look at the logs. In the mods folder (usually where you'd find logs or crash reports), I found the latest.log file or the corresponding crash report. I read it through carefully, looking for any lines with errors or warnings. Then I checked the Minecraft Forge support site, where you can often find info on what causes errors and how to fix them. I then disabled half of my mods and tried running the game. If the error disappeared, it meant that the problem was with the disabled mod. I repeated this several times to find the problem mod.
  • Topics

×
×
  • Create New...

Important Information

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