From 526186b1ce47a746f9e65b4be63a6e1d6ebdeb70 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Fri, 7 Nov 2014 16:33:07 -0500 Subject: [PATCH] Implemented orb filling event in the altar --- .../common/tileEntity/TEAltar.java | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java index a5599459..a75f72c6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe; import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; import WayofTime.alchemicalWizardry.common.NewPacketHandler; import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.AltarUpgradeComponent; @@ -684,38 +685,18 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui { return; } - World world = MinecraftServer.getServer().worldServers[0]; - LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - - if (data == null) - { - data = new LifeEssenceNetwork(ownerName); - world.setItemData(ownerName, data); - } - - int currentEssence = data.currentEssence; if (fluid != null && fluid.amount >= 1) { int liquidDrained = Math.min((int) (upgradeLevel >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount); - if (liquidDrained > (item.getMaxEssence() * this.orbCapacityMultiplier - currentEssence)) - { - liquidDrained = (int) (item.getMaxEssence() * this.orbCapacityMultiplier - currentEssence); - } + int drain = SoulNetworkHandler.addCurrentEssenceToMaximum(ownerName, liquidDrained, (int) (item.getMaxEssence() * this.orbCapacityMultiplier)); - if (liquidDrained <= 0) - { - return; - } - - fluid.amount = fluid.amount - liquidDrained; - data.currentEssence = liquidDrained + data.currentEssence; - data.markDirty(); + fluid.amount = fluid.amount - drain; if (worldTime % 4 == 0) { - SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 3, xCoord, yCoord, zCoord); + SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 3, xCoord, yCoord, zCoord); } } }