Fixed crashing when loaded on a server

This commit is contained in:
Sollace 2019-01-27 20:22:47 +02:00
parent f47ad82999
commit e6f8bb47dd
4 changed files with 14 additions and 6 deletions

View file

@ -125,8 +125,10 @@ public class Unicopia implements IGuiHandler {
.listenFor(MsgPlayerCapabilities.class)
.listenFor(MsgPlayerAbility.class);
MAGIC_PARTICLE = Particles.instance().registerParticle(new EntityMagicFX.Factory());
RAIN_PARTICLE = Particles.instance().registerParticle(new EntityRaindropFX.Factory());
if (event.getSide().isClient()) {
MAGIC_PARTICLE = Particles.instance().registerParticle(new EntityMagicFX.Factory());
RAIN_PARTICLE = Particles.instance().registerParticle(new EntityRaindropFX.Factory());
}
PowersRegistry.instance().init();

View file

@ -102,7 +102,10 @@ public class PowerGrow implements IPower<Location> {
@Override
public void preApply(IPlayer player) {
player.addExertion(3);
IPower.spawnParticles(Unicopia.MAGIC_PARTICLE, player, 1);
if (player.getWorld().isRemote) {
IPower.spawnParticles(Unicopia.MAGIC_PARTICLE, player, 1);
}
}
@Override

View file

@ -157,11 +157,15 @@ public class PowerTeleport implements IPower<Location> {
public void preApply(IPlayer player) {
player.addExertion(3);
IPower.spawnParticles(Unicopia.MAGIC_PARTICLE, player, 5);
if (player.getWorld().isRemote) {
IPower.spawnParticles(Unicopia.MAGIC_PARTICLE, player, 5);
}
}
@Override
public void postApply(IPlayer player) {
IPower.spawnParticles(Unicopia.MAGIC_PARTICLE, player, 5);
if (player.getWorld().isRemote) {
IPower.spawnParticles(Unicopia.MAGIC_PARTICLE, player, 5);
}
}
}

View file

@ -52,7 +52,6 @@ public class SpellShield extends AbstractSpell {
}
protected void spawnParticles(ICaster<?> source, int strength) {
source.spawnParticles(new Sphere(true, strength), strength * 6, pos -> {
Particles.instance().spawnParticle(Unicopia.MAGIC_PARTICLE, false, pos.x, pos.y, pos.z, 0, 0, 0);
});