Fixed Orb filling and added the Weak Blood Orb as a fillable orb.

This commit is contained in:
WayofTime 2015-12-22 21:03:00 -05:00
parent 4145b2a11c
commit f1a3c5ee46
3 changed files with 23 additions and 14 deletions

View file

@ -21,6 +21,7 @@ import WayofTime.bloodmagic.api.altar.EnumAltarTier;
import WayofTime.bloodmagic.api.altar.IAltarComponent; import WayofTime.bloodmagic.api.altar.IAltarComponent;
import WayofTime.bloodmagic.api.orb.IBloodOrb; import WayofTime.bloodmagic.api.orb.IBloodOrb;
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry; import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry.AltarRecipe;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper; import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.block.BlockBloodRune; import WayofTime.bloodmagic.block.BlockBloodRune;
import WayofTime.bloodmagic.block.BlockLifeEssence; import WayofTime.bloodmagic.block.BlockLifeEssence;
@ -263,19 +264,15 @@ public class BloodAltar {
if (tileAltar.getStackInSlot(0) != null) { if (tileAltar.getStackInSlot(0) != null) {
// Do recipes // Do recipes
for (ItemStack itemStack : AltarRecipeRegistry.getRecipes().keySet()) { for (AltarRecipe recipe : AltarRecipeRegistry.getRecipes().values()) {
if (tileAltar.getStackInSlot(0).getIsItemStackEqual(AltarRecipeRegistry.getRecipes().get(itemStack).getInput())) { if (recipe.doesRequiredItemMatch(tileAltar.getStackInSlot(0), altarTier)) {
AltarRecipeRegistry.AltarRecipe recipe = AltarRecipeRegistry.getRecipeForInput(itemStack); this.isActive = true;
this.result = new ItemStack(recipe.getOutput().getItem(), 1, recipe.getOutput().getMetadata());
if (altarTier.ordinal() >= recipe.getMinTier().ordinal()) { this.liquidRequired = recipe.getSyphon();
this.isActive = true; this.canBeFilled = recipe.isUseTag();
this.result = new ItemStack(recipe.getOutput().getItem(), 1, recipe.getOutput().getMetadata()); this.consumptionRate = recipe.getConsumeRate();
this.liquidRequired = recipe.getSyphon(); this.drainRate = recipe.getDrainRate();
this.canBeFilled = recipe.isUseTag(); return;
this.consumptionRate = recipe.getConsumeRate();
this.drainRate = recipe.getDrainRate();
return;
}
} }
} }
} }
@ -343,7 +340,7 @@ public class BloodAltar {
float f1 = f * 0.6F + 0.4F; float f1 = f * 0.6F + 0.4F;
float f2 = f * f * 0.7F - 0.5F; float f2 = f * f * 0.7F - 0.5F;
float f3 = f * f * 0.6F - 0.7F; float f3 = f * f * 0.6F - 0.7F;
if (!canBeFilled) { if (!canBeFilled) {
if (fluid != null && fluid.amount >= 1) { if (fluid != null && fluid.amount >= 1) {
int stackSize = tileAltar.getStackInSlot(0).stackSize; int stackSize = tileAltar.getStackInSlot(0).stackSize;
@ -379,6 +376,7 @@ public class BloodAltar {
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3); world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3);
} }
} else { } else {
System.out.println("Test2");
ItemStack returnedItem = tileAltar.getStackInSlot(0); ItemStack returnedItem = tileAltar.getStackInSlot(0);
if (!(returnedItem.getItem() instanceof IBloodOrb)) if (!(returnedItem.getItem() instanceof IBloodOrb))

View file

@ -83,5 +83,15 @@ public class AltarRecipeRegistry {
public AltarRecipe(ItemStack input, EnumAltarTier minTier, int consumeRate, int drainRate) { public AltarRecipe(ItemStack input, EnumAltarTier minTier, int consumeRate, int drainRate) {
this(input, null, minTier, 0, consumeRate, drainRate); this(input, null, minTier, 0, consumeRate, drainRate);
} }
public boolean doesRequiredItemMatch(ItemStack comparedStack, EnumAltarTier tierCheck)
{
if (comparedStack == null || this.input == null)
{
return false;
}
return tierCheck.ordinal() >= minTier.ordinal() && this.input.isItemEqual(comparedStack);// && (this.useTag ? this.areRequiredTagsEqual(comparedStack) : true);
}
} }
} }

View file

@ -16,6 +16,7 @@ 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.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.diamond), OrbRegistry.getOrbStack(ModItems.orbWeak), EnumAltarTier.ONE, 2000, 2, 1, false)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.diamond), OrbRegistry.getOrbStack(ModItems.orbWeak), EnumAltarTier.ONE, 2000, 2, 1, false));
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.stone), new ItemStack(ModItems.slate), EnumAltarTier.ONE, 1000, 5, 5, false)); AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.stone), new ItemStack(ModItems.slate), EnumAltarTier.ONE, 1000, 5, 5, false));