Kinda How a Minecraft Crafting Table Code Works

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

CarbonBasedGhost

New Member
Jul 29, 2019
910
-1
0
I was really bored and on a computer incapable of running Minecraft (nonetheless FTB) so I did some java coding. The code I did is a rough concept of how a Minecraft crafting tables code looks like. Enjoy!

Code:
package base;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

public class Recipe {
 
    public static HashMap<List<Integer>, Integer> Recipe = new HashMap();
 
 
    public static void AddRecipe(Integer item1, Integer  item2, Integer  item3, Integer  item4, Integer  item5, Integer  item6, Integer recipeOutput){
     
        Integer[] recipeFormatter =  new Integer[]{item1, item2, item3, item4, item5, item6};
        List<Integer> recipeInput = Arrays.asList(recipeFormatter);
     
        Recipe.put(recipeInput, recipeOutput);
     
    }
    public static Integer CraftRecipe(Integer item1, Integer  item2, Integer  item3, Integer  item4, Integer  item5, Integer  item6){
     
        Integer[] recipeFormatter =  new Integer[]{item1, item2, item3, item4, item5, item6};
        List<Integer> recipeInput = Arrays.asList(recipeFormatter);
     
     
        if (Recipe.containsKey(recipeInput)){
         
            System.out.println("Recipe Worked");
         
            return Recipe.get(recipeInput);
         
         
         
        }else{
         
            System.out.println("Recipe Failed");
         
            return null;
         
        }
     
    }
 
 
 
 
 

}

Note: The Integers are items and Craft Recipe stimulates it checking to see if the recipe is valid.

And yes there are 6 slots in this crafting table instead of nine, I screwed up but this is pretty much the same exact thing.