Added the framework for a ritual that grants downgrades (instead of the potion method)
This commit is contained in:
parent
43f86abc58
commit
ed8427c04e
13 changed files with 661 additions and 4 deletions
|
@ -0,0 +1,72 @@
|
|||
package WayofTime.bloodmagic.api.registry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.recipe.LivingArmourDowngradeRecipe;
|
||||
|
||||
public class LivingArmourDowngradeRecipeRegistry
|
||||
{
|
||||
private static List<LivingArmourDowngradeRecipe> recipeList = new ArrayList<LivingArmourDowngradeRecipe>();
|
||||
private static Map<ItemStack, Map<Integer, List<ITextComponent>>> dialogueMap = new HashMap<ItemStack, Map<Integer, List<ITextComponent>>>();
|
||||
|
||||
public static void registerRecipe(LivingArmourDowngradeRecipe recipe)
|
||||
{
|
||||
recipeList.add(recipe);
|
||||
}
|
||||
|
||||
public static void registerDialog(ItemStack keyStack, Map<Integer, List<ITextComponent>> map)
|
||||
{
|
||||
dialogueMap.put(keyStack, map);
|
||||
}
|
||||
|
||||
public static List<ITextComponent> getDialogForProcessTick(ItemStack keyStack, int tick)
|
||||
{
|
||||
for (Entry<ItemStack, Map<Integer, List<ITextComponent>>> entry : dialogueMap.entrySet())
|
||||
{
|
||||
ItemStack key = entry.getKey();
|
||||
if (OreDictionary.itemMatches(key, keyStack, false))
|
||||
{
|
||||
Map<Integer, List<ITextComponent>> map = entry.getValue();
|
||||
if (map.containsKey(tick))
|
||||
{
|
||||
return map.get(tick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void registerRecipe(LivingArmourUpgrade upgrade, ItemStack keyStack, Object... recipe)
|
||||
{
|
||||
registerRecipe(new LivingArmourDowngradeRecipe(upgrade, keyStack, recipe));
|
||||
}
|
||||
|
||||
public static LivingArmourDowngradeRecipe getMatchingRecipe(ItemStack keyStack, List<ItemStack> itemList, World world, BlockPos pos)
|
||||
{
|
||||
for (LivingArmourDowngradeRecipe recipe : recipeList)
|
||||
{
|
||||
if (recipe.matches(keyStack, itemList, world, pos))
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<LivingArmourDowngradeRecipe> getRecipeList()
|
||||
{
|
||||
return new ArrayList<LivingArmourDowngradeRecipe>(recipeList);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue