From 106532061d1e194a266414db8f05c7a79421c151 Mon Sep 17 00:00:00 2001 From: Nicholas Ignoffo Date: Mon, 19 Feb 2018 15:41:18 -0800 Subject: [PATCH] Alchemy Table now supports new recipe API --- .../compat/jei/BloodMagicJEIPlugin.java | 12 ++- .../AlchemyTableRecipeCategory.java | 11 +-- .../AlchemyTableRecipeHandler.java | 31 ------ .../alchemyTable/AlchemyTableRecipeJEI.java | 42 +++++--- .../alchemyTable/AlchemyTableRecipeMaker.java | 21 ---- .../core/RegistrarBloodMagicRecipes.java | 22 ++--- .../registry/AlchemyTableRecipeRegistry.java | 2 +- .../item/alchemy/ItemCuttingFluid.java | 72 ++++---------- .../ItemLivingArmourPointsUpgrade.java | 99 ++++++------------- .../AlchemyTableCustomRecipe.java | 2 +- .../AlchemyTableDyeableRecipe.java | 1 - .../AlchemyTablePotionRecipe.java | 1 - .../AlchemyTableRecipe.java | 2 +- .../bloodmagic/registry/ModRecipes.java | 73 -------------- .../bloodmagic/registry/ModRituals.java | 4 +- .../bloodmagic/ritual/RitualCrushing.java | 2 +- .../bloodmagic/tile/TileAlchemyTable.java | 66 +++++++++---- .../bloodmagic/tile/base/TileBase.java | 3 +- .../bloodmagic/blockstates/cutting_fluid.json | 2 +- .../blockstates/points_upgrade.json | 2 +- .../assets/bloodmagic/lang/en_US.lang | 6 +- 21 files changed, 167 insertions(+), 309 deletions(-) delete mode 100644 src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeHandler.java delete mode 100644 src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeMaker.java rename src/main/java/WayofTime/bloodmagic/recipe/{ => alchemyTable}/AlchemyTableCustomRecipe.java (96%) rename src/main/java/WayofTime/bloodmagic/recipe/{ => alchemyTable}/AlchemyTableRecipe.java (99%) diff --git a/src/main/java/WayofTime/bloodmagic/compat/jei/BloodMagicJEIPlugin.java b/src/main/java/WayofTime/bloodmagic/compat/jei/BloodMagicJEIPlugin.java index de5265ee..cf027782 100644 --- a/src/main/java/WayofTime/bloodmagic/compat/jei/BloodMagicJEIPlugin.java +++ b/src/main/java/WayofTime/bloodmagic/compat/jei/BloodMagicJEIPlugin.java @@ -2,8 +2,12 @@ package WayofTime.bloodmagic.compat.jei; import WayofTime.bloodmagic.api.impl.BloodMagicAPI; 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; +import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeJEI; +import WayofTime.bloodmagic.core.registry.AlchemyTableRecipeRegistry; +import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableRecipe; import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.livingArmour.LivingArmourHandler; import WayofTime.bloodmagic.util.helper.ItemHelper.LivingUpgrades; @@ -11,8 +15,6 @@ import WayofTime.bloodmagic.client.gui.GuiSoulForge; import WayofTime.bloodmagic.compat.jei.alchemyArray.AlchemyArrayCraftingCategory; import WayofTime.bloodmagic.compat.jei.alchemyArray.AlchemyArrayCraftingRecipeJEI; import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeCategory; -import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeHandler; -import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeMaker; import WayofTime.bloodmagic.compat.jei.altar.AltarRecipeCategory; import WayofTime.bloodmagic.compat.jei.altar.AltarRecipeJEI; import WayofTime.bloodmagic.compat.jei.armourDowngrade.ArmourDowngradeRecipeCategory; @@ -42,20 +44,22 @@ public class BloodMagicJEIPlugin implements IModPlugin { registry.addRecipeHandlers( new BindingRecipeHandler(), - new AlchemyTableRecipeHandler(), new ArmourDowngradeRecipeHandler() ); registry.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAltarRecipes(), Constants.Compat.JEI_CATEGORY_ALTAR); registry.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getTartaricForgeRecipes(), Constants.Compat.JEI_CATEGORY_SOULFORGE); registry.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyArrayRecipes(), Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY); + registry.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyRecipes(), Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE); + registry.addRecipes(AlchemyTableRecipeRegistry.getRecipeList(), Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE); registry.handleRecipes(RecipeBloodAltar.class, AltarRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALTAR); registry.handleRecipes(RecipeTartaricForge.class, TartaricForgeRecipeJEI::new, Constants.Compat.JEI_CATEGORY_SOULFORGE); registry.handleRecipes(RecipeAlchemyArray.class, AlchemyArrayCraftingRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY); + registry.handleRecipes(RecipeAlchemyTable.class, AlchemyTableRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE); + registry.handleRecipes(AlchemyTableRecipe.class, AlchemyTableRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE); registry.addRecipes(BindingRecipeMaker.getRecipes()); - registry.addRecipes(AlchemyTableRecipeMaker.getRecipes()); registry.addRecipes(ArmourDowngradeRecipeMaker.getRecipes()); registry.addIngredientInfo(new ItemStack(RegistrarBloodMagicItems.ALTAR_MAKER), ItemStack.class, "jei.bloodmagic.desc.altarBuilder"); diff --git a/src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeCategory.java b/src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeCategory.java index e6ded288..c15e1db3 100644 --- a/src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeCategory.java +++ b/src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeCategory.java @@ -10,13 +10,14 @@ import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.BlankRecipeCategory; +import mezz.jei.api.recipe.IRecipeCategory; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import javax.annotation.Nonnull; -public class AlchemyTableRecipeCategory extends BlankRecipeCategory { +public class AlchemyTableRecipeCategory implements IRecipeCategory { + private static final int OUTPUT_SLOT = 0; private static final int ORB_SLOT = 1; private static final int INPUT_SLOT = 2; @@ -24,8 +25,6 @@ public class AlchemyTableRecipeCategory extends BlankRecipeCategory { - @Nonnull - @Override - public Class getRecipeClass() { - return AlchemyTableRecipeJEI.class; - } - - @Override - public String getRecipeCategoryUid(@Nonnull AlchemyTableRecipeJEI recipe) { - return Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE; - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull AlchemyTableRecipeJEI recipe) { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull AlchemyTableRecipeJEI recipe) { - return true; - } -} diff --git a/src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeJEI.java b/src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeJEI.java index 3a88276f..715fb008 100644 --- a/src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeJEI.java +++ b/src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeJEI.java @@ -1,42 +1,60 @@ package WayofTime.bloodmagic.compat.jei.alchemyTable; -import WayofTime.bloodmagic.recipe.AlchemyTableRecipe; +import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyTable; +import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableRecipe; import WayofTime.bloodmagic.compat.jei.BloodMagicJEIPlugin; import WayofTime.bloodmagic.util.helper.TextHelper; import com.google.common.collect.Lists; import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.item.ItemStack; import java.util.ArrayList; import java.util.List; -public class AlchemyTableRecipeJEI extends BlankRecipeWrapper { - private AlchemyTableRecipe recipe; +public class AlchemyTableRecipeJEI implements IRecipeWrapper { + + private final List input; + private final ItemStack output; + private final int tier; + private final int syphon; + private final int ticks; public AlchemyTableRecipeJEI(AlchemyTableRecipe recipe) { - this.recipe = recipe; + this.input = recipe.getInput(); + this.output = recipe.getRecipeOutput(Lists.newArrayList()); + this.tier = recipe.getTierRequired(); + this.syphon = recipe.getLpDrained(); + this.ticks = recipe.getTicksRequired(); + } + + public AlchemyTableRecipeJEI(RecipeAlchemyTable recipe) { + this.input = recipe.getInput(); + this.output = recipe.getOutput(); + this.tier = recipe.getMinimumTier(); + this.syphon = recipe.getSyphon(); + this.ticks = recipe.getTicks(); } @Override public void getIngredients(IIngredients ingredients) { - List> expanded = BloodMagicJEIPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(recipe.getInput()); + List> expanded = BloodMagicJEIPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(input); ingredients.setInputLists(ItemStack.class, expanded); - ingredients.setOutput(ItemStack.class, recipe.getRecipeOutput(Lists.newArrayList())); + ingredients.setOutput(ItemStack.class, output); } @Override public List getTooltipStrings(int mouseX, int mouseY) { ArrayList ret = new ArrayList(); if (mouseX >= 58 && mouseX <= 78 && mouseY >= 21 && mouseY <= 34) { - ret.add(TextHelper.localize("tooltip.bloodmagic.tier", recipe.getTierRequired())); - ret.add(TextHelper.localize("jei.bloodmagic.recipe.lpDrained", recipe.getLpDrained())); - ret.add(TextHelper.localize("jei.bloodmagic.recipe.ticksRequired", recipe.getTicksRequired())); + ret.add(TextHelper.localize("tooltip.bloodmagic.tier", tier)); + ret.add(TextHelper.localize("jei.bloodmagic.recipe.lpDrained", syphon)); + ret.add(TextHelper.localize("jei.bloodmagic.recipe.ticksRequired", ticks)); } return ret; } - public AlchemyTableRecipe getRecipe() { - return recipe; + public int getTier() { + return tier; } } diff --git a/src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeMaker.java b/src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeMaker.java deleted file mode 100644 index 5ef8c619..00000000 --- a/src/main/java/WayofTime/bloodmagic/compat/jei/alchemyTable/AlchemyTableRecipeMaker.java +++ /dev/null @@ -1,21 +0,0 @@ -package WayofTime.bloodmagic.compat.jei.alchemyTable; - -import WayofTime.bloodmagic.recipe.AlchemyTableRecipe; -import WayofTime.bloodmagic.core.registry.AlchemyTableRecipeRegistry; - -import javax.annotation.Nonnull; -import java.util.ArrayList; -import java.util.List; - -public class AlchemyTableRecipeMaker { - @Nonnull - public static List getRecipes() { - List recipeList = AlchemyTableRecipeRegistry.getRecipeList(); - ArrayList recipes = new ArrayList(); - - for (AlchemyTableRecipe recipe : recipeList) - recipes.add(new AlchemyTableRecipeJEI(recipe)); - - return recipes; - } -} diff --git a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java index ed3fcbac..298b7480 100644 --- a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java @@ -94,7 +94,7 @@ public class RegistrarBloodMagicRecipes { registrar.addAlchemyTable(new ItemStack(Items.STRING, 4), 0, 100, 0, Blocks.WOOL, Items.FLINT); registrar.addAlchemyTable(new ItemStack(Items.FLINT, 2), 0, 20, 0, Blocks.GRAVEL, Items.FLINT); registrar.addAlchemyTable(new ItemStack(Items.LEATHER, 4), 100, 200, 1, Items.ROTTEN_FLESH, Items.ROTTEN_FLESH, Items.ROTTEN_FLESH, Items.ROTTEN_FLESH, Items.FLINT, Items.WATER_BUCKET); - registrar.addAlchemyTable(ItemCuttingFluid.getStack(ItemCuttingFluid.EXPLOSIVE), 500, 200, 1, "gunpowder", "gunpowder", "dustCoal"); + registrar.addAlchemyTable(ItemCuttingFluid.FluidType.EXPLOSIVE.getStack(), 500, 200, 1, "gunpowder", "gunpowder", "dustCoal"); registrar.addAlchemyTable(new ItemStack(Items.BREAD), 100, 200, 1, Items.WHEAT, Items.SUGAR); registrar.addAlchemyTable(new ItemStack(Blocks.GRASS), 200, 200, 1, Blocks.DIRT, new ItemStack(Items.DYE, 1, 15), Items.WHEAT_SEEDS); registrar.addAlchemyTable(new ItemStack(Items.CLAY_BALL, 4), 50, 100, 2, Items.WATER_BUCKET, "sand"); @@ -102,21 +102,21 @@ public class RegistrarBloodMagicRecipes { registrar.addAlchemyTable(new ItemStack(Blocks.OBSIDIAN), 50, 50, 1, Items.WATER_BUCKET, Items.LAVA_BUCKET); registrar.addAlchemyTable(ComponentTypes.SULFUR.getStack(8), 0, 100, 0, Items.LAVA_BUCKET); registrar.addAlchemyTable(ComponentTypes.SALTPETER.getStack(4), 0, 100, 0, ComponentTypes.PLANT_OIL.getStack(), ComponentTypes.PLANT_OIL.getStack(), "dustCoal"); - registrar.addAlchemyTable(new ItemStack(Items.GUNPOWDER, 3), 0, 100, 0, ComponentTypes.SALTPETER.getStack(), ComponentTypes.SULFUR.getStack(), new ItemStack(Items.COAL, 1, 1)); + registrar.addAlchemyTable(new ItemStack(Items.GUNPOWDER, 3), 0, 100, 0, "dustSaltpeter", "dustSulfur", new ItemStack(Items.COAL, 1, 1)); registrar.addAlchemyTable(ComponentTypes.SAND_COAL.getStack(4), 100, 100, 1, new ItemStack(Items.COAL, 1, 0), new ItemStack(Items.COAL, 1, 0), Items.FLINT); - registrar.addAlchemyTable(ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC), 1000, 400, 1, "dustCoal", "gunpowder", Items.REDSTONE, Items.SUGAR, ComponentTypes.PLANT_OIL.getStack(), new ItemStack(Items.POTIONITEM)); - registrar.addAlchemyTable(ComponentTypes.SAND_IRON.getStack(2), 400, 200, 1, "oreIron", ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC)); - registrar.addAlchemyTable(ComponentTypes.SAND_GOLD.getStack(2), 400, 200, 1, "oreGold", ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC)); - registrar.addAlchemyTable(new ItemStack(Items.REDSTONE, 8), 400, 200, 1, "oreRedstone", ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC)); - registrar.addAlchemyTable(new ItemStack(Blocks.GRAVEL), 50, 50, 1, "cobblestone", ItemCuttingFluid.getStack(ItemCuttingFluid.EXPLOSIVE)); - registrar.addAlchemyTable(new ItemStack(Blocks.SAND), 50, 50, 1, Blocks.GRAVEL, ItemCuttingFluid.getStack(ItemCuttingFluid.EXPLOSIVE)); + registrar.addAlchemyTable(ItemCuttingFluid.FluidType.BASIC.getStack(), 1000, 400, 1, "dustCoal", "gunpowder", Items.REDSTONE, Items.SUGAR, ComponentTypes.PLANT_OIL.getStack(), new ItemStack(Items.POTIONITEM)); + registrar.addAlchemyTable(ComponentTypes.SAND_IRON.getStack(2), 400, 200, 1, "oreIron", ItemCuttingFluid.FluidType.BASIC.getStack()); + registrar.addAlchemyTable(ComponentTypes.SAND_GOLD.getStack(2), 400, 200, 1, "oreGold", ItemCuttingFluid.FluidType.BASIC.getStack()); + registrar.addAlchemyTable(new ItemStack(Items.REDSTONE, 8), 400, 200, 1, "oreRedstone", ItemCuttingFluid.FluidType.BASIC.getStack()); + registrar.addAlchemyTable(new ItemStack(Blocks.GRAVEL), 50, 50, 1, "cobblestone", ItemCuttingFluid.FluidType.EXPLOSIVE.getStack()); + registrar.addAlchemyTable(new ItemStack(Blocks.SAND), 50, 50, 1, Blocks.GRAVEL, ItemCuttingFluid.FluidType.EXPLOSIVE.getStack()); registrar.addAlchemyTable(ComponentTypes.PLANT_OIL.getStack(), 100, 100, 1, "cropCarrot", "cropCarrot", "cropCarrot", new ItemStack(Items.DYE, 1, 15)); registrar.addAlchemyTable(ComponentTypes.PLANT_OIL.getStack(), 100, 100, 1, "cropPotato", "cropPotato", new ItemStack(Items.DYE, 1, 15)); registrar.addAlchemyTable(ComponentTypes.PLANT_OIL.getStack(), 100, 100, 1, "cropWheat", "cropWheat", new ItemStack(Items.DYE, 1, 15)); registrar.addAlchemyTable(ComponentTypes.PLANT_OIL.getStack(), 100, 100, 1, Items.BEETROOT, Items.BEETROOT, Items.BEETROOT, new ItemStack(Items.DYE, 1, 15)); registrar.addAlchemyTable(ComponentTypes.NEURO_TOXIN.getStack(), 1000, 100, 2, new ItemStack(Items.FISH, 1, 3)); registrar.addAlchemyTable(ComponentTypes.ANTISEPTIC.getStack(2), 1000, 200, 2, ComponentTypes.PLANT_OIL.getStack(), "nuggetGold", "cropWheat", Items.SUGAR, Blocks.BROWN_MUSHROOM, Blocks.RED_MUSHROOM); - registrar.addAlchemyTable(ItemLivingArmourPointsUpgrade.getStack(ItemLivingArmourPointsUpgrade.DRAFT_ANGELUS), 20000, 400, 3, ComponentTypes.NEURO_TOXIN.getStack(), ComponentTypes.ANTISEPTIC.getStack(), "dustGold", Items.FERMENTED_SPIDER_EYE, new ItemStack(RegistrarBloodMagicItems.BLOOD_SHARD, 1, 0), Items.GHAST_TEAR); + registrar.addAlchemyTable(ItemLivingArmourPointsUpgrade.UpgradeType.DRAFT_ANGELUS.getStack(), 20000, 400, 3, ComponentTypes.NEURO_TOXIN.getStack(), ComponentTypes.ANTISEPTIC.getStack(), "dustGold", Items.FERMENTED_SPIDER_EYE, new ItemStack(RegistrarBloodMagicItems.BLOOD_SHARD, 1, 0), Items.GHAST_TEAR); registrar.addAlchemyTable(new ItemStack(RegistrarBloodMagicItems.POTION_FLASK), 1000, 200, 2, new ItemStack(Items.POTIONITEM), "cropNetherWart", "dustRedstone", "dustGlowstone"); registrar.addAlchemyTable(ComponentTypes.CATALYST_LENGTH_1.getStack(), 1000, 100, 2, "gunpowder", "cropNetherWart", "gemLapis"); registrar.addAlchemyTable(ComponentTypes.CATALYST_POWER_1.getStack(), 1000, 100, 2, "gunpowder", "cropNetherWart", "dustRedstone"); @@ -132,7 +132,7 @@ public class RegistrarBloodMagicRecipes { if (dustList != null && !dustList.isEmpty() && discoveredOres != null && !discoveredOres.isEmpty()) { ItemStack dustStack = dustList.get(0).copy(); dustStack.setCount(2); - registrar.addAlchemyTable(dustStack, 400, 200, 1, ore, ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC)); + registrar.addAlchemyTable(dustStack, 400, 200, 1, ore, ItemCuttingFluid.FluidType.BASIC.getStack()); addedOreRecipeList.add(ore); } } @@ -170,7 +170,7 @@ public class RegistrarBloodMagicRecipes { registrar.addTartaricForge(ComponentTypes.REAGENT_COMPRESSION.getStack(), 2000, 200, "blockIron", "blockGold", Blocks.OBSIDIAN, "cobblestone"); registrar.addTartaricForge(ComponentTypes.REAGENT_TELEPOSITION.getStack(), 1500, 200, RegistrarBloodMagicBlocks.TELEPOSER, "glowstone", "blockRedstone", "ingotGold"); registrar.addTartaricForge(ComponentTypes.REAGENT_TRANSPOSITION.getStack(), 1500, 200, RegistrarBloodMagicBlocks.TELEPOSER, "gemDiamond", Items.ENDER_PEARL, Blocks.OBSIDIAN); - registrar.addTartaricForge(ComponentTypes.REAGENT_CLAW.getStack(), 800, 120, Items.FLINT, Items.FLINT, ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC)); + registrar.addTartaricForge(ComponentTypes.REAGENT_CLAW.getStack(), 800, 120, Items.FLINT, Items.FLINT, ItemCuttingFluid.FluidType.BASIC.getStack()); registrar.addTartaricForge(ComponentTypes.REAGENT_BOUNCE.getStack(), 200, 20, Blocks.SLIME_BLOCK, Blocks.SLIME_BLOCK, Items.LEATHER, "string"); registrar.addTartaricForge(ComponentTypes.REAGENT_FROST.getStack(), 80, 10, Blocks.ICE, Items.SNOWBALL, Items.SNOWBALL, "dustRedstone"); diff --git a/src/main/java/WayofTime/bloodmagic/core/registry/AlchemyTableRecipeRegistry.java b/src/main/java/WayofTime/bloodmagic/core/registry/AlchemyTableRecipeRegistry.java index e09a6ce6..901994a7 100644 --- a/src/main/java/WayofTime/bloodmagic/core/registry/AlchemyTableRecipeRegistry.java +++ b/src/main/java/WayofTime/bloodmagic/core/registry/AlchemyTableRecipeRegistry.java @@ -1,6 +1,6 @@ package WayofTime.bloodmagic.core.registry; -import WayofTime.bloodmagic.recipe.AlchemyTableRecipe; +import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableRecipe; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; diff --git a/src/main/java/WayofTime/bloodmagic/item/alchemy/ItemCuttingFluid.java b/src/main/java/WayofTime/bloodmagic/item/alchemy/ItemCuttingFluid.java index 490cd425..c53c6da0 100644 --- a/src/main/java/WayofTime/bloodmagic/item/alchemy/ItemCuttingFluid.java +++ b/src/main/java/WayofTime/bloodmagic/item/alchemy/ItemCuttingFluid.java @@ -1,40 +1,28 @@ package WayofTime.bloodmagic.item.alchemy; -import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.iface.ICustomAlchemyConsumable; +import WayofTime.bloodmagic.item.ItemEnum; +import WayofTime.bloodmagic.item.types.ISubItem; import WayofTime.bloodmagic.util.helper.NBTHelper; -import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; import WayofTime.bloodmagic.util.helper.TextHelper; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.List; +import java.util.Locale; -public class ItemCuttingFluid extends Item implements IVariantProvider, ICustomAlchemyConsumable { - public static final String BASIC = "basicCuttingFluid"; - public static final String EXPLOSIVE = "explosive"; - private static ArrayList names = new ArrayList(); +public class ItemCuttingFluid extends ItemEnum.Variant implements ICustomAlchemyConsumable { public ItemCuttingFluid() { - super(); + super(FluidType.class, "cutting_fluid"); - setUnlocalizedName(BloodMagic.MODID + ".cuttingFluid."); - setHasSubtypes(true); - setCreativeTab(BloodMagic.TAB_BM); setMaxStackSize(1); - - buildItemList(); } @Override @@ -46,34 +34,6 @@ public class ItemCuttingFluid extends Item implements IVariantProvider, ICustomA tooltip.add(TextHelper.localize("tooltip.bloodmagic.cuttingFluidRatio", max - getDamageOfFluid(stack), max)); } - private void buildItemList() { - names.add(0, BASIC); - names.add(1, EXPLOSIVE); - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName(stack) + names.get(stack.getItemDamage()); - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(CreativeTabs creativeTab, NonNullList list) { - if (!isInCreativeTab(creativeTab)) - return; - - for (int i = 0; i < names.size(); i++) - list.add(new ItemStack(this, 1, i)); - } - - @Override - public List> getVariants() { - List> ret = new ArrayList>(); - for (String name : names) - ret.add(new ImmutablePair(names.indexOf(name), "type=" + name)); - return ret; - } - public int getDamageOfFluid(ItemStack stack) { NBTHelper.checkNBT(stack); NBTTagCompound tag = stack.getTagCompound(); @@ -119,11 +79,21 @@ public class ItemCuttingFluid extends Item implements IVariantProvider, ICustomA return stack; } - public static ItemStack getStack(String name) { - return new ItemStack(RegistrarBloodMagicItems.CUTTING_FLUID, 1, names.indexOf(name)); - } + public enum FluidType implements ISubItem { + BASIC, + EXPLOSIVE, + ; - public static ArrayList getNames() { - return names; + @Nonnull + @Override + public String getInternalName() { + return name().toLowerCase(Locale.ROOT); + } + + @Nonnull + @Override + public ItemStack getStack(int count) { + return new ItemStack(RegistrarBloodMagicItems.CUTTING_FLUID, count, ordinal()); + } } } diff --git a/src/main/java/WayofTime/bloodmagic/item/alchemy/ItemLivingArmourPointsUpgrade.java b/src/main/java/WayofTime/bloodmagic/item/alchemy/ItemLivingArmourPointsUpgrade.java index 30e35efd..9be66674 100644 --- a/src/main/java/WayofTime/bloodmagic/item/alchemy/ItemLivingArmourPointsUpgrade.java +++ b/src/main/java/WayofTime/bloodmagic/item/alchemy/ItemLivingArmourPointsUpgrade.java @@ -1,65 +1,58 @@ package WayofTime.bloodmagic.item.alchemy; -import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; +import WayofTime.bloodmagic.item.ItemEnum; import WayofTime.bloodmagic.item.armour.ItemLivingArmour; +import WayofTime.bloodmagic.item.types.ISubItem; import WayofTime.bloodmagic.livingArmour.LivingArmour; import WayofTime.bloodmagic.util.helper.TextHelper; import com.google.common.collect.Iterables; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.MobEffects; import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; -import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.List; +import java.util.Locale; -public class ItemLivingArmourPointsUpgrade extends Item implements IVariantProvider { - public static final String DRAFT_ANGELUS = "draftAngelus"; - private static ArrayList names = new ArrayList(); +public class ItemLivingArmourPointsUpgrade extends ItemEnum.Variant { public ItemLivingArmourPointsUpgrade() { - super(); - - setUnlocalizedName(BloodMagic.MODID + ".livingPointUpgrade."); - setHasSubtypes(true); - setCreativeTab(BloodMagic.TAB_BM); - - buildItemList(); + super(UpgradeType.class, "living_point_upgrade"); } @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, World world, List tooltip, ITooltipFlag flag) { - if (!stack.hasTagCompound()) - return; - tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect("tooltip.bloodmagic.livingArmourPointsUpgrade.desc", 200)))); } @Override - public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { - EntityPlayer player = entityLiving instanceof EntityPlayer ? (EntityPlayer) entityLiving : null; + public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) { + playerIn.setActiveHand(hand); + return new ActionResult<>(EnumActionResult.SUCCESS, playerIn.getHeldItem(hand)); + } - if (player == null || !player.capabilities.isCreativeMode) { + @Override + public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { + if (!(entityLiving instanceof EntityPlayer)) + return super.onItemUseFinish(stack, worldIn, entityLiving); + + EntityPlayer player = (EntityPlayer) entityLiving; + + if (!player.capabilities.isCreativeMode) stack.shrink(1); - } if (!worldIn.isRemote) { player.addPotionEffect(new PotionEffect(MobEffects.WITHER, 300, 5)); @@ -92,51 +85,21 @@ public class ItemLivingArmourPointsUpgrade extends Item implements IVariantProvi return EnumAction.DRINK; } - @Override - public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) { - playerIn.setActiveHand(hand); - return new ActionResult(EnumActionResult.SUCCESS, playerIn.getHeldItem(hand)); - } + public enum UpgradeType implements ISubItem { - private void buildItemList() { - names.add(0, DRAFT_ANGELUS); - } + DRAFT_ANGELUS, + ; - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName(stack) + names.get(stack.getItemDamage()); - } + @Nonnull + @Override + public String getInternalName() { + return name().toLowerCase(Locale.ROOT); + } - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(CreativeTabs creativeTab, NonNullList list) { - if (!isInCreativeTab(creativeTab)) - return; - - for (int i = 0; i < names.size(); i++) - list.add(new ItemStack(this, 1, i)); - } - - @Override - public List> getVariants() { - List> ret = new ArrayList>(); - for (String name : names) - ret.add(new ImmutablePair(names.indexOf(name), "type=" + name)); - return ret; - } - - public static ItemStack getStack(String name) { - return new ItemStack(RegistrarBloodMagicItems.POINTS_UPGRADE, 1, names.indexOf(name)); - } - - public static ItemStack getStack(String key, int stackSize) { - ItemStack stack = getStack(key); - stack.setCount(stackSize); - - return stack; - } - - public static ArrayList getNames() { - return names; + @Nonnull + @Override + public ItemStack getStack(int count) { + return new ItemStack(RegistrarBloodMagicItems.POINTS_UPGRADE, count, ordinal()); + } } } diff --git a/src/main/java/WayofTime/bloodmagic/recipe/AlchemyTableCustomRecipe.java b/src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTableCustomRecipe.java similarity index 96% rename from src/main/java/WayofTime/bloodmagic/recipe/AlchemyTableCustomRecipe.java rename to src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTableCustomRecipe.java index 9af2e9d4..9e13b9aa 100644 --- a/src/main/java/WayofTime/bloodmagic/recipe/AlchemyTableCustomRecipe.java +++ b/src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTableCustomRecipe.java @@ -1,4 +1,4 @@ -package WayofTime.bloodmagic.recipe; +package WayofTime.bloodmagic.recipe.alchemyTable; import WayofTime.bloodmagic.iface.ICustomAlchemyConsumable; import net.minecraft.block.Block; diff --git a/src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTableDyeableRecipe.java b/src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTableDyeableRecipe.java index 910be33d..50e83c2b 100644 --- a/src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTableDyeableRecipe.java +++ b/src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTableDyeableRecipe.java @@ -1,7 +1,6 @@ package WayofTime.bloodmagic.recipe.alchemyTable; import WayofTime.bloodmagic.util.Constants; -import WayofTime.bloodmagic.recipe.AlchemyTableRecipe; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemBanner; diff --git a/src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTablePotionRecipe.java b/src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTablePotionRecipe.java index 33e89171..4a627ede 100644 --- a/src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTablePotionRecipe.java +++ b/src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTablePotionRecipe.java @@ -1,6 +1,5 @@ package WayofTime.bloodmagic.recipe.alchemyTable; -import WayofTime.bloodmagic.recipe.AlchemyTableRecipe; import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; diff --git a/src/main/java/WayofTime/bloodmagic/recipe/AlchemyTableRecipe.java b/src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTableRecipe.java similarity index 99% rename from src/main/java/WayofTime/bloodmagic/recipe/AlchemyTableRecipe.java rename to src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTableRecipe.java index ecea0ca4..8fbd717d 100644 --- a/src/main/java/WayofTime/bloodmagic/recipe/AlchemyTableRecipe.java +++ b/src/main/java/WayofTime/bloodmagic/recipe/alchemyTable/AlchemyTableRecipe.java @@ -1,4 +1,4 @@ -package WayofTime.bloodmagic.recipe; +package WayofTime.bloodmagic.recipe.alchemyTable; import com.google.common.collect.ImmutableList; import net.minecraft.block.Block; diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java index 072a068f..62318a39 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java @@ -5,7 +5,6 @@ import WayofTime.bloodmagic.alchemyArray.*; import WayofTime.bloodmagic.compress.CompressionRegistry; import WayofTime.bloodmagic.iface.ISigil; import WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade; -import WayofTime.bloodmagic.recipe.AlchemyTableCustomRecipe; import WayofTime.bloodmagic.core.registry.AlchemyArrayRecipeRegistry; import WayofTime.bloodmagic.core.registry.AlchemyTableRecipeRegistry; import WayofTime.bloodmagic.core.registry.LivingArmourDowngradeRecipeRegistry; @@ -15,8 +14,6 @@ import WayofTime.bloodmagic.compress.BaseCompressionHandler; import WayofTime.bloodmagic.compress.StorageBlockCraftingManager; import WayofTime.bloodmagic.core.RegistrarBloodMagic; import WayofTime.bloodmagic.core.RegistrarBloodMagicItems; -import WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid; -import WayofTime.bloodmagic.item.alchemy.ItemLivingArmourPointsUpgrade; import WayofTime.bloodmagic.item.types.ComponentTypes; import WayofTime.bloodmagic.livingArmour.downgrade.*; import WayofTime.bloodmagic.potion.BMPotionUtils; @@ -44,7 +41,6 @@ import java.util.Map.Entry; public class ModRecipes { - public static ArrayList addedOreRecipeList = new ArrayList(); static ItemStack mundaneLengtheningStack = ComponentTypes.CATALYST_LENGTH_1.getStack(); static ItemStack mundanePowerStack = ComponentTypes.CATALYST_POWER_1.getStack(); @@ -54,7 +50,6 @@ public class ModRecipes { addAltarRecipes(); addAlchemyArrayRecipes(); addAlchemyTableRecipes(); - addOreDoublingAlchemyRecipes(); addPotionRecipes(); addLivingArmourDowngradeRecipes(); } @@ -111,72 +106,7 @@ public class ModRecipes { } public static void addAlchemyTableRecipes() { - AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.STRING, 4), 0, 100, 0, Blocks.WOOL, Items.FLINT); - AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.FLINT, 2), 0, 20, 0, Blocks.GRAVEL, Items.FLINT); - AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.LEATHER, 4), 100, 200, 1, Items.ROTTEN_FLESH, Items.ROTTEN_FLESH, Items.ROTTEN_FLESH, Items.ROTTEN_FLESH, Items.FLINT, Items.WATER_BUCKET); - - AlchemyTableRecipeRegistry.registerRecipe(ItemCuttingFluid.getStack(ItemCuttingFluid.EXPLOSIVE), 500, 200, 1, "gunpowder", "gunpowder", "dustCoal"); - - AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.BREAD), 100, 200, 1, Items.WHEAT, Items.SUGAR); - AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Blocks.GRASS), 200, 200, 1, Blocks.DIRT, new ItemStack(Items.DYE, 1, 15), Items.WHEAT_SEEDS); - AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.CLAY_BALL, 4), 50, 100, 2, Items.WATER_BUCKET, "sand"); - AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Blocks.CLAY, 5), 200, 200, 1, Items.WATER_BUCKET, Blocks.HARDENED_CLAY, Blocks.HARDENED_CLAY, Blocks.HARDENED_CLAY, Blocks.HARDENED_CLAY, Blocks.HARDENED_CLAY); - AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Blocks.OBSIDIAN), 50, 50, 1, Items.WATER_BUCKET, Items.LAVA_BUCKET); - - AlchemyTableRecipeRegistry.registerRecipe(ComponentTypes.SULFUR.getStack(8), 0, 100, 0, Items.LAVA_BUCKET); - AlchemyTableRecipeRegistry.registerRecipe(ComponentTypes.SALTPETER.getStack(4), 0, 100, 0, ComponentTypes.PLANT_OIL.getStack(), ComponentTypes.PLANT_OIL.getStack(), "dustCoal"); - AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.GUNPOWDER, 3), 0, 100, 0, ComponentTypes.SALTPETER.getStack(), ComponentTypes.SULFUR.getStack(), new ItemStack(Items.COAL, 1, 1)); - - AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableCustomRecipe(ComponentTypes.SAND_COAL.getStack(4), 100, 100, 1, new ItemStack(Items.COAL, 1, 0), new ItemStack(Items.COAL, 1, 0), Items.FLINT)); - - AlchemyTableRecipeRegistry.registerRecipe(ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC), 1000, 400, 1, "dustCoal", "gunpowder", Items.REDSTONE, Items.SUGAR, ComponentTypes.PLANT_OIL.getStack(), new ItemStack(Items.POTIONITEM)); - - AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableCustomRecipe(ComponentTypes.SAND_IRON.getStack(2), 400, 200, 1, "oreIron", ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC))); - AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableCustomRecipe(ComponentTypes.SAND_GOLD.getStack(2), 400, 200, 1, "oreGold", ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC))); - - AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableCustomRecipe(new ItemStack(Items.REDSTONE, 8), 400, 200, 1, "oreRedstone", ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC))); - - addedOreRecipeList.add("oreIron"); - addedOreRecipeList.add("oreGold"); - addedOreRecipeList.add("oreCoal"); - addedOreRecipeList.add("oreRedstone"); - - AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableCustomRecipe(new ItemStack(Blocks.GRAVEL), 50, 50, 1, "cobblestone", ItemCuttingFluid.getStack(ItemCuttingFluid.EXPLOSIVE))); - AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableCustomRecipe(new ItemStack(Blocks.SAND), 50, 50, 1, Blocks.GRAVEL, ItemCuttingFluid.getStack(ItemCuttingFluid.EXPLOSIVE))); - - AlchemyTableRecipeRegistry.registerRecipe(ComponentTypes.PLANT_OIL.getStack(), 100, 100, 1, "cropCarrot", "cropCarrot", "cropCarrot", new ItemStack(Items.DYE, 1, 15)); - AlchemyTableRecipeRegistry.registerRecipe(ComponentTypes.PLANT_OIL.getStack(), 100, 100, 1, "cropPotato", "cropPotato", new ItemStack(Items.DYE, 1, 15)); - AlchemyTableRecipeRegistry.registerRecipe(ComponentTypes.PLANT_OIL.getStack(), 100, 100, 1, "cropWheat", "cropWheat", new ItemStack(Items.DYE, 1, 15)); - AlchemyTableRecipeRegistry.registerRecipe(ComponentTypes.PLANT_OIL.getStack(), 100, 100, 1, Items.BEETROOT, Items.BEETROOT, Items.BEETROOT, new ItemStack(Items.DYE, 1, 15)); - - AlchemyTableRecipeRegistry.registerRecipe(ComponentTypes.NEURO_TOXIN.getStack(), 1000, 100, 2, new ItemStack(Items.FISH, 1, 3)); - AlchemyTableRecipeRegistry.registerRecipe(ComponentTypes.ANTISEPTIC.getStack(2), 1000, 200, 2, ComponentTypes.PLANT_OIL.getStack(), "nuggetGold", "cropWheat", Items.SUGAR, Blocks.BROWN_MUSHROOM, Blocks.RED_MUSHROOM); - - AlchemyTableRecipeRegistry.registerRecipe(ItemLivingArmourPointsUpgrade.getStack(ItemLivingArmourPointsUpgrade.DRAFT_ANGELUS), 20000, 400, 3, ComponentTypes.NEURO_TOXIN.getStack(), ComponentTypes.ANTISEPTIC.getStack(), "dustGold", Items.FERMENTED_SPIDER_EYE, new ItemStack(RegistrarBloodMagicItems.BLOOD_SHARD, 1, 0), Items.GHAST_TEAR); - AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableDyeableRecipe(0, 100, 0, new ItemStack(RegistrarBloodMagicItems.SIGIL_HOLDING))); - - AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(RegistrarBloodMagicItems.POTION_FLASK), 1000, 200, 2, new ItemStack(Items.POTIONITEM), "cropNetherWart", "dustRedstone", "dustGlowstone"); - AlchemyTableRecipeRegistry.registerRecipe(ComponentTypes.CATALYST_LENGTH_1.getStack(), 1000, 100, 2, "gunpowder", "cropNetherWart", "gemLapis"); - AlchemyTableRecipeRegistry.registerRecipe(ComponentTypes.CATALYST_POWER_1.getStack(), 1000, 100, 2, "gunpowder", "cropNetherWart", "dustRedstone"); - } - - public static void addOreDoublingAlchemyRecipes() { - String[] oreList = OreDictionary.getOreNames().clone(); - for (String ore : oreList) { - if (ore.startsWith("ore") && !addedOreRecipeList.contains(ore)) { - String dustName = ore.replaceFirst("ore", "dust"); - - List discoveredOres = OreDictionary.getOres(ore); - List dustList = OreDictionary.getOres(dustName); - if (dustList != null && !dustList.isEmpty() && discoveredOres != null && !discoveredOres.isEmpty()) { - ItemStack dustStack = dustList.get(0).copy(); - dustStack.setCount(2); - AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableCustomRecipe(dustStack, 400, 200, 1, ore, ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC))); - addedOreRecipeList.add(ore); - } - } - } } public static void addPotionRecipes() { @@ -200,9 +130,6 @@ public class ModRecipes { addPotionRecipe(1000, 1, new ItemStack(Items.STRING), new PotionEffect(RegistrarBloodMagic.CLING, 2 * 60 * 20)); addPotionRecipe(1000, 1, new ItemStack(Items.BEETROOT), new PotionEffect(RegistrarBloodMagic.DEAFNESS, 450)); - -// AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTablePotionRecipe(5000, 100, 4, new ItemStack(Blocks.SLIME_BLOCK), new PotionEffect(ModPotions.bounce, 15 * 60 * 20))); -// AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTablePotionRecipe(5000, 100, 4, new ItemStack("string"), new PotionEffect(ModPotions.bounce, 15 * 60 * 20))); } public static void addPotionRecipe(int lpDrained, int tier, ItemStack inputStack, PotionEffect baseEffect) { diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java b/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java index 8f9beacc..46e18f52 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRituals.java @@ -118,8 +118,8 @@ public class ModRituals { downgradeRitual = new RitualLivingArmourDowngrade(); RitualRegistry.registerRitual(downgradeRitual, ConfigHandler.rituals.ritualDowngrade); - RitualCrushing.registerCuttingFluid(ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC), 250, 0.5); - RitualCrushing.registerCuttingFluid(ItemCuttingFluid.getStack(ItemCuttingFluid.EXPLOSIVE), 25, 0.05); + RitualCrushing.registerCuttingFluid(ItemCuttingFluid.FluidType.BASIC.getStack(), 250, 0.5); + RitualCrushing.registerCuttingFluid(ItemCuttingFluid.FluidType.EXPLOSIVE.getStack(), 25, 0.05); } public static void initImperfectRituals() { diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualCrushing.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualCrushing.java index 8a801aa6..3909f072 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualCrushing.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualCrushing.java @@ -2,7 +2,7 @@ package WayofTime.bloodmagic.ritual; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.compress.CompressionRegistry; -import WayofTime.bloodmagic.recipe.AlchemyTableRecipe; +import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableRecipe; import WayofTime.bloodmagic.core.registry.AlchemyTableRecipeRegistry; import WayofTime.bloodmagic.soul.EnumDemonWillType; import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks; diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyTable.java b/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyTable.java index 212edac9..5693df57 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyTable.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyTable.java @@ -1,9 +1,11 @@ package WayofTime.bloodmagic.tile; +import WayofTime.bloodmagic.api.impl.BloodMagicAPI; +import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyTable; import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.orb.BloodOrb; import WayofTime.bloodmagic.orb.IBloodOrb; -import WayofTime.bloodmagic.recipe.AlchemyTableRecipe; +import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableRecipe; import WayofTime.bloodmagic.core.registry.AlchemyTableRecipeRegistry; import WayofTime.bloodmagic.core.data.SoulNetwork; import WayofTime.bloodmagic.util.helper.NetworkHelper; @@ -193,14 +195,13 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, int tier = getTierOfOrb(); + // special recipes like dying AlchemyTableRecipe recipe = AlchemyTableRecipeRegistry.getMatchingRecipe(inputList, getWorld(), getPos()); if (recipe != null && (burnTime > 0 || (!getWorld().isRemote && tier >= recipe.getTierRequired() && this.getContainedLp() >= recipe.getLpDrained()))) { - if (burnTime == 1) { - IBlockState state = getWorld().getBlockState(pos); - getWorld().notifyBlockUpdate(getPos(), state, state, 3); - } + if (burnTime == 1) + notifyUpdate(); - if (canCraft(inputList, recipe)) { + if (canCraft(recipe.getRecipeOutput(inputList))) { ticksRequired = recipe.getTicksRequired(); burnTime++; @@ -228,8 +229,42 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, } else { burnTime = 0; } - } else { - burnTime = 0; + } else { // Simple recipes + RecipeAlchemyTable recipeAlchemyTable = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyTable(inputList); + if (recipeAlchemyTable != null && (burnTime > 0 || (!getWorld().isRemote && tier >= recipeAlchemyTable.getMinimumTier() && getContainedLp() >= recipeAlchemyTable.getSyphon()))) { + if (burnTime == 1) + notifyUpdate(); + + if (canCraft(recipeAlchemyTable.getOutput())) { + ticksRequired = recipeAlchemyTable.getTicks(); + burnTime++; + if (burnTime >= ticksRequired) { + if (!getWorld().isRemote) { + if (recipeAlchemyTable.getSyphon() > 0 && !getWorld().isRemote) + consumeLp(recipeAlchemyTable.getSyphon()); + + ItemStack outputSlotStack = getStackInSlot(outputSlot); + if (outputSlotStack.isEmpty()) + setInventorySlotContents(outputSlot, recipeAlchemyTable.getOutput().copy()); + else + outputSlotStack.grow(recipeAlchemyTable.getOutput().getCount()); + + for (int i = 0; i < 6; i++) { + ItemStack currentStack = getStackInSlot(i); + if (currentStack.getItem().hasContainerItem(currentStack)) + setInventorySlotContents(i, currentStack.getItem().getContainerItem(currentStack)); + else + currentStack.shrink(1); + } + + burnTime = 0; + notifyUpdate(); + } + } + } + } else { + burnTime = 0; + } } } @@ -237,20 +272,15 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, return ((double) burnTime) / ticksRequired; } - private boolean canCraft(List inputList, AlchemyTableRecipe recipe) { - if (recipe == null) { - return false; - } - - ItemStack outputStack = recipe.getRecipeOutput(inputList); + private boolean canCraft(ItemStack output) { ItemStack currentOutputStack = getStackInSlot(outputSlot); - if (outputStack.isEmpty()) + if (output.isEmpty()) return false; if (currentOutputStack.isEmpty()) return true; - if (!ItemHandlerHelper.canItemStacksStack(outputStack, currentOutputStack)) + if (!ItemHandlerHelper.canItemStacksStack(output, currentOutputStack)) return false; - int result = currentOutputStack.getCount() + outputStack.getCount(); + int result = currentOutputStack.getCount() + output.getCount(); return result <= getInventoryStackLimit() && result <= currentOutputStack.getMaxStackSize(); } @@ -292,7 +322,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory, } public void craftItem(List inputList, AlchemyTableRecipe recipe) { - if (this.canCraft(inputList, recipe)) { + if (this.canCraft(recipe.getRecipeOutput(inputList))) { ItemStack outputStack = recipe.getRecipeOutput(inputList); ItemStack currentOutputStack = getStackInSlot(outputSlot); diff --git a/src/main/java/WayofTime/bloodmagic/tile/base/TileBase.java b/src/main/java/WayofTime/bloodmagic/tile/base/TileBase.java index 56498ae8..e39ba05f 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/base/TileBase.java +++ b/src/main/java/WayofTime/bloodmagic/tile/base/TileBase.java @@ -76,7 +76,8 @@ public class TileBase extends TileEntity { } public void notifyUpdate() { - getWorld().notifyBlockUpdate(getPos(), getWorld().getBlockState(getPos()), getWorld().getBlockState(getPos()), 3); + IBlockState state = getWorld().getBlockState(getPos()); + getWorld().notifyBlockUpdate(getPos(), state, state, 3); } // Data syncing diff --git a/src/main/resources/assets/bloodmagic/blockstates/cutting_fluid.json b/src/main/resources/assets/bloodmagic/blockstates/cutting_fluid.json index fbd1ac61..0d733140 100644 --- a/src/main/resources/assets/bloodmagic/blockstates/cutting_fluid.json +++ b/src/main/resources/assets/bloodmagic/blockstates/cutting_fluid.json @@ -6,7 +6,7 @@ }, "variants": { "type": { - "basiccuttingfluid": { + "basic": { "textures": { "layer0": "bloodmagic:items/BasicCuttingFluid" } diff --git a/src/main/resources/assets/bloodmagic/blockstates/points_upgrade.json b/src/main/resources/assets/bloodmagic/blockstates/points_upgrade.json index 67ac1582..61e07141 100644 --- a/src/main/resources/assets/bloodmagic/blockstates/points_upgrade.json +++ b/src/main/resources/assets/bloodmagic/blockstates/points_upgrade.json @@ -6,7 +6,7 @@ }, "variants": { "type": { - "draftangelus": { + "draft_angelus": { "textures": { "layer0": "bloodmagic:items/Coagulant" } diff --git a/src/main/resources/assets/bloodmagic/lang/en_US.lang b/src/main/resources/assets/bloodmagic/lang/en_US.lang index d08c16c4..00a7151a 100644 --- a/src/main/resources/assets/bloodmagic/lang/en_US.lang +++ b/src/main/resources/assets/bloodmagic/lang/en_US.lang @@ -101,8 +101,8 @@ item.bloodmagic.baseComponent.antiseptic.name=Antiseptic item.bloodmagic.baseComponent.catalyst_length_1.name=Simple Lengthening Catalyst item.bloodmagic.baseComponent.catalyst_power_1.name=Simple Power Catalyst -item.bloodmagic.cuttingFluid.basicCuttingFluid.name=Basic Cutting Fluid -item.bloodmagic.cuttingFluid.explosive.name=Explosive Powder +item.bloodmagic.cutting_fluid.basic.name=Basic Cutting Fluid +item.bloodmagic.cutting_fluid.explosive.name=Explosive Powder item.bloodmagic.demonCrystal.default.name=Demon Will Crystal item.bloodmagic.demonCrystal.corrosive.name=Corrosive Will Crystal @@ -185,7 +185,7 @@ item.bloodmagic.fluidFilter.exact.name=Fluid Filter item.bloodmagic.experienceTome.name=Tome of Peritia item.bloodmagic.sanguineBook.name=Inspectoris Scandalum -item.bloodmagic.livingPointUpgrade.draftAngelus.name=Draft of Angelus +item.bloodmagic.living_point_upgrade.draft_angelus.name=Draft of Angelus item.bloodmagic.willGauge.name=Demon Will Aura Gauge item.bloodmagic.potionFlask.name=Potion Flask