Jump to content

3 input furnace?


Eastonium

Recommended Posts

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Sry i had to much todo with my Modular Machine that i had forgot the thing here^^"

I am really sorry! xD this machine is so hard to code! Its to much for a lonly person^^

But back to reallity^^

Now to the code

 

And i do know how it works! Only thing is its always a ShapedRecipe!

If you want to add a shapless recipe then you had to make it manually!

 

You only need to make a the furnace as normal. Everything as normal!

The only things what you have to change that he consumes all 3 inputs and the Recipe list!

 

I show you how that works!

Here the code:

 

public class FurnaceList
{
      private static FurnaceList recipes = new FurnaceList();

      public static FurnaceList smelting()
      {
           return recipes;
      }



      //RecipList i do not make a exp Bar. But its easy too
      private HashMap<List<Integer>, ItemStack> recipeList = new HashMap<List<Integer>, ItemStack>();
      //Why Do i make a Forge Meta Recipe list ?
     // Because its the Easiest way! 

    // Now The Tricky Part and do not say its a little bit big! I know that but Its working!
    public void addSmelting(ItemStack output, ItemStack input1, ItemStack input2, ItemStack input3)
    {
         int item1 = 0;
         int damage1 = 0;
         int item2 = 0;
         int damage2 = 0;
         int item3 = 0;
         int damage3 = 0;
         
         if(input1 != null)
         {
              item1 = input1.itemID;
              damage1 = input1.getItemDamage();
         }

         if(input2 != null)
         {
             item2 = input2.itemID;
             damage2 = input2.getItemDamage();
         }

         if(input3 != null)
         {
               item3 = input3.itemID;
               damage3 = input3.getItemDamage();
         }
         recipeList.put(Arrays.asList(item1, damage1, item2, damage2, item3, damage3), output);

    }
      
    public Map<List<Integer>, ItemStack> getRecipeList()
    {
        return recipeList;
    }

    public ItemStack getRecipeOutput(ItemStack input1, ItemStack input2, ItemStack input3)
    {
         int item1 = 0;
         int damage1 = 0;
         int item2 = 0;
         int damage2 = 0;
         int item3 = 0;
         int damage3 = 0;
         
         if(input1 != null)
         {
              item1 = input1.itemID;
              damage1 = input1.getItemDamage();
         }

         if(input2 != null)
         {
             item2 = input2.itemID;
             damage2 = input2.getItemDamage();
         }

         if(input3 != null)
         {
               item3 = input3.itemID;
               damage3 = input3.getItemDamage();
         }
         return recipeList.get(Arrays.asList(item1, damage1, item2, damage2, item3, damage3));
    }
}

 

I know its a lot of code.

Now to explaining.

 

When you add a recipe than it will safed as a list:

[item1, damage1, item2, damage2, item3, damage3];

so and if you want to get it then he looks at the rcipes list with the same informations.

So you can extend the code as much as you want. So long you make it as list^^

But this way you had to add every combination by yourself! Its always a shaped recipe!

So if you want to add a 1 item recipe than you had to add 3 recipes xD

 

And i think thats what you are looking for.

I hope it helps^^ xD

Link to comment
Share on other sites

It works! I had to modify quite a few things in my TileEntity, but it works great! But right now I'm wondering if it would be possible to use the Arrays.sort method to arrange the recipes before comparing them. Could the Arrays for the arraylist be written something like (item1, item2, item3, meta1, meta2, meta 3) or something of that sorts, or if that doesn't work, maybe 2 arrays inside of one array being something like: recipelist(ArrayItems[], ArrayMeta[])??? I really want the shapeless stuffs....

Link to comment
Share on other sites

xD Here a way to add a shaplessRecipe^^

 

//Your Add smelting function out of my old post. I do not want write everything doube

public void addSmelting(ItemStack output, ItemStack input1, ItemStack input2, ItemStack input3)
{};

public void addShaplessSmelting(ItemStack output, ItemStack in1, ItemStack in2, ItemStack in3)
{
      addSmelting(output, in1, in2, in3);
      addSmelting(output, in1, in3, in2);
      addSmelting(output, in2, in1, in3);
      addSmelting(output, in2, in3, in1);
      addSmelting(output, in3, in1, in2);
      addSmelting(output, in3, in2, in1);
}

with this function you make shaplessRecipes  XD So you can have both.
There might be easier ways but i do not know them!

Link to comment
Share on other sites

  • 1 year later...

This thread is 1 and a half year old. Don't hijack threads! Make your own thread.

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

Guest
This topic is now closed to further replies.

Announcements




×
×
  • Create New...

Important Information

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