Fix client always reporting 0 LP
This commit is contained in:
parent
de08e5d0ac
commit
ad296a8e0e
|
@ -33,11 +33,6 @@ public class NetworkHelper
|
||||||
*/
|
*/
|
||||||
public static SoulNetwork getSoulNetwork(String name)
|
public static SoulNetwork getSoulNetwork(String name)
|
||||||
{
|
{
|
||||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
|
||||||
{
|
|
||||||
return new SoulNetwork(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
World world = DimensionManager.getWorld(0);
|
World world = DimensionManager.getWorld(0);
|
||||||
SoulNetwork network = (SoulNetwork) world.getMapStorage().loadData(SoulNetwork.class, name);
|
SoulNetwork network = (SoulNetwork) world.getMapStorage().loadData(SoulNetwork.class, name);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class TileImperfectRitualStone extends TileEntity implements IImperfectRi
|
||||||
@Override
|
@Override
|
||||||
public boolean performRitual(World world, BlockPos pos, ImperfectRitual imperfectRitual, EntityPlayer player)
|
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());
|
NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, imperfectRitual.getActivationCost());
|
||||||
if (imperfectRitual.onActivate(this, player))
|
if (imperfectRitual.onActivate(this, player))
|
||||||
|
|
|
@ -109,41 +109,46 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
|
||||||
int crystalLevel = ((ItemActivationCrystal) activationCrystal.getItem()).getCrystalLevel(activationCrystal);
|
int crystalLevel = ((ItemActivationCrystal) activationCrystal.getItem()).getCrystalLevel(activationCrystal);
|
||||||
if (RitualHelper.canCrystalActivate(ritual, crystalLevel))
|
if (RitualHelper.canCrystalActivate(ritual, crystalLevel))
|
||||||
{
|
{
|
||||||
SoulNetwork network = NetworkHelper.getSoulNetwork(crystalOwner);
|
if (!getWorld().isRemote)
|
||||||
|
|
||||||
if (network.getCurrentEssence() < ritual.getActivationCost() && !activator.capabilities.isCreativeMode)
|
|
||||||
{
|
{
|
||||||
ChatUtil.sendNoSpamUnloc(activator, "chat.BloodMagic.ritual.weak");
|
SoulNetwork network = NetworkHelper.getSoulNetwork(crystalOwner);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentRitual != null)
|
if (network.getCurrentEssence() < ritual.getActivationCost() && !activator.capabilities.isCreativeMode)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
network.syphon(ritual.getActivationCost());
|
ChatUtil.sendNoSpamUnloc(activator, "chat.BloodMagic.ritual.weak");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatUtil.sendNoSpamUnloc(activator, "chat.BloodMagic.ritual.activate");
|
if (currentRitual != null)
|
||||||
this.active = true;
|
currentRitual.stopRitual(this, Ritual.BreakType.ACTIVATE);
|
||||||
// Set the owner of the ritual to the crystal's owner
|
|
||||||
this.owner = crystalOwner;
|
|
||||||
|
|
||||||
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
|
} else
|
||||||
|
@ -157,7 +162,7 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
|
||||||
@Override
|
@Override
|
||||||
public void performRitual(World world, BlockPos pos)
|
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());
|
RitualEvent.RitualRunEvent event = new RitualEvent.RitualRunEvent(this, getOwner(), getCurrentRitual());
|
||||||
|
|
||||||
|
@ -171,7 +176,7 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
|
||||||
@Override
|
@Override
|
||||||
public void stopRitual(Ritual.BreakType breakType)
|
public void stopRitual(Ritual.BreakType breakType)
|
||||||
{
|
{
|
||||||
if (getCurrentRitual() != null)
|
if (!getWorld().isRemote && getCurrentRitual() != null)
|
||||||
{
|
{
|
||||||
RitualEvent.RitualStopEvent event = new RitualEvent.RitualStopEvent(this, getOwner(), getCurrentRitual(), breakType);
|
RitualEvent.RitualStopEvent event = new RitualEvent.RitualStopEvent(this, getOwner(), getCurrentRitual(), breakType);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue