OreDict Altar Recipes!
OreDict support for altar and alchemy array recipes! Changed the alchemy array JEI image Recipe modularizations Fix Like this? Tehnut patch Change to List<ItemStack>
This commit is contained in:
parent
f9cb1a08ba
commit
800ffa213b
|
@ -11,21 +11,24 @@ import lombok.Getter;
|
|||
import lombok.ToString;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class AlchemyArrayRecipeRegistry
|
||||
{
|
||||
public static final AlchemyCircleRenderer defaultRenderer = new AlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BaseArray.png"));
|
||||
|
||||
private static BiMap<ItemStackWrapper, AlchemyArrayRecipe> recipes = HashBiMap.create();
|
||||
private static BiMap<List<ItemStack>, AlchemyArrayRecipe> recipes = HashBiMap.create();
|
||||
|
||||
/**
|
||||
* General case for creating an AlchemyArrayEffect for a given input.
|
||||
*
|
||||
* @param inputStack
|
||||
* - Input item that is used to change the Alchemy Circle into the
|
||||
* @param input
|
||||
* - Input item(s) that is used to change the Alchemy Circle into the
|
||||
* circle that you are making
|
||||
* @param catalystStack
|
||||
* - Catalyst item that, when right-clicked onto the array, will
|
||||
|
@ -36,18 +39,19 @@ public class AlchemyArrayRecipeRegistry
|
|||
* - Circle rendered when the array is passive - can be substituted
|
||||
* for a special renderer
|
||||
*/
|
||||
public static void registerRecipe(ItemStack inputStack, @Nullable ItemStack catalystStack, AlchemyArrayEffect arrayEffect, AlchemyCircleRenderer circleRenderer)
|
||||
public static void registerRecipe(List<ItemStack> input, @Nullable ItemStack catalystStack, AlchemyArrayEffect arrayEffect, AlchemyCircleRenderer circleRenderer)
|
||||
{
|
||||
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||
for (Entry<List<ItemStack>, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||
{
|
||||
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
||||
if (arrayRecipe.doesInputMatchRecipe(inputStack))
|
||||
if (arrayRecipe.doesInputMatchRecipe(input))
|
||||
{
|
||||
AlchemyArrayEffect eff = arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack);
|
||||
if (eff != null)
|
||||
{
|
||||
return; // Recipe already exists!
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
arrayRecipe.catalystMap.put(ItemStackWrapper.getHolder(catalystStack), arrayEffect);
|
||||
if (circleRenderer != null)
|
||||
|
@ -59,114 +63,195 @@ public class AlchemyArrayRecipeRegistry
|
|||
|
||||
if (circleRenderer == null)
|
||||
{
|
||||
recipes.put(ItemStackWrapper.getHolder(inputStack), new AlchemyArrayRecipe(inputStack, catalystStack, arrayEffect, defaultRenderer));
|
||||
} else
|
||||
recipes.put(input, new AlchemyArrayRecipe(input, catalystStack, arrayEffect, defaultRenderer));
|
||||
}
|
||||
else
|
||||
{
|
||||
recipes.put(ItemStackWrapper.getHolder(inputStack), new AlchemyArrayRecipe(inputStack, catalystStack, arrayEffect, circleRenderer));
|
||||
recipes.put(input, new AlchemyArrayRecipe(input, catalystStack, arrayEffect, circleRenderer));
|
||||
}
|
||||
|
||||
recipes.put(ItemStackWrapper.getHolder(inputStack), new AlchemyArrayRecipe(inputStack, catalystStack, arrayEffect, circleRenderer));
|
||||
recipes.put(input, new AlchemyArrayRecipe(input, catalystStack, arrayEffect, circleRenderer));
|
||||
}
|
||||
|
||||
public static void registerCraftingRecipe(ItemStack inputStack, ItemStack catalystStack, ItemStack outputStack, AlchemyCircleRenderer circleRenderer)
|
||||
public static void registerCraftingRecipe(ItemStack input, ItemStack catalystStack, ItemStack outputStack, ResourceLocation arrayResource)
|
||||
{
|
||||
registerRecipe(inputStack, catalystStack, new AlchemyArrayEffectCrafting(outputStack), circleRenderer);
|
||||
registerRecipe(input, catalystStack, new AlchemyArrayEffectCrafting(outputStack), arrayResource);
|
||||
}
|
||||
|
||||
public static void registerCraftingRecipe(ItemStack inputStack, ItemStack catalystStack, ItemStack outputStack, ResourceLocation arrayResource)
|
||||
public static void registerCraftingRecipe(List<ItemStack> inputStacks, ItemStack catalystStack, ItemStack outputStack, ResourceLocation arrayResource)
|
||||
{
|
||||
registerRecipe(inputStack, catalystStack, new AlchemyArrayEffectCrafting(outputStack), arrayResource);
|
||||
registerRecipe(inputStacks, catalystStack, new AlchemyArrayEffectCrafting(outputStack), arrayResource);
|
||||
}
|
||||
|
||||
public static void registerCraftingRecipe(ItemStack inputStack, ItemStack catalystStack, ItemStack outputStack)
|
||||
public static void registerCraftingRecipe(String inputOreDict, ItemStack catalystStack, ItemStack outputStack, ResourceLocation arrayResource)
|
||||
{
|
||||
registerRecipe(inputStack, catalystStack, new AlchemyArrayEffectCrafting(outputStack));
|
||||
if (OreDictionary.doesOreNameExist(inputOreDict))
|
||||
registerRecipe(OreDictionary.getOres(inputOreDict), catalystStack, new AlchemyArrayEffectCrafting(outputStack), arrayResource);
|
||||
}
|
||||
|
||||
public static void registerRecipe(ItemStack inputStack, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource)
|
||||
public static void registerCraftingRecipe(ItemStack input, ItemStack catalystStack, ItemStack outputStack)
|
||||
{
|
||||
registerRecipe(input, catalystStack, new AlchemyArrayEffectCrafting(outputStack));
|
||||
}
|
||||
|
||||
public static void registerCraftingRecipe(List<ItemStack> inputStacks, ItemStack catalystStack, ItemStack outputStack)
|
||||
{
|
||||
registerRecipe(inputStacks, catalystStack, new AlchemyArrayEffectCrafting(outputStack));
|
||||
}
|
||||
|
||||
public static void registerCraftingRecipe(String inputOreDict, ItemStack catalystStack, ItemStack outputStack)
|
||||
{
|
||||
if (OreDictionary.doesOreNameExist(inputOreDict))
|
||||
registerRecipe(OreDictionary.getOres(inputOreDict), catalystStack, new AlchemyArrayEffectCrafting(outputStack));
|
||||
}
|
||||
|
||||
public static void registerRecipe(ItemStack inputStacks, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource)
|
||||
{
|
||||
AlchemyCircleRenderer circleRenderer = arrayResource == null ? defaultRenderer : new AlchemyCircleRenderer(arrayResource);
|
||||
registerRecipe(inputStack, catalystStack, arrayEffect, circleRenderer);
|
||||
registerRecipe(Collections.singletonList(inputStacks), catalystStack, arrayEffect, circleRenderer);
|
||||
}
|
||||
|
||||
public static void registerRecipe(ItemStack inputStack, ItemStack catalystStack, AlchemyArrayEffect arrayEffect)
|
||||
public static void registerRecipe(ItemStack inputStacks, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, AlchemyCircleRenderer circleRenderer)
|
||||
{
|
||||
registerRecipe(inputStack, catalystStack, arrayEffect, (AlchemyCircleRenderer) null);
|
||||
registerRecipe(Collections.singletonList(inputStacks), catalystStack, arrayEffect, circleRenderer);
|
||||
}
|
||||
|
||||
public static void replaceAlchemyCircle(ItemStack inputStack, AlchemyCircleRenderer circleRenderer)
|
||||
public static void registerRecipe(List<ItemStack> inputStacks, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource)
|
||||
{
|
||||
AlchemyCircleRenderer circleRenderer = arrayResource == null ? defaultRenderer : new AlchemyCircleRenderer(arrayResource);
|
||||
registerRecipe(inputStacks, catalystStack, arrayEffect, circleRenderer);
|
||||
}
|
||||
|
||||
public static void registerRecipe(String inputOreDict, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource)
|
||||
{
|
||||
if (OreDictionary.doesOreNameExist(inputOreDict))
|
||||
{
|
||||
AlchemyCircleRenderer circleRenderer = arrayResource == null ? defaultRenderer : new AlchemyCircleRenderer(arrayResource);
|
||||
registerRecipe(OreDictionary.getOres(inputOreDict), catalystStack, arrayEffect, circleRenderer);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerRecipe(ItemStack input, ItemStack catalystStack, AlchemyArrayEffect arrayEffect)
|
||||
{
|
||||
registerRecipe(Collections.singletonList(input), catalystStack, arrayEffect, (AlchemyCircleRenderer) null);
|
||||
}
|
||||
|
||||
public static void registerRecipe(List<ItemStack> inputStacks, ItemStack catalystStack, AlchemyArrayEffect arrayEffect)
|
||||
{
|
||||
registerRecipe(inputStacks, catalystStack, arrayEffect, (AlchemyCircleRenderer) null);
|
||||
}
|
||||
|
||||
public static void registerRecipe(String inputOreDict, ItemStack catalystStack, AlchemyArrayEffect arrayEffect)
|
||||
{
|
||||
if (OreDictionary.doesOreNameExist(inputOreDict))
|
||||
registerRecipe(OreDictionary.getOres(inputOreDict), catalystStack, arrayEffect, (AlchemyCircleRenderer) null);
|
||||
}
|
||||
|
||||
public static void replaceAlchemyCircle(List<ItemStack> input, AlchemyCircleRenderer circleRenderer)
|
||||
{
|
||||
if (circleRenderer == null)
|
||||
return;
|
||||
|
||||
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||
for (Entry<List<ItemStack>, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||
{
|
||||
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
||||
if (arrayRecipe.doesInputMatchRecipe(inputStack))
|
||||
if (arrayRecipe.doesInputMatchRecipe(input))
|
||||
arrayRecipe.circleRenderer = circleRenderer;
|
||||
}
|
||||
}
|
||||
|
||||
public static AlchemyArrayRecipe getRecipeForInput(ItemStack input)
|
||||
public static AlchemyArrayRecipe getRecipeForInput(List<ItemStack> input)
|
||||
{
|
||||
return recipes.get(ItemStackWrapper.getHolder(input));
|
||||
return recipes.get(input);
|
||||
}
|
||||
|
||||
public static AlchemyArrayEffect getAlchemyArrayEffect(ItemStack inputStack, @Nullable ItemStack catalystStack)
|
||||
public static AlchemyArrayEffect getAlchemyArrayEffect(List<ItemStack> input, @Nullable ItemStack catalystStack)
|
||||
{
|
||||
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||
for (Entry<List<ItemStack>, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||
{
|
||||
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
||||
if (ItemStackWrapper.getHolder(arrayRecipe.getInputStack()).equals(ItemStackWrapper.getHolder(inputStack)))
|
||||
return arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack); // TODO: Decide if a copy should be returned.
|
||||
if (input.size() == 1 && arrayRecipe.getInput().size() == 1)
|
||||
{
|
||||
if (ItemStackWrapper.getHolder(arrayRecipe.getInput().get(0)).equals(ItemStackWrapper.getHolder(input.get(0))))
|
||||
return arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack); // TODO: Decide if a copy should be returned.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (input.equals(arrayRecipe.getInput()))
|
||||
return arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static AlchemyCircleRenderer getAlchemyCircleRenderer(ItemStack inputStack)
|
||||
public static AlchemyArrayEffect getAlchemyArrayEffect(ItemStack input, @Nullable ItemStack catalystStack)
|
||||
{
|
||||
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||
return getAlchemyArrayEffect(Collections.singletonList(input), catalystStack);
|
||||
}
|
||||
|
||||
public static AlchemyCircleRenderer getAlchemyCircleRenderer(List<ItemStack> input)
|
||||
{
|
||||
for (Entry<List<ItemStack>, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||
{
|
||||
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
||||
if (arrayRecipe.doesInputMatchRecipe(inputStack))
|
||||
if (arrayRecipe.doesInputMatchRecipe(input))
|
||||
return arrayRecipe.circleRenderer;
|
||||
}
|
||||
|
||||
return defaultRenderer;
|
||||
}
|
||||
|
||||
public static AlchemyCircleRenderer getAlchemyCircleRenderer(ItemStack itemStack)
|
||||
{
|
||||
return getAlchemyCircleRenderer(Collections.singletonList(itemStack));
|
||||
}
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
public static class AlchemyArrayRecipe
|
||||
{
|
||||
|
||||
public AlchemyCircleRenderer circleRenderer;
|
||||
public final ItemStack inputStack;
|
||||
public final List<ItemStack> input;
|
||||
public final BiMap<ItemStackWrapper, AlchemyArrayEffect> catalystMap = HashBiMap.create();
|
||||
|
||||
public AlchemyArrayRecipe(ItemStack inputStack, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, AlchemyCircleRenderer circleRenderer)
|
||||
private AlchemyArrayRecipe(List<ItemStack> input, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, AlchemyCircleRenderer circleRenderer, boolean useless)
|
||||
{
|
||||
this.inputStack = inputStack;
|
||||
this.input = input;
|
||||
|
||||
catalystMap.put(ItemStackWrapper.getHolder(catalystStack), arrayEffect);
|
||||
|
||||
this.circleRenderer = circleRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the inputed ItemStack to see if it matches with the recipe's
|
||||
* inputStack.
|
||||
*
|
||||
* @param comparedStack
|
||||
* - The stack to compare with
|
||||
*
|
||||
* @return - True if the ItemStack is a compatible item
|
||||
*/
|
||||
public boolean doesInputMatchRecipe(ItemStack comparedStack)
|
||||
public AlchemyArrayRecipe(ItemStack inputStack, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, AlchemyCircleRenderer circleRenderer)
|
||||
{
|
||||
return !(comparedStack == null || this.inputStack == null) && this.inputStack.isItemEqual(comparedStack);
|
||||
this(Collections.singletonList(inputStack), catalystStack, arrayEffect, circleRenderer, false);
|
||||
}
|
||||
|
||||
public AlchemyArrayRecipe(String inputOreDict, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, AlchemyCircleRenderer circleRenderer)
|
||||
{
|
||||
this(OreDictionary.getOres(inputOreDict), catalystStack, arrayEffect, circleRenderer, false);
|
||||
}
|
||||
|
||||
public AlchemyArrayRecipe(List<ItemStack> inputStacks, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, AlchemyCircleRenderer circleRenderer)
|
||||
{
|
||||
this(inputStacks, catalystStack, arrayEffect, circleRenderer, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the inputed list of ItemStacks to see if it matches with the recipe's
|
||||
* list.
|
||||
*
|
||||
* @param comparedList
|
||||
* - The list to compare with
|
||||
*
|
||||
* @return - True if the ItemStack(s) is a compatible item
|
||||
*/
|
||||
public boolean doesInputMatchRecipe(List<ItemStack> comparedList)
|
||||
{
|
||||
return !(comparedList == null || this.input == null) && (this.input.size() == 1 && comparedList.size() == 1 ? this.input.get(0).isItemEqual(comparedList.get(0)) : this.input.equals(comparedList));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,7 +282,7 @@ public class AlchemyArrayRecipeRegistry
|
|||
}
|
||||
}
|
||||
|
||||
public static BiMap<ItemStackWrapper, AlchemyArrayRecipe> getRecipes()
|
||||
public static BiMap<List<ItemStack>, AlchemyArrayRecipe> getRecipes()
|
||||
{
|
||||
return HashBiMap.create(recipes);
|
||||
}
|
||||
|
|
|
@ -8,19 +8,30 @@ import lombok.EqualsAndHashCode;
|
|||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class AltarRecipeRegistry
|
||||
{
|
||||
private static BiMap<ItemStack, AltarRecipe> recipes = HashBiMap.create();
|
||||
private static BiMap<List<ItemStack>, AltarRecipe> recipes = HashBiMap.create();
|
||||
|
||||
public static void registerRecipe(AltarRecipe recipe)
|
||||
/**
|
||||
* Registers an {@link AltarRecipe} for the Blood Altar. This can be a {@code ItemStack}, {@code List<Itemstack>},
|
||||
* or {@code String} OreDictionary entry.
|
||||
*
|
||||
* If the OreDictionary entry does not exist or is empty, it will not be registered.
|
||||
*
|
||||
* @param altarRecipe
|
||||
* - The AltarRecipe to register
|
||||
*/
|
||||
public static void registerRecipe(AltarRecipe altarRecipe)
|
||||
{
|
||||
if (!recipes.containsValue(recipe))
|
||||
recipes.put(recipe.input, recipe);
|
||||
if (!recipes.containsValue(altarRecipe) && altarRecipe.getInput().size() > 0)
|
||||
recipes.put(altarRecipe.getInput(), altarRecipe);
|
||||
else
|
||||
BloodMagicAPI.getLogger().error("Error adding altar recipe for %s. Recipe already exists.", recipe.input.getDisplayName(), recipe.output == null ? "" : " -> ");
|
||||
BloodMagicAPI.getLogger().error("Error adding altar recipe for input [{}].", altarRecipe.toString());
|
||||
}
|
||||
|
||||
public static void registerFillRecipe(ItemStack orbStack, EnumAltarTier tier, int maxForOrb, int consumeRate, int drainRate)
|
||||
|
@ -28,9 +39,24 @@ public class AltarRecipeRegistry
|
|||
registerRecipe(new AltarRecipe(orbStack, orbStack, tier, maxForOrb, consumeRate, drainRate, true));
|
||||
}
|
||||
|
||||
public static AltarRecipe getRecipeForInput(ItemStack input)
|
||||
/**
|
||||
* Gets the recipe that the provided input is registered to.
|
||||
*
|
||||
* @param input
|
||||
* - The input ItemStack to get the recipe for
|
||||
* @return - The recipe that the provided input is registered to.
|
||||
*/
|
||||
public static AltarRecipe getRecipeForInput(List<ItemStack> input)
|
||||
{
|
||||
return recipes.get(input);
|
||||
if (recipes.keySet().contains(input))
|
||||
return recipes.get(input);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static BiMap<List<ItemStack>, AltarRecipe> getRecipes()
|
||||
{
|
||||
return HashBiMap.create(recipes);
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
@ -38,11 +64,11 @@ public class AltarRecipeRegistry
|
|||
@EqualsAndHashCode
|
||||
public static class AltarRecipe
|
||||
{
|
||||
|
||||
public final int syphon, consumeRate, drainRate;
|
||||
public final boolean fillable;
|
||||
public final ItemStack input, output;
|
||||
public final EnumAltarTier minTier;
|
||||
private final List<ItemStack> input;
|
||||
private final ItemStack output;
|
||||
private final EnumAltarTier minTier;
|
||||
private final int syphon, consumeRate, drainRate;
|
||||
private final boolean fillable;
|
||||
|
||||
/**
|
||||
* Allows creation of a recipe for the
|
||||
|
@ -50,7 +76,7 @@ public class AltarRecipeRegistry
|
|||
* {@link WayofTime.bloodmagic.tile.TileAltar}. The output ItemStack is
|
||||
* allowed to be null as some recipes do not contain an output. (Blood
|
||||
* Orbs)
|
||||
*
|
||||
*
|
||||
* @param input
|
||||
* - The input ItemStack
|
||||
* @param output
|
||||
|
@ -66,7 +92,7 @@ public class AltarRecipeRegistry
|
|||
* @param fillable
|
||||
* - Whether the input item can be filled with LP. IE: Orbs
|
||||
*/
|
||||
public AltarRecipe(ItemStack input, @Nullable ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable)
|
||||
public AltarRecipe(List<ItemStack> input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable)
|
||||
{
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
|
@ -77,23 +103,44 @@ public class AltarRecipeRegistry
|
|||
this.fillable = fillable;
|
||||
}
|
||||
|
||||
public AltarRecipe(ItemStack input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate)
|
||||
public AltarRecipe(List<ItemStack> input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate)
|
||||
{
|
||||
this(input, output, minTier, syphon, consumeRate, drainRate, false);
|
||||
}
|
||||
|
||||
public AltarRecipe(ItemStack input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable)
|
||||
{
|
||||
this(Collections.singletonList(input), output, minTier, syphon, consumeRate, drainRate, fillable);
|
||||
}
|
||||
|
||||
public AltarRecipe(ItemStack input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate)
|
||||
{
|
||||
this(Collections.singletonList(input), output, minTier, syphon, consumeRate, drainRate, false);
|
||||
}
|
||||
|
||||
public AltarRecipe(String inputEntry, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable)
|
||||
{
|
||||
this(OreDictionary.doesOreNameExist(inputEntry) && OreDictionary.getOres(inputEntry).size() > 0 ? OreDictionary.getOres(inputEntry) : Collections.<ItemStack>emptyList(), output, minTier, syphon, consumeRate, drainRate, fillable);
|
||||
}
|
||||
|
||||
public AltarRecipe(String inputEntry, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate)
|
||||
{
|
||||
this(OreDictionary.doesOreNameExist(inputEntry) && OreDictionary.getOres(inputEntry).size() > 0 ? OreDictionary.getOres(inputEntry) : Collections.<ItemStack>emptyList(), output, minTier, syphon, consumeRate, drainRate, false);
|
||||
}
|
||||
|
||||
public boolean doesRequiredItemMatch(ItemStack comparedStack, EnumAltarTier tierCheck)
|
||||
{
|
||||
if (comparedStack == null || this.input == null)
|
||||
return false;
|
||||
|
||||
return tierCheck.ordinal() >= minTier.ordinal() && this.input.isItemEqual(comparedStack);// &&
|
||||
// (this.fillable this.areRequiredTagsEqual(comparedStack) : true);
|
||||
if (tierCheck.ordinal() < minTier.ordinal())
|
||||
return false;
|
||||
|
||||
for (ItemStack stack : input)
|
||||
if (comparedStack.isItemEqual(stack))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static BiMap<ItemStack, AltarRecipe> getRecipes()
|
||||
{
|
||||
return HashBiMap.create(recipes);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,6 @@ import mezz.jei.api.gui.IRecipeLayout;
|
|||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
|
||||
|
@ -61,16 +60,15 @@ public class AlchemyArrayCraftingCategory implements IRecipeCategory
|
|||
@SuppressWarnings("unchecked")
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
|
||||
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 5);
|
||||
recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 50, 5);
|
||||
recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 29, 3);
|
||||
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 73, 5);
|
||||
|
||||
if (recipeWrapper instanceof AlchemyArrayCraftingRecipeJEI)
|
||||
{
|
||||
AlchemyArrayCraftingRecipeJEI alchemyArrayWrapper = (AlchemyArrayCraftingRecipeJEI) recipeWrapper;
|
||||
recipeLayout.getItemStacks().set(INPUT_SLOT, (ItemStack) alchemyArrayWrapper.getInputs().get(0));
|
||||
recipeLayout.getItemStacks().set(CATALYST_SLOT, (ItemStack) alchemyArrayWrapper.getInputs().get(1));
|
||||
recipeLayout.getItemStacks().set(INPUT_SLOT, alchemyArrayWrapper.getInputs().subList(0, alchemyArrayWrapper.getInputs().size() - 1));
|
||||
recipeLayout.getItemStacks().set(CATALYST_SLOT, alchemyArrayWrapper.getCatalyst());
|
||||
recipeLayout.getItemStacks().set(OUTPUT_SLOT, alchemyArrayWrapper.getOutputs());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,22 +13,31 @@ import net.minecraft.item.ItemStack;
|
|||
public class AlchemyArrayCraftingRecipeJEI extends BlankRecipeWrapper
|
||||
{
|
||||
@Nonnull
|
||||
private final List<ItemStack> inputs;
|
||||
private final Object inputs;
|
||||
|
||||
@Nullable
|
||||
private final ItemStack catalyst;
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public AlchemyArrayCraftingRecipeJEI(@Nonnull ItemStack input, @Nullable ItemStack catalyst, @Nonnull ItemStack output)
|
||||
public AlchemyArrayCraftingRecipeJEI(@Nonnull List<ItemStack> input, @Nullable ItemStack catalyst, @Nonnull ItemStack output)
|
||||
{
|
||||
this.inputs = Arrays.asList(input, catalyst);
|
||||
this.inputs = input;
|
||||
this.catalyst = catalyst;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs()
|
||||
{
|
||||
return inputs;
|
||||
return Arrays.asList(inputs, catalyst);
|
||||
}
|
||||
|
||||
public ItemStack getCatalyst()
|
||||
{
|
||||
return catalyst;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,13 +19,13 @@ public class AlchemyArrayCraftingRecipeMaker
|
|||
@Nonnull
|
||||
public static List<AlchemyArrayCraftingRecipeJEI> getRecipes()
|
||||
{
|
||||
Map<ItemStackWrapper, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> alchemyArrayRecipeMap = AlchemyArrayRecipeRegistry.getRecipes();
|
||||
Map<List<ItemStack>, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> alchemyArrayRecipeMap = AlchemyArrayRecipeRegistry.getRecipes();
|
||||
|
||||
ArrayList<AlchemyArrayCraftingRecipeJEI> recipes = new ArrayList<AlchemyArrayCraftingRecipeJEI>();
|
||||
|
||||
for (Map.Entry<ItemStackWrapper, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> itemStackAlchemyArrayRecipeEntry : alchemyArrayRecipeMap.entrySet())
|
||||
for (Map.Entry<List<ItemStack>, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> itemStackAlchemyArrayRecipeEntry : alchemyArrayRecipeMap.entrySet())
|
||||
{
|
||||
ItemStack input = itemStackAlchemyArrayRecipeEntry.getValue().getInputStack();
|
||||
List<ItemStack> input = itemStackAlchemyArrayRecipeEntry.getValue().getInput();
|
||||
BiMap<ItemStackWrapper, AlchemyArrayEffect> catalystMap = itemStackAlchemyArrayRecipeEntry.getValue().catalystMap;
|
||||
|
||||
for (Map.Entry<ItemStackWrapper, AlchemyArrayEffect> entry : catalystMap.entrySet())
|
||||
|
|
|
@ -16,7 +16,7 @@ import WayofTime.bloodmagic.util.helper.TextHelper;
|
|||
public class AltarRecipeJEI extends BlankRecipeWrapper
|
||||
{
|
||||
@Nonnull
|
||||
private final ItemStack input;
|
||||
private final Object input;
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
@ -25,7 +25,7 @@ public class AltarRecipeJEI extends BlankRecipeWrapper
|
|||
private final int consumptionRate;
|
||||
private final int drainRate;
|
||||
|
||||
public AltarRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output, int tier, int requiredLP, int consumptionRate, int drainRate)
|
||||
public AltarRecipeJEI(@Nonnull List<ItemStack> input, @Nonnull ItemStack output, int tier, int requiredLP, int consumptionRate, int drainRate)
|
||||
{
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
|
|
|
@ -15,16 +15,16 @@ public class AltarRecipeMaker
|
|||
@Nonnull
|
||||
public static List<AltarRecipeJEI> getRecipes()
|
||||
{
|
||||
Map<ItemStack, AltarRecipeRegistry.AltarRecipe> altarMap = AltarRecipeRegistry.getRecipes();
|
||||
Map<List<ItemStack>, AltarRecipeRegistry.AltarRecipe> altarMap = AltarRecipeRegistry.getRecipes();
|
||||
|
||||
ArrayList<AltarRecipeJEI> recipes = new ArrayList<AltarRecipeJEI>();
|
||||
|
||||
for (Map.Entry<ItemStack, AltarRecipeRegistry.AltarRecipe> itemStackAltarRecipeEntry : altarMap.entrySet())
|
||||
for (Map.Entry<List<ItemStack>, AltarRecipeRegistry.AltarRecipe> itemStackAltarRecipeEntry : altarMap.entrySet())
|
||||
{
|
||||
if (!(itemStackAltarRecipeEntry.getKey().getItem() instanceof IBloodOrb))
|
||||
// Make sure input is not a Blood Orb. If it is, the recipe is for a filling orb, and we don't want that.
|
||||
if (!(itemStackAltarRecipeEntry.getKey().get(0).getItem() instanceof IBloodOrb))
|
||||
{
|
||||
// Make sure input is not a Blood Orb. If it is, the recipe is for a filling orb, and we don't want that.
|
||||
ItemStack input = itemStackAltarRecipeEntry.getKey();
|
||||
List<ItemStack> input = itemStackAltarRecipeEntry.getValue().getInput();
|
||||
ItemStack output = itemStackAltarRecipeEntry.getValue().getOutput();
|
||||
int requiredTier = itemStackAltarRecipeEntry.getValue().getMinTier().toInt();
|
||||
int requiredLP = itemStackAltarRecipeEntry.getValue().getSyphon();
|
||||
|
|
|
@ -61,16 +61,15 @@ public class BindingRecipeCategory implements IRecipeCategory
|
|||
@SuppressWarnings("unchecked")
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
|
||||
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 5);
|
||||
recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 50, 5);
|
||||
recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 29, 3);
|
||||
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 73, 5);
|
||||
|
||||
if (recipeWrapper instanceof BindingRecipeJEI)
|
||||
{
|
||||
BindingRecipeJEI bindingRecipe = (BindingRecipeJEI) recipeWrapper;
|
||||
recipeLayout.getItemStacks().set(INPUT_SLOT, (ItemStack) bindingRecipe.getInputs().get(0));
|
||||
recipeLayout.getItemStacks().set(CATALYST_SLOT, (ItemStack) bindingRecipe.getInputs().get(1));
|
||||
recipeLayout.getItemStacks().set(INPUT_SLOT, bindingRecipe.getInputs());
|
||||
recipeLayout.getItemStacks().set(CATALYST_SLOT, bindingRecipe.getCatalyst());
|
||||
recipeLayout.getItemStacks().set(OUTPUT_SLOT, bindingRecipe.getOutputs());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,20 +14,29 @@ public class BindingRecipeJEI extends BlankRecipeWrapper
|
|||
@Nonnull
|
||||
private final List<ItemStack> inputs;
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack catalyst;
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public BindingRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack catalyst, @Nonnull ItemStack output)
|
||||
public BindingRecipeJEI(@Nonnull List<ItemStack> input, @Nonnull ItemStack catalyst, @Nonnull ItemStack output)
|
||||
{
|
||||
this.inputs = Arrays.asList(input, catalyst);
|
||||
this.inputs = input;
|
||||
this.catalyst = catalyst;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs()
|
||||
{
|
||||
return inputs;
|
||||
return Arrays.asList(inputs, catalyst);
|
||||
}
|
||||
|
||||
public ItemStack getCatalyst()
|
||||
{
|
||||
return catalyst;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,13 +19,13 @@ public class BindingRecipeMaker
|
|||
@Nonnull
|
||||
public static List<BindingRecipeJEI> getRecipes()
|
||||
{
|
||||
Map<ItemStackWrapper, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> alchemyArrayRecipeMap = AlchemyArrayRecipeRegistry.getRecipes();
|
||||
Map<List<ItemStack>, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> alchemyArrayRecipeMap = AlchemyArrayRecipeRegistry.getRecipes();
|
||||
|
||||
ArrayList<BindingRecipeJEI> recipes = new ArrayList<BindingRecipeJEI>();
|
||||
|
||||
for (Map.Entry<ItemStackWrapper, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> itemStackAlchemyArrayRecipeEntry : alchemyArrayRecipeMap.entrySet())
|
||||
for (Map.Entry<List<ItemStack>, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> itemStackAlchemyArrayRecipeEntry : alchemyArrayRecipeMap.entrySet())
|
||||
{
|
||||
ItemStack input = itemStackAlchemyArrayRecipeEntry.getValue().getInputStack();
|
||||
List<ItemStack> input = itemStackAlchemyArrayRecipeEntry.getValue().getInput();
|
||||
BiMap<ItemStackWrapper, AlchemyArrayEffect> catalystMap = itemStackAlchemyArrayRecipeEntry.getValue().catalystMap;
|
||||
|
||||
for (Map.Entry<ItemStackWrapper, AlchemyArrayEffect> entry : catalystMap.entrySet())
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 868 B |
Loading…
Reference in a new issue