Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.camellias.voidaicarcania.api.registry;
- import java.util.Map;
- import org.apache.commons.lang3.tuple.MutableTriple;
- import org.apache.commons.lang3.tuple.Triple;
- import com.google.common.collect.HashBasedTable;
- import com.google.common.collect.Table;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- public class VoidaicAltarRecipes
- {
- public static final VoidaicAltarRecipes INSTANCE = new VoidaicAltarRecipes();
- private final Table<Triple<Item, Item, Item>, Integer, ItemStack> recipes = HashBasedTable.create();
- /**
- * Used to add shaped item recipes to the Voidaic Altar.
- *
- * @param input1 - The first ingredient.
- * @param input2 - The second ingredient.
- * @param input3 - The third ingredient.
- * @param voidEssenceCost - How much Void Essence the recipe requires. Has to be higher than 0, else the recipe won't work.
- * @param result - The resulting ItemStack of the recipe.
- * @return
- */
- public void addItemRecipe(Item input1, Item input2, Item input3, int voidEssenceCost, ItemStack result)
- {
- Triple ingredients = new MutableTriple<>(input1, input2, input3);
- recipes.put(ingredients, voidEssenceCost, result);
- }
- public Table<Triple<Item, Item, Item>, Integer, ItemStack> getRecipes()
- {
- return recipes;
- }
- public Item getIngredient1()
- {
- for(Triple<Item, Item, Item> triple: recipes.rowKeySet())
- {
- return triple.getLeft();
- }
- return null;
- }
- public Item getIngredient2()
- {
- for(Triple<Item, Item, Item> triple: recipes.rowKeySet())
- {
- return triple.getMiddle();
- }
- return null;
- }
- public Item getIngredient3()
- {
- for(Triple<Item, Item, Item> triple: recipes.rowKeySet())
- {
- return triple.getRight();
- }
- return null;
- }
- public int getVoidEssenceCost(Item input1, Item input2, Item input3)
- {
- Triple ingredients = new MutableTriple<>(input1, input2, input3);
- Map<Integer, ItemStack> row = recipes.row(ingredients);
- for(int voidEssence : row.keySet())
- {
- System.out.println(voidEssence);
- return voidEssence;
- }
- return 0;
- }
- public ItemStack getRecipeResult(Item input1, Item input2, Item input3, int voidEssenceCost)
- {
- Triple ingredients = new MutableTriple<>(input1, input2, input3);
- return recipes.get(ingredients, voidEssenceCost);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement