Recipe-Manager mechanics

  • Hi everyone, I started Forge Modding time ago, since Bukkit-Plugins are getting boring and Bukkit seems to shutdown, but anyway.
    I'm working on a Mod which uses the EU-System and some Machines. Now I wanted to create my own Machine and tried to use a Interface (like the Machines from IC2) to register all Recipes.
    But I got to one problem > Because the Interfaces are the same, wouldn't it normally register a Recipe to all Machines with the same Interface?

  • Hi everyone, I started Forge Modding time ago, since Bukkit-Plugins are getting boring and Bukkit seems to shutdown, but anyway.
    I'm working on a Mod which uses the EU-System and some Machines. Now I wanted to create my own Machine and tried to use a Interface (like the Machines from IC2) to register all Recipes.
    But I got to one problem > Because the Interfaces are the same, wouldn't it normally register a Recipe to all Machines with the same Interface?

    Huh? Anyway, here's a good example of me adding a recipe to a machine. This first class is the input. This class registers all of my IC2 machine recipes.

    Help the Official FTB Wiki reach a billion pages! [I had to keep changing it so there ^^]

    Someone should fix the gravel texture in the background. It's been years now, come on people.

  • I'm not exactly sure what you are referring to, I'll just assume it's the Recipes class.


    The fields macerator, extractor, compressor etc. all share the same interface (IMachineRecipeManager), but each one gets its own instance assigned, i.e. the actual data behind isn't shared.


    If you implement your own machine instead of just adding a recipe to one of ic2's, you won't actually need to use the IMachineRecipeManager system. It doesn't do anything by itself, there's always some code required to do the actual processing, which you can just hard code in your machine's updateEntity() override. Think of IMachineRecipeManager more as a database storing the various input->output recipes a machine offers.


    The IC2 infrastructure to build machines more readily isn't exposed via the API and wouldn't be that easy to use anyway. Out base class for normal machines is ic2.core.block.machine.tileentity.TileEntityStandardMachine and the normal implementation of IMachineRecipeManager is ic2.core.BasicMachineRecipeManager, but those have a lot of code and functionality not needed for addon use.


    So to have your own machine you should start quite a bit lower -> create a block, a tile entity and later on container+gui. There are various examples available for Minecraft Forge. You can use ic2.api.energy.prefab.BasicSink as the easiest way to eventually hook things up to the ic2 energy net.

  • It's fine I figured it out. I just never really worked with Interfaces, so I was thinking that every Class which implements a Interface is being called when using a Interface-Method. That was messing me up because how would you tell to only register for a certain machine then...