Orb filling recipes

This commit is contained in:
Nick 2016-01-01 19:59:10 -08:00
parent 6351fd2d3e
commit e157a68696
4 changed files with 19 additions and 19 deletions

View file

@ -307,9 +307,9 @@ public class BloodAltar
if (recipe.doesRequiredItemMatch(tileAltar.getStackInSlot(0), altarTier)) if (recipe.doesRequiredItemMatch(tileAltar.getStackInSlot(0), altarTier))
{ {
this.isActive = true; this.isActive = true;
this.result = new ItemStack(recipe.getOutput().getItem(), 1, recipe.getOutput().getMetadata()); this.result = recipe.getOutput() == null ? null : new ItemStack(recipe.getOutput().getItem(), 1, recipe.getOutput().getMetadata());
this.liquidRequired = recipe.getSyphon(); this.liquidRequired = recipe.getSyphon();
this.canBeFilled = recipe.isUseTag(); this.canBeFilled = recipe.isFillable();
this.consumptionRate = recipe.getConsumeRate(); this.consumptionRate = recipe.getConsumeRate();
this.drainRate = recipe.getDrainRate(); this.drainRate = recipe.getDrainRate();
return; return;
@ -402,14 +402,10 @@ public class BloodAltar
if (totalCharge > 0) if (totalCharge > 0)
{ {
System.out.println("Working...");
System.out.println("Total charge: " + totalCharge);
int chargeDrained = Math.min(liquidRequired * stackSize - progress, totalCharge); int chargeDrained = Math.min(liquidRequired * stackSize - progress, totalCharge);
totalCharge -= chargeDrained; totalCharge -= chargeDrained;
progress += chargeDrained; progress += chargeDrained;
System.out.println("Progress: " + progress);
hasOperated = true; hasOperated = true;
} }

View file

@ -33,7 +33,7 @@ public class Constants
public static final String ALTAR_TIER = "upgradeLevel"; public static final String ALTAR_TIER = "upgradeLevel";
public static final String ALTAR_ACTIVE = "isActive"; public static final String ALTAR_ACTIVE = "isActive";
public static final String ALTAR_LIQUID_REQ = "liquidRequired"; public static final String ALTAR_LIQUID_REQ = "liquidRequired";
public static final String ALTAR_FILLABLE = "canBeFilled"; public static final String ALTAR_FILLABLE = "fillable";
public static final String ALTAR_UPGRADED = "isUpgraded"; public static final String ALTAR_UPGRADED = "isUpgraded";
public static final String ALTAR_CONSUMPTION_RATE = "consumptionRate"; public static final String ALTAR_CONSUMPTION_RATE = "consumptionRate";
public static final String ALTAR_DRAIN_RATE = "drainRate"; public static final String ALTAR_DRAIN_RATE = "drainRate";

View file

@ -24,6 +24,10 @@ public class AltarRecipeRegistry
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 %s. Recipe already exists.", recipe.input.getDisplayName(), recipe.output == null ? "" : " -> ");
} }
public static void registerFillRecipe(ItemStack orbStack, EnumAltarTier tier, int maxForOrb, int consumeRate, int drainRate) {
registerRecipe(new AltarRecipe(orbStack, orbStack, tier, maxForOrb, consumeRate, drainRate, true));
}
public static AltarRecipe getRecipeForInput(ItemStack input) public static AltarRecipe getRecipeForInput(ItemStack input)
{ {
return recipes.get(input); return recipes.get(input);
@ -36,7 +40,7 @@ public class AltarRecipeRegistry
{ {
public final int syphon, consumeRate, drainRate; public final int syphon, consumeRate, drainRate;
public final boolean useTag; public final boolean fillable;
public final ItemStack input, output; public final ItemStack input, output;
public final EnumAltarTier minTier; public final EnumAltarTier minTier;
@ -59,10 +63,10 @@ public class AltarRecipeRegistry
* - The rate at which LP is consumed during crafting * - The rate at which LP is consumed during crafting
* @param drainRate * @param drainRate
* - The rate at which LP is drained during crafting * - The rate at which LP is drained during crafting
* @param useTag * @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 useTag) public AltarRecipe(ItemStack input, @Nullable ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable)
{ {
this.input = input; this.input = input;
this.output = output; this.output = output;
@ -70,7 +74,7 @@ public class AltarRecipeRegistry
this.syphon = syphon < 0 ? -syphon : syphon; this.syphon = syphon < 0 ? -syphon : syphon;
this.consumeRate = consumeRate < 0 ? -consumeRate : consumeRate; this.consumeRate = consumeRate < 0 ? -consumeRate : consumeRate;
this.drainRate = drainRate < 0 ? -drainRate : drainRate; this.drainRate = drainRate < 0 ? -drainRate : drainRate;
this.useTag = useTag; this.fillable = fillable;
} }
public AltarRecipe(ItemStack input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate) public AltarRecipe(ItemStack input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate)
@ -78,18 +82,13 @@ public class AltarRecipeRegistry
this(input, output, minTier, syphon, consumeRate, drainRate, false); this(input, output, minTier, syphon, consumeRate, drainRate, false);
} }
public AltarRecipe(ItemStack input, EnumAltarTier minTier, int consumeRate, int drainRate)
{
this(input, null, minTier, 0, consumeRate, drainRate);
}
public boolean doesRequiredItemMatch(ItemStack comparedStack, EnumAltarTier tierCheck) public boolean doesRequiredItemMatch(ItemStack comparedStack, EnumAltarTier tierCheck)
{ {
if (comparedStack == null || this.input == null) if (comparedStack == null || this.input == null)
return false; return false;
return tierCheck.ordinal() >= minTier.ordinal() && this.input.isItemEqual(comparedStack);// && return tierCheck.ordinal() >= minTier.ordinal() && this.input.isItemEqual(comparedStack);// &&
// (this.useTag this.areRequiredTagsEqual(comparedStack) : true); // (this.fillable this.areRequiredTagsEqual(comparedStack) : true);
} }
} }
} }

