Cache the bound SoulNetwork for rituals
Avoids looking up the map data once or more each tick
This commit is contained in:
parent
59c20971ab
commit
c13be9ebce
29 changed files with 93 additions and 164 deletions
|
@ -14,7 +14,6 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import WayofTime.bloodmagic.api.BlockStack;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
|
@ -23,8 +22,6 @@ 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.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualMagnetic extends Ritual
|
||||
|
@ -90,12 +87,11 @@ public class RitualMagnetic extends Ritual
|
|||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
|
||||
int currentEssence = network.getCurrentEssence();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNausea();
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -149,7 +145,7 @@ public class RitualMagnetic extends Ritual
|
|||
if (isBlockOre(checkStack))
|
||||
{
|
||||
Utils.swapLocations(world, newPos, world, replacement);
|
||||
network.syphon(getRefreshCost());
|
||||
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost());
|
||||
k++;
|
||||
this.lastPos = new BlockPos(i, j, k);
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue