Cache the bound SoulNetwork for rituals

Avoids looking up the map data once or more each tick
This commit is contained in:
Nicholas Ignoffo 2017-02-12 17:00:18 -08:00
parent 59c20971ab
commit c13be9ebce
29 changed files with 93 additions and 164 deletions

View file

@ -25,10 +25,8 @@ import WayofTime.bloodmagic.api.ritual.EnumRuneType;
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.api.saving.SoulNetwork;
import WayofTime.bloodmagic.api.soul.DemonWillHolder;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.registry.ModPotions;
import WayofTime.bloodmagic.util.Utils;
@ -67,12 +65,11 @@ public class RitualGreenGrove extends Ritual
{
World world = masterRitualStone.getWorldObj();
BlockPos pos = masterRitualStone.getBlockPos();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
int currentEssence = network.getCurrentEssence();
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
if (currentEssence < getRefreshCost())
{
network.causeNausea();
masterRitualStone.getOwnerNetwork().causeNausea();
return;
}
@ -234,7 +231,7 @@ public class RitualGreenGrove extends Ritual
}
}
network.syphon(totalGrowths * getRefreshCost());
masterRitualStone.getOwnerNetwork().syphon(totalGrowths * getRefreshCost());
}
public double getPlantGrowthChanceForWill(double will)