View file

@ -76,16 +76,18 @@ public class ModRecipes
public static void addAltarRecipes() public static void addAltarRecipes()
{ {
// ONE // ONE
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(OrbRegistry.getOrbStack(ModItems.orbWeak), OrbRegistry.getOrbStack(ModItems.orbWeak), EnumAltarTier.ONE, 5000, 2, 1, true)); AltarRecipeRegistry.registerFillRecipe(OrbRegistry.getOrbStack(ModItems.orbWeak), EnumAltarTier.ONE, ModItems.orbWeak.getCapacity(), 2, 1);
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.diamond), OrbRegistry.getOrbStack(ModItems.orbWeak), EnumAltarTier.ONE, 2000, 2, 1)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.diamond), OrbRegistry.getOrbStack(ModItems.orbWeak), EnumAltarTier.ONE, 2000, 2, 1));
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.stone), new ItemStack(ModItems.slate), EnumAltarTier.ONE, 1000, 5, 5)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.stone), new ItemStack(ModItems.slate), EnumAltarTier.ONE, 1000, 5, 5));
// TWO // TWO
AltarRecipeRegistry.registerFillRecipe(OrbRegistry.getOrbStack(ModItems.orbApprentice), EnumAltarTier.TWO, ModItems.orbApprentice.getCapacity(), 2, 1);
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.emerald), OrbRegistry.getOrbStack(ModItems.orbApprentice), EnumAltarTier.TWO, 5000, 2, 1)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.emerald), OrbRegistry.getOrbStack(ModItems.orbApprentice), EnumAltarTier.TWO, 5000, 2, 1));
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate), new ItemStack(ModItems.slate, 1, 1), EnumAltarTier.TWO, 2000, 5, 5)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate), new ItemStack(ModItems.slate, 1, 1), EnumAltarTier.TWO, 2000, 5, 5));
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.iron_sword), new ItemStack(ModItems.daggerOfSacrifice), EnumAltarTier.TWO, 3000, 5, 5)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.iron_sword), new ItemStack(ModItems.daggerOfSacrifice), EnumAltarTier.TWO, 3000, 5, 5));
// THREE // THREE
AltarRecipeRegistry.registerFillRecipe(OrbRegistry.getOrbStack(ModItems.orbMagician), EnumAltarTier.THREE, ModItems.orbMagician.getCapacity(), 5, 5);
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.gold_block), OrbRegistry.getOrbStack(ModItems.orbMagician), EnumAltarTier.THREE, 25000, 2, 1)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.gold_block), OrbRegistry.getOrbStack(ModItems.orbMagician), EnumAltarTier.THREE, 25000, 2, 1));
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.slate, 1, 2), EnumAltarTier.THREE, 5000, 15, 10)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.slate, 1, 2), EnumAltarTier.THREE, 5000, 15, 10));
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.obsidian), EnumRuneType.EARTH.getScribeStack(), EnumAltarTier.THREE, 1000, 5, 5)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.obsidian), EnumRuneType.EARTH.getScribeStack(), EnumAltarTier.THREE, 1000, 5, 5));
@ -95,13 +97,16 @@ public class ModRecipes
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.lavaCrystal), new ItemStack(ModItems.activationCrystal), EnumAltarTier.THREE, 10000, 20, 10)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.lavaCrystal), new ItemStack(ModItems.activationCrystal), EnumAltarTier.THREE, 10000, 20, 10));
// FOUR // FOUR
AltarRecipeRegistry.registerFillRecipe(OrbRegistry.getOrbStack(ModItems.orbMaster), EnumAltarTier.FOUR, ModItems.orbMaster.getCapacity(), 10, 10);
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate, 1, 2), new ItemStack(ModItems.slate, 1, 3), EnumAltarTier.FOUR, 15000, 20, 20)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate, 1, 2), new ItemStack(ModItems.slate, 1, 3), EnumAltarTier.FOUR, 15000, 20, 20));
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.coal_block), EnumRuneType.DUSK.getScribeStack(), EnumAltarTier.FOUR, 2000, 20, 10)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.coal_block), EnumRuneType.DUSK.getScribeStack(), EnumAltarTier.FOUR, 2000, 20, 10));
// FIVE // FIVE
AltarRecipeRegistry.registerFillRecipe(OrbRegistry.getOrbStack(ModItems.orbArchmage), EnumAltarTier.FIVE, ModItems.orbArchmage.getCapacity(), 20, 20);
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate, 1, 3), new ItemStack(ModItems.slate, 1, 4), EnumAltarTier.FIVE, 30000, 40, 100)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate, 1, 3), new ItemStack(ModItems.slate, 1, 4), EnumAltarTier.FIVE, 30000, 40, 100));
// SIX // SIX
AltarRecipeRegistry.registerFillRecipe(OrbRegistry.getOrbStack(ModItems.orbTranscendent), EnumAltarTier.SIX, ModItems.orbTranscendent.getCapacity(), 50, 50);
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModBlocks.crystal), OrbRegistry.getOrbStack(ModItems.orbTranscendent), EnumAltarTier.SIX, 200000, 100, 200)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModBlocks.crystal), OrbRegistry.getOrbStack(ModItems.orbTranscendent), EnumAltarTier.SIX, 200000, 100, 200));
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.glowstone), EnumRuneType.DAWN.getScribeStack(), EnumAltarTier.SIX, 200000, 100, 200)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.glowstone), EnumRuneType.DAWN.getScribeStack(), EnumAltarTier.SIX, 200000, 100, 200));
} }