diff --git a/src/main/java/WayofTime/bloodmagic/api/util/helper/NetworkHelper.java b/src/main/java/WayofTime/bloodmagic/api/util/helper/NetworkHelper.java index f806dfa1..65bca3bd 100644 --- a/src/main/java/WayofTime/bloodmagic/api/util/helper/NetworkHelper.java +++ b/src/main/java/WayofTime/bloodmagic/api/util/helper/NetworkHelper.java @@ -33,11 +33,6 @@ public class NetworkHelper */ public static SoulNetwork getSoulNetwork(String name) { - if (FMLCommonHandler.instance().getSide() == Side.CLIENT) - { - return new SoulNetwork(name); - } - World world = DimensionManager.getWorld(0); SoulNetwork network = (SoulNetwork) world.getMapStorage().loadData(SoulNetwork.class, name); diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileImperfectRitualStone.java b/src/main/java/WayofTime/bloodmagic/tile/TileImperfectRitualStone.java index b160c32d..82d5fab2 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileImperfectRitualStone.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileImperfectRitualStone.java @@ -20,7 +20,7 @@ public class TileImperfectRitualStone extends TileEntity implements IImperfectRi @Override public boolean performRitual(World world, BlockPos pos, ImperfectRitual imperfectRitual, EntityPlayer player) { - if (!PlayerHelper.isFakePlayer(player) && imperfectRitual != null && ImperfectRitualRegistry.ritualEnabled(imperfectRitual)) + if (!world.isRemote && !PlayerHelper.isFakePlayer(player) && imperfectRitual != null && ImperfectRitualRegistry.ritualEnabled(imperfectRitual)) { NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, imperfectRitual.getActivationCost()); if (imperfectRitual.onActivate(this, player)) diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java b/src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java index 1eec8b22..85ac89e2 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java @@ -109,41 +109,46 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt int crystalLevel = ((ItemActivationCrystal) activationCrystal.getItem()).getCrystalLevel(activationCrystal); if (RitualHelper.canCrystalActivate(ritual, crystalLevel)) { - SoulNetwork network = NetworkHelper.getSoulNetwork(crystalOwner); - - if (network.getCurrentEssence() < ritual.getActivationCost() && !activator.capabilities.isCreativeMode) + if (!getWorld().isRemote) { - ChatUtil.sendNoSpamUnloc(activator, "chat.BloodMagic.ritual.weak"); - return false; - } + SoulNetwork network = NetworkHelper.getSoulNetwork(crystalOwner); - if (currentRitual != null) - currentRitual.stopRitual(this, Ritual.BreakType.ACTIVATE); - - RitualEvent.RitualActivatedEvent event = new RitualEvent.RitualActivatedEvent(this, crystalOwner, ritual, activator, activationCrystal, crystalLevel); - - if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY) - { - ChatUtil.sendNoSpamUnloc(activator, "chat.BloodMagic.ritual.prevent"); - return false; - } - - if (ritual.activateRitual(this, activator)) - { - if (!activator.capabilities.isCreativeMode) + if (network.getCurrentEssence() < ritual.getActivationCost() && !activator.capabilities.isCreativeMode) { - network.syphon(ritual.getActivationCost()); + ChatUtil.sendNoSpamUnloc(activator, "chat.BloodMagic.ritual.weak"); + return false; } - ChatUtil.sendNoSpamUnloc(activator, "chat.BloodMagic.ritual.activate"); - this.active = true; - // Set the owner of the ritual to the crystal's owner - this.owner = crystalOwner; + if (currentRitual != null) + currentRitual.stopRitual(this, Ritual.BreakType.ACTIVATE); - this.currentRitual = ritual; + RitualEvent.RitualActivatedEvent event = new RitualEvent.RitualActivatedEvent(this, crystalOwner, ritual, activator, activationCrystal, crystalLevel); - return true; + if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY) + { + ChatUtil.sendNoSpamUnloc(activator, "chat.BloodMagic.ritual.prevent"); + return false; + } + + if (ritual.activateRitual(this, activator)) + { + if (!activator.capabilities.isCreativeMode) + { + network.syphon(ritual.getActivationCost()); + } + + ChatUtil.sendNoSpamUnloc(activator, "chat.BloodMagic.ritual.activate"); + this.active = true; + // Set the owner of the ritual to the crystal's owner + this.owner = crystalOwner; + + this.currentRitual = ritual; + + return true; + } } + + return true; } } } else @@ -157,7 +162,7 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt @Override public void performRitual(World world, BlockPos pos) { - if (getCurrentRitual() != null && RitualRegistry.ritualEnabled(getCurrentRitual()) && RitualHelper.checkValidRitual(getWorld(), getPos(), RitualRegistry.getIdForRitual(currentRitual), getDirection())) + if (!world.isRemote && getCurrentRitual() != null && RitualRegistry.ritualEnabled(getCurrentRitual()) && RitualHelper.checkValidRitual(getWorld(), getPos(), RitualRegistry.getIdForRitual(currentRitual), getDirection())) { RitualEvent.RitualRunEvent event = new RitualEvent.RitualRunEvent(this, getOwner(), getCurrentRitual()); @@ -171,7 +176,7 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt @Override public void stopRitual(Ritual.BreakType breakType) { - if (getCurrentRitual() != null) + if (!getWorld().isRemote && getCurrentRitual() != null) { RitualEvent.RitualStopEvent event = new RitualEvent.RitualStopEvent(this, getOwner(), getCurrentRitual(), breakType);