diff --git a/src/main/java/WayofTime/bloodmagic/api/IBloodMagicRecipeRegistrar.java b/src/main/java/WayofTime/bloodmagic/api/IBloodMagicRecipeRegistrar.java index 9320886d..61123c52 100644 --- a/src/main/java/WayofTime/bloodmagic/api/IBloodMagicRecipeRegistrar.java +++ b/src/main/java/WayofTime/bloodmagic/api/IBloodMagicRecipeRegistrar.java @@ -2,9 +2,11 @@ package WayofTime.bloodmagic.api; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; +import net.minecraft.util.ResourceLocation; import javax.annotation.Nonnegative; import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * Allows recipe addition and removal. @@ -44,7 +46,7 @@ public interface IBloodMagicRecipeRegistrar { void addAlchemyTable(@Nonnull ItemStack output, @Nonnegative int syphon, @Nonnegative int ticks, @Nonnegative int minimumTier, @Nonnull Ingredient... input); /** - * Removes an Alchemy Table recipe based on an input {@link Ingredient} array. + * Removes an Alchemy Table recipe based on an input {@link ItemStack} array. * * @param input The input items to remove the recipe of. * @@ -63,11 +65,31 @@ public interface IBloodMagicRecipeRegistrar { void addTartaricForge(@Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain, @Nonnull Ingredient... input); /** - * Removes a Soul/Tartaric Forge recipe based on an input {@link Ingredient} array. + * Removes a Soul/Tartaric Forge recipe based on an input {@link ItemStack} array. * * @param input The input items to remove the recipe of. * * @return Whether or not a recipe was removed. */ boolean removeTartaricForge(@Nonnull ItemStack... input); + + /** + * Adds a new recipe to the Alchemy Array. + * + * @param input An input {@link Ingredient}. First item put into the Alchemy Array. + * @param catalyst A catalyst {@link Ingredient}. Second item put into the Alchemy Array. + * @param output An output {@link ItemStack}. + * @param circleTexture The texture to render for the Alchemy Array circle. + */ + void addAlchemyArray(@Nonnull Ingredient input, @Nonnull Ingredient catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture); + + /** + * Removes an Alchemy Array recipe based on an input {@link ItemStack} and it's catalyst {@link ItemStack}. + * + * @param input The input item to remove the recipe of. + * @param catalyst The catalyst item to remove the recipe of. + * + * @return Whether or not a recipe was removed. + */ + boolean removeAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst); } diff --git a/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicCorePlugin.java b/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicCorePlugin.java index c31010da..4d456f95 100644 --- a/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicCorePlugin.java +++ b/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicCorePlugin.java @@ -82,6 +82,7 @@ public class BloodMagicCorePlugin implements IBloodMagicPlugin { RegistrarBloodMagicRecipes.registerAltarRecipes(api.getRecipeRegistrar()); RegistrarBloodMagicRecipes.registerAlchemyTableRecipes(api.getRecipeRegistrar()); RegistrarBloodMagicRecipes.registerTartaricForgeRecipes(api.getRecipeRegistrar()); + RegistrarBloodMagicRecipes.registerAlchemyArrayRecipes(api.getRecipeRegistrar()); } private static void handleConfigValues(BloodMagicAPI api) { diff --git a/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicRecipeRegistrar.java b/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicRecipeRegistrar.java index 9e23a462..470d1ba3 100644 --- a/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicRecipeRegistrar.java +++ b/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicRecipeRegistrar.java @@ -1,6 +1,7 @@ package WayofTime.bloodmagic.api.impl; import WayofTime.bloodmagic.api.IBloodMagicRecipeRegistrar; +import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyArray; import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyTable; import WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar; import WayofTime.bloodmagic.api.impl.recipe.RecipeTartaricForge; @@ -13,6 +14,7 @@ import com.google.common.collect.Sets; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.NonNullList; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.crafting.CraftingHelper; import javax.annotation.Nonnegative; @@ -26,11 +28,13 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar { private final Set altarRecipes; private final Set alchemyRecipes; private final Set tartaricForgeRecipes; + private final Set alchemyArrayRecipes; public BloodMagicRecipeRegistrar() { this.altarRecipes = Sets.newHashSet(); this.alchemyRecipes = Sets.newHashSet(); this.tartaricForgeRecipes = Sets.newHashSet(); + this.alchemyArrayRecipes = Sets.newHashSet(); } @Override @@ -138,6 +142,31 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar { addTartaricForge(output, minimumSouls, soulDrain, ingredients.toArray(new Ingredient[0])); } + @Override + public void addAlchemyArray(@Nonnull Ingredient input, @Nonnull Ingredient catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture) { + Preconditions.checkNotNull(input, "input cannot be null."); + Preconditions.checkNotNull(catalyst, "catalyst cannot be null."); + Preconditions.checkNotNull(output, "output cannot be null."); + + alchemyArrayRecipes.add(new RecipeAlchemyArray(input, catalyst, output, circleTexture)); + } + + @Override + public boolean removeAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst) { + Preconditions.checkNotNull(input, "input cannot be null."); + Preconditions.checkNotNull(catalyst, "catalyst cannot be null."); + + return alchemyArrayRecipes.remove(getAlchemyArray(input, catalyst)); + } + + public void addAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture) { + Preconditions.checkNotNull(input, "input cannot be null."); + Preconditions.checkNotNull(catalyst, "catalyst cannot be null."); + Preconditions.checkNotNull(output, "output cannot be null."); + + addAlchemyArray(Ingredient.fromStacks(input), Ingredient.fromStacks(catalyst), output, circleTexture); + } + @Nullable public RecipeBloodAltar getBloodAltar(@Nonnull ItemStack input) { Preconditions.checkNotNull(input, "input cannot be null."); @@ -201,6 +230,19 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar { return null; } + @Nullable + public RecipeAlchemyArray getAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst) { + Preconditions.checkNotNull(input, "input cannot be null."); + if (input.isEmpty()) + return null; + + for (RecipeAlchemyArray recipe : alchemyArrayRecipes) + if (recipe.getInput().test(input) && recipe.getCatalyst().test(catalyst)) + return recipe; + + return null; + } + public Set getAltarRecipes() { return ImmutableSet.copyOf(altarRecipes); } @@ -212,4 +254,8 @@ public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar { public Set getTartaricForgeRecipes() { return ImmutableSet.copyOf(tartaricForgeRecipes); } + + public Set getAlchemyArrayRecipes() { + return ImmutableSet.copyOf(alchemyArrayRecipes); + } } diff --git a/src/main/java/WayofTime/bloodmagic/api/impl/recipe/RecipeAlchemyArray.java b/src/main/java/WayofTime/bloodmagic/api/impl/recipe/RecipeAlchemyArray.java new file mode 100644 index 00000000..02b4f153 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/api/impl/recipe/RecipeAlchemyArray.java @@ -0,0 +1,53 @@ +package WayofTime.bloodmagic.api.impl.recipe; + +import WayofTime.bloodmagic.BloodMagic; +import com.google.common.base.Preconditions; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.util.ResourceLocation; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class RecipeAlchemyArray { + + @Nonnull + private final Ingredient input; + @Nonnull + private final Ingredient catalyst; + @Nonnull + private final ItemStack output; + @Nonnull + private final ResourceLocation circleTexture; + + public RecipeAlchemyArray(@Nonnull Ingredient input, @Nonnull Ingredient catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture) { + Preconditions.checkNotNull(input, "input cannot be null."); + Preconditions.checkNotNull(catalyst, "catalyst cannot be null."); + Preconditions.checkNotNull(output, "output cannot be null."); + + this.input = input; + this.catalyst = catalyst; + this.output = output; + this.circleTexture = circleTexture == null ? new ResourceLocation(BloodMagic.MODID, "textures/models/AlchemyArrays/WIPArray.png") : circleTexture; + } + + @Nonnull + public Ingredient getInput() { + return input; + } + + @Nonnull + public Ingredient getCatalyst() { + return catalyst; + } + + @Nonnull + public ItemStack getOutput() { + return output; + } + + @Nonnull + public ResourceLocation getCircleTexture() { + return circleTexture; + } +} diff --git a/src/main/java/WayofTime/bloodmagic/apibutnotreally/alchemyCrafting/AlchemyArrayEffectCraftingNew.java b/src/main/java/WayofTime/bloodmagic/apibutnotreally/alchemyCrafting/AlchemyArrayEffectCraftingNew.java new file mode 100644 index 00000000..076c049d --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/apibutnotreally/alchemyCrafting/AlchemyArrayEffectCraftingNew.java @@ -0,0 +1,58 @@ +package WayofTime.bloodmagic.apibutnotreally.alchemyCrafting; + +import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyArray; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; + +public class AlchemyArrayEffectCraftingNew extends AlchemyArrayEffect { + + private final RecipeAlchemyArray recipe; + + public AlchemyArrayEffectCraftingNew(RecipeAlchemyArray recipe) { + this(recipe.getOutput().toString() + 200, recipe); + } + + public AlchemyArrayEffectCraftingNew(String key, RecipeAlchemyArray recipeAlchemyArray) { + super(key); + + this.recipe = recipeAlchemyArray; + } + + @Override + public boolean update(TileEntity tile, int ticksActive) { + if (tile.getWorld().isRemote) + return false; + + if (ticksActive >= 200) { + BlockPos pos = tile.getPos(); + + ItemStack output = recipe.getOutput().copy(); + + EntityItem outputEntity = new EntityItem(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output); + + tile.getWorld().spawnEntity(outputEntity); + + return true; + } + + return false; + } + + @Override + public void writeToNBT(NBTTagCompound tag) { + + } + + @Override + public void readFromNBT(NBTTagCompound tag) { + + } + + @Override + public AlchemyArrayEffect getNewCopy() { + return new AlchemyArrayEffectCraftingNew(key, recipe); + } +} diff --git a/src/main/java/WayofTime/bloodmagic/apibutnotreally/registry/AlchemyArrayRecipeRegistry.java b/src/main/java/WayofTime/bloodmagic/apibutnotreally/registry/AlchemyArrayRecipeRegistry.java index fd939ba5..06370e71 100644 --- a/src/main/java/WayofTime/bloodmagic/apibutnotreally/registry/AlchemyArrayRecipeRegistry.java +++ b/src/main/java/WayofTime/bloodmagic/apibutnotreally/registry/AlchemyArrayRecipeRegistry.java @@ -17,7 +17,7 @@ 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")); + public static final AlchemyCircleRenderer DEFAULT_RENDERER = new AlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BaseArray.png")); private static BiMap, AlchemyArrayRecipe> recipes = HashBiMap.create(); private static HashMap effectMap = new HashMap(); @@ -56,7 +56,7 @@ public class AlchemyArrayRecipeRegistry { } } - recipes.put(input, new AlchemyArrayRecipe(input, catalystStack, arrayEffect, circleRenderer == null ? defaultRenderer : circleRenderer)); + recipes.put(input, new AlchemyArrayRecipe(input, catalystStack, arrayEffect, circleRenderer == null ? DEFAULT_RENDERER : circleRenderer)); } public static AlchemyArrayEffect getAlchemyArrayEffect(String key) { @@ -136,7 +136,7 @@ public class AlchemyArrayRecipeRegistry { } public static void registerRecipe(ItemStack inputStacks, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource) { - AlchemyCircleRenderer circleRenderer = arrayResource == null ? defaultRenderer : new AlchemyCircleRenderer(arrayResource); + AlchemyCircleRenderer circleRenderer = arrayResource == null ? DEFAULT_RENDERER : new AlchemyCircleRenderer(arrayResource); registerRecipe(Collections.singletonList(inputStacks), catalystStack, arrayEffect, circleRenderer); } @@ -145,12 +145,12 @@ public class AlchemyArrayRecipeRegistry { } public static void registerRecipe(List inputStacks, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource) { - AlchemyCircleRenderer circleRenderer = arrayResource == null ? defaultRenderer : new AlchemyCircleRenderer(arrayResource); + AlchemyCircleRenderer circleRenderer = arrayResource == null ? DEFAULT_RENDERER : new AlchemyCircleRenderer(arrayResource); registerRecipe(inputStacks, catalystStack, arrayEffect, circleRenderer); } public static void registerRecipe(String inputOreDict, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource) { - AlchemyCircleRenderer circleRenderer = arrayResource == null ? defaultRenderer : new AlchemyCircleRenderer(arrayResource); + AlchemyCircleRenderer circleRenderer = arrayResource == null ? DEFAULT_RENDERER : new AlchemyCircleRenderer(arrayResource); registerRecipe(OreDictionary.doesOreNameExist(inputOreDict) && OreDictionary.getOres(inputOreDict).size() > 0 ? OreDictionary.getOres(inputOreDict) : Collections.emptyList(), catalystStack, arrayEffect, circleRenderer); } @@ -185,7 +185,7 @@ public class AlchemyArrayRecipeRegistry { for (Entry, AlchemyArrayRecipe> entry : recipes.entrySet()) { AlchemyArrayRecipe arrayRecipe = entry.getValue(); if (input.size() == 1 && arrayRecipe.getInput().size() == 1) { - if (ItemStackWrapper.getHolder(arrayRecipe.getInput().get(0)).equals(ItemStackWrapper.getHolder(input.get(0)))) { + if (ItemStack.areItemsEqual(input.get(0), arrayRecipe.input.get(0))) { AlchemyArrayEffect effect = arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack); if (effect != null) { return effect.getNewCopy(); @@ -220,7 +220,7 @@ public class AlchemyArrayRecipeRegistry { } } - return defaultRenderer; + return DEFAULT_RENDERER; } public static AlchemyCircleRenderer getAlchemyCircleRenderer(ItemStack itemStack, @Nullable ItemStack catalystStack) { diff --git a/src/main/java/WayofTime/bloodmagic/client/render/block/RenderAlchemyArray.java b/src/main/java/WayofTime/bloodmagic/client/render/block/RenderAlchemyArray.java index a886a981..023db61e 100644 --- a/src/main/java/WayofTime/bloodmagic/client/render/block/RenderAlchemyArray.java +++ b/src/main/java/WayofTime/bloodmagic/client/render/block/RenderAlchemyArray.java @@ -1,5 +1,7 @@ package WayofTime.bloodmagic.client.render.block; +import WayofTime.bloodmagic.api.impl.BloodMagicAPI; +import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyArray; import WayofTime.bloodmagic.apibutnotreally.alchemyCrafting.AlchemyCircleRenderer; import WayofTime.bloodmagic.apibutnotreally.registry.AlchemyArrayRecipeRegistry; import WayofTime.bloodmagic.tile.TileAlchemyArray; @@ -13,6 +15,11 @@ public class RenderAlchemyArray extends TileEntitySpecialRenderer 0 ? craftTime + partialTicks : 0)); } diff --git a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java index e0d3d6e3..aeeefd25 100644 --- a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java @@ -7,6 +7,7 @@ import WayofTime.bloodmagic.apibutnotreally.registry.OrbRegistry; import WayofTime.bloodmagic.apibutnotreally.ritual.EnumRuneType; import WayofTime.bloodmagic.apibutnotreally.soul.EnumDemonWillType; import WayofTime.bloodmagic.block.BlockLifeEssence; +import WayofTime.bloodmagic.item.ItemComponent; import WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid; import WayofTime.bloodmagic.item.soul.ItemSoulGem; import WayofTime.bloodmagic.item.types.ComponentTypes; @@ -139,4 +140,31 @@ public class RegistrarBloodMagicRecipes { registrar.addTartaricForge(new ItemStack(RegistrarBloodMagicBlocks.DEMON_CRYSTALLIZER), 500, 100, RegistrarBloodMagicBlocks.SOUL_FORGE, "stone", "gemLapis", "blockGlass"); registrar.addTartaricForge(new ItemStack(RegistrarBloodMagicItems.DEMON_WILL_GAUGE), 400, 50, "ingotGold", "dustRedstone", "blockGlass", RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL); } + + public static void registerAlchemyArrayRecipes(BloodMagicRecipeRegistrar registrar) { + registrar.addAlchemyArray(new ItemStack(Items.REDSTONE), new ItemStack(RegistrarBloodMagicItems.SLATE), new ItemStack(RegistrarBloodMagicItems.SIGIL_DIVINATION), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/DivinationSigil.png")); + + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_WATER), new ItemStack(RegistrarBloodMagicItems.SLATE), new ItemStack(RegistrarBloodMagicItems.SIGIL_WATER), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WaterSigil.png")); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_LAVA), new ItemStack(RegistrarBloodMagicItems.SLATE), new ItemStack(RegistrarBloodMagicItems.SIGIL_LAVA), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/LavaSigil.png")); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_AIR), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_AIR), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/AirSigil.png")); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_FASTMINER), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_FAST_MINER), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/FastMinerSigil.png")); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_VOID), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_VOID), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/VoidSigil.png")); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_GROWTH), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_GREEN_GROVE), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/GrowthSigil.png")); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_AFFINITY), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2), new ItemStack(RegistrarBloodMagicItems.SIGIL_ELEMENTAL_AFFINITY), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/ElementalAffinitySigil.png")); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_SIGHT), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_SEER), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SightSigil.png")); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_HOLDING), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2), new ItemStack(RegistrarBloodMagicItems.SIGIL_HOLDING), null); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_BLOODLIGHT), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2), new ItemStack(RegistrarBloodMagicItems.SIGIL_BLOOD_LIGHT), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/LightSigil.png")); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_MAGNETISM), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2), new ItemStack(RegistrarBloodMagicItems.SIGIL_MAGNETISM), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/MagnetismSigil.png")); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_SUPPRESSION), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_SUPPRESSION), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SuppressionSigil.png")); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_HASTE), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_HASTE), null); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_BRIDGE), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_PHANTOM_BRIDGE), null); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_COMPRESSION), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_COMPRESSION), null); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_SEVERANCE), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_ENDER_SEVERANCE), null); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_TELEPOSITION), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_TELEPOSITION), null); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_TRANSPOSITION), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_TRANSPOSITION), null); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_CLAW), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2), new ItemStack(RegistrarBloodMagicItems.SIGIL_CLAW), null); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_BOUNCE), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_BOUNCE), null); + registrar.addAlchemyArray(ItemComponent.getStack(ItemComponent.REAGENT_FROST), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_FROST), null); + + } } diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java index df3172e8..06dd3e5d 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java @@ -82,30 +82,6 @@ public class ModRecipes { AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.IRON_LEGGINGS), new AlchemyArrayEffectBinding("livingLegs", new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_LEGGINGS))); AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.IRON_BOOTS), new AlchemyArrayEffectBinding("livingBoots", new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_BOOTS))); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(new ItemStack(Items.REDSTONE), new ItemStack(RegistrarBloodMagicItems.SLATE), new ItemStack(RegistrarBloodMagicItems.SIGIL_DIVINATION), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/DivinationSigil.png")); - - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_WATER), new ItemStack(RegistrarBloodMagicItems.SLATE), new ItemStack(RegistrarBloodMagicItems.SIGIL_WATER), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WaterSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_LAVA), new ItemStack(RegistrarBloodMagicItems.SLATE), new ItemStack(RegistrarBloodMagicItems.SIGIL_LAVA), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/LavaSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_AIR), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_AIR), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/AirSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_FASTMINER), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_FAST_MINER), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/FastMinerSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_VOID), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_VOID), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/VoidSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_GROWTH), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_GREEN_GROVE), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/GrowthSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_AFFINITY), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2), new ItemStack(RegistrarBloodMagicItems.SIGIL_ELEMENTAL_AFFINITY), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/ElementalAffinitySigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_SIGHT), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_SEER), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SightSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_HOLDING), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2), new ItemStack(RegistrarBloodMagicItems.SIGIL_HOLDING), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BLOODLIGHT), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2), new ItemStack(RegistrarBloodMagicItems.SIGIL_BLOOD_LIGHT), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/LightSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_MAGNETISM), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2), new ItemStack(RegistrarBloodMagicItems.SIGIL_MAGNETISM), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/MagnetismSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_SUPPRESSION), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_SUPPRESSION), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SuppressionSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_HASTE), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_HASTE), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BRIDGE), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_PHANTOM_BRIDGE), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_COMPRESSION), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_COMPRESSION), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_SEVERANCE), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_ENDER_SEVERANCE), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_TELEPOSITION), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_TELEPOSITION), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_TRANSPOSITION), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 3), new ItemStack(RegistrarBloodMagicItems.SIGIL_TRANSPOSITION), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_CLAW), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 2), new ItemStack(RegistrarBloodMagicItems.SIGIL_CLAW), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BOUNCE), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_BOUNCE), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_FROST), new ItemStack(RegistrarBloodMagicItems.SLATE, 1, 1), new ItemStack(RegistrarBloodMagicItems.SIGIL_FROST), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png")); - AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.ROTTEN_FLESH), new ItemStack(Items.ROTTEN_FLESH), new AlchemyArrayEffectAttractor("attractor"), new AttractorAlchemyCircleRenderer()); AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.FEATHER), new ItemStack(Items.REDSTONE), new AlchemyArrayEffectMovement("movement"), new StaticAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/MovementArray.png"))); AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.FEATHER), new ItemStack(Items.GLOWSTONE_DUST), new AlchemyArrayEffectUpdraft("updraft"), new AttractorAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/UpdraftArray.png"))); diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java b/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java index 39d77472..2fddf46c 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java @@ -1,7 +1,10 @@ package WayofTime.bloodmagic.tile; +import WayofTime.bloodmagic.api.impl.BloodMagicAPI; +import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyArray; import WayofTime.bloodmagic.apibutnotreally.Constants; import WayofTime.bloodmagic.apibutnotreally.alchemyCrafting.AlchemyArrayEffect; +import WayofTime.bloodmagic.apibutnotreally.alchemyCrafting.AlchemyArrayEffectCraftingNew; import WayofTime.bloodmagic.apibutnotreally.iface.IAlchemyArray; import WayofTime.bloodmagic.apibutnotreally.registry.AlchemyArrayRecipeRegistry; import net.minecraft.block.state.IBlockState; @@ -107,7 +110,18 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche } } } else { - return false; + RecipeAlchemyArray recipe = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyArray(getStackInSlot(0), getStackInSlot(1)); + if (recipe == null) + return false; + + AlchemyArrayEffect newEffect = new AlchemyArrayEffectCraftingNew(recipe); + if (arrayEffect == null) { + arrayEffect = newEffect; + key = newEffect.key; + } else if (!newEffect.key.equals(key)) { + arrayEffect = newEffect; + key = newEffect.key; + } } if (arrayEffect != null) {