fix: more potion effect desync fixed

This commit is contained in:
WinDanesz
2026-05-12 15:12:13 +00:00
parent 255d5add29
commit ae7064f5be
24 changed files with 58 additions and 54 deletions
@@ -274,7 +274,7 @@ public final class WizardryEventHandler {
if(event.getEntityLiving().isPotionActive(WizardryPotions.ice_shroud) if(event.getEntityLiving().isPotionActive(WizardryPotions.ice_shroud)
&& !MagicDamage.isEntityImmune(DamageType.FROST, event.getEntityLiving()) && !MagicDamage.isEntityImmune(DamageType.FROST, event.getEntityLiving())
&& !(attacker instanceof FakePlayer)) // Fake players cause problems && !(attacker instanceof FakePlayer)) // Fake players cause problems
attacker.addPotionEffect(new PotionEffect(WizardryPotions.frost, if(!world.isRemote) attacker.addPotionEffect(new PotionEffect(WizardryPotions.frost,
Spells.ice_shroud.getProperty(Spell.EFFECT_DURATION).intValue(), Spells.ice_shroud.getProperty(Spell.EFFECT_DURATION).intValue(),
Spells.ice_shroud.getProperty(Spell.EFFECT_STRENGTH).intValue())); Spells.ice_shroud.getProperty(Spell.EFFECT_STRENGTH).intValue()));
@@ -326,7 +326,7 @@ public final class WizardryEventHandler {
level = EnchantmentHelper.getEnchantmentLevel(WizardryEnchantments.freezing_weapon, level = EnchantmentHelper.getEnchantmentLevel(WizardryEnchantments.freezing_weapon,
attacker.getHeldItemMainhand()); attacker.getHeldItemMainhand());
// Frost lasts for longer because it doesn't do any actual damage // Frost lasts for longer because it doesn't do any actual damage
if(level > 0 && !MagicDamage.isEntityImmune(DamageType.FROST, event.getEntityLiving())) if(!event.getEntityLiving().world.isRemote && level > 0 && !MagicDamage.isEntityImmune(DamageType.FROST, event.getEntityLiving()))
event.getEntityLiving().addPotionEffect(new PotionEffect(WizardryPotions.frost, level * 200, 0)); event.getEntityLiving().addPotionEffect(new PotionEffect(WizardryPotions.frost, level * 200, 0));
} }
} }
@@ -338,7 +338,7 @@ public final class WizardryEventHandler {
int level = event.getSource().getImmediateSource().getEntityData() int level = event.getSource().getImmediateSource().getEntityData()
.getInteger(FreezingWeapon.FREEZING_ARROW_NBT_KEY); .getInteger(FreezingWeapon.FREEZING_ARROW_NBT_KEY);
if(level > 0 && !MagicDamage.isEntityImmune(DamageType.FROST, event.getEntityLiving())) if(!event.getEntityLiving().world.isRemote && level > 0 && !MagicDamage.isEntityImmune(DamageType.FROST, event.getEntityLiving()))
event.getEntityLiving().addPotionEffect(new PotionEffect(WizardryPotions.frost, level * 150, 0)); event.getEntityLiving().addPotionEffect(new PotionEffect(WizardryPotions.frost, level * 150, 0));
} }
@@ -62,7 +62,7 @@ public class BlockPermafrost extends BlockDryFrostedIce {
entity.attackEntityFrom(DamageSource.MAGIC, Spells.permafrost.getProperty(Spell.DAMAGE).floatValue()); entity.attackEntityFrom(DamageSource.MAGIC, Spells.permafrost.getProperty(Spell.DAMAGE).floatValue());
int duration = Spells.permafrost.getProperty(Spell.EFFECT_DURATION).intValue(); int duration = Spells.permafrost.getProperty(Spell.EFFECT_DURATION).intValue();
int amplifier = Spells.permafrost.getProperty(Spell.EFFECT_STRENGTH).intValue(); int amplifier = Spells.permafrost.getProperty(Spell.EFFECT_STRENGTH).intValue();
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(WizardryPotions.frost, duration, amplifier)); if(!world.isRemote) ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(WizardryPotions.frost, duration, amplifier));
} }
// EntityLivingBase's slipperiness code doesn't get the block below it properly so slipperiness only works for // EntityLivingBase's slipperiness code doesn't get the block below it properly so slipperiness only works for
@@ -68,9 +68,11 @@ public class BlockSnare extends Block implements ITileEntityProvider {
entity.attackEntityFrom(source, Spells.snare.getProperty(Spell.DAMAGE).floatValue()); entity.attackEntityFrom(source, Spells.snare.getProperty(Spell.DAMAGE).floatValue());
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, if(!world.isRemote){
Spells.snare.getProperty(Spell.EFFECT_DURATION).intValue(), ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS,
Spells.snare.getProperty(Spell.EFFECT_STRENGTH).intValue())); Spells.snare.getProperty(Spell.EFFECT_DURATION).intValue(),
Spells.snare.getProperty(Spell.EFFECT_STRENGTH).intValue()));
}
if(!world.isRemote) world.destroyBlock(pos, false); if(!world.isRemote) world.destroyBlock(pos, false);
} }
@@ -62,7 +62,7 @@ public class EntityBlizzard extends EntityScaledConstruct {
} }
// All entities are slowed, even the caster (except those immune to frost effects) // All entities are slowed, even the caster (except those immune to frost effects)
if(!MagicDamage.isEntityImmune(DamageType.FROST, target)) if(!world.isRemote && !MagicDamage.isEntityImmune(DamageType.FROST, target))
target.addPotionEffect(new PotionEffect(WizardryPotions.frost, 20, 0)); target.addPotionEffect(new PotionEffect(WizardryPotions.frost, 20, 0));
} }
@@ -81,7 +81,7 @@ public class EntityEarthquake extends EntityMagicConstruct { // NOT a scaled con
target.attackEntityFrom( target.attackEntityFrom(
MagicDamage.causeIndirectMagicDamage(this, this.getCaster(), DamageType.BLAST), MagicDamage.causeIndirectMagicDamage(this, this.getCaster(), DamageType.BLAST),
10 * this.damageMultiplier); 10 * this.damageMultiplier);
target.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 400, 1)); if(!world.isRemote) target.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 400, 1));
} }
// All targets are thrown, even those immune to the damage, so they don't fall into the ground. // All targets are thrown, even those immune to the damage, so they don't fall into the ground.
@@ -145,7 +145,7 @@ public class EntityWitheringTotem extends EntityScaledConstruct {
for(EntityLivingBase target : nearby){ for(EntityLivingBase target : nearby){
if(EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(this, if(!world.isRemote && EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(this,
getCaster(), DamageType.MAGIC), damage)){ getCaster(), DamageType.MAGIC), damage)){
target.addPotionEffect(new PotionEffect(MobEffects.WITHER, Spells.withering_totem.getProperty(Spell.EFFECT_DURATION).intValue(), target.addPotionEffect(new PotionEffect(MobEffects.WITHER, Spells.withering_totem.getProperty(Spell.EFFECT_DURATION).intValue(),
Spells.withering_totem.getProperty(Spell.EFFECT_STRENGTH).intValue())); Spells.withering_totem.getProperty(Spell.EFFECT_STRENGTH).intValue()));
@@ -32,11 +32,11 @@ public class EntityHuskMinion extends EntityZombieMinion {
boolean flag = super.attackEntityAsMob(target); boolean flag = super.attackEntityAsMob(target);
if(flag && this.getHeldItemMainhand().isEmpty() && target instanceof EntityLivingBase){ if(flag && !this.world.isRemote && this.getHeldItemMainhand().isEmpty() && target instanceof EntityLivingBase){
float f = this.world.getDifficultyForLocation(new BlockPos(this)).getAdditionalDifficulty(); float f = this.world.getDifficultyForLocation(new BlockPos(this)).getAdditionalDifficulty();
((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.HUNGER, 140 * (int)f)); ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.HUNGER, 140 * (int)f));
} }
return flag; return flag;
} }
} }
@@ -119,7 +119,7 @@ public class EntityIceGiant extends EntityIronGolem implements ISummonedCreature
target.motionX += this.getLookVec().x * 0.2; target.motionX += this.getLookVec().x * 0.2;
target.motionZ += this.getLookVec().z * 0.2; target.motionZ += this.getLookVec().z * 0.2;
target.addPotionEffect(new PotionEffect(WizardryPotions.frost, 300, 0)); if(!target.world.isRemote) target.addPotionEffect(new PotionEffect(WizardryPotions.frost, 300, 0));
this.applyEnchantments(this, target); this.applyEnchantments(this, target);
@@ -120,7 +120,7 @@ public class EntityMagicSlime extends EntitySlime implements ISummonedCreature {
&& ((EntityLivingBase)this.getRidingEntity()).getHealth() > 0){ && ((EntityLivingBase)this.getRidingEntity()).getHealth() > 0){
if(this.ticksExisted % 16 == 1){ if(this.ticksExisted % 16 == 1){
this.getRidingEntity().attackEntityFrom(DamageSource.MAGIC, 1); this.getRidingEntity().attackEntityFrom(DamageSource.MAGIC, 1);
if(this.getRidingEntity() != null){ // Some mobs force-dismount when attacked (normally when dying) if(this.getRidingEntity() != null && !this.world.isRemote){ // Some mobs force-dismount when attacked (normally when dying)
((EntityLivingBase)this.getRidingEntity()) ((EntityLivingBase)this.getRidingEntity())
.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 20, 2)); .addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 20, 2));
} }
@@ -129,7 +129,7 @@ public class EntitySpiderMinion extends EntityCaveSpider implements ISummonedCre
seconds = 15; seconds = 15;
} }
if(seconds > 0){ if(seconds > 0 && !target.world.isRemote){
target.addPotionEffect(new PotionEffect(MobEffects.POISON, seconds * 20, 0)); target.addPotionEffect(new PotionEffect(MobEffects.POISON, seconds * 20, 0));
} }
} }
@@ -139,7 +139,7 @@ public class EntityWitherSkeletonMinion extends EntityWitherSkeleton implements
@Override @Override
public void onSuccessfulAttack(EntityLivingBase target){ public void onSuccessfulAttack(EntityLivingBase target){
target.addPotionEffect(new PotionEffect(MobEffects.WITHER, 200)); if(!target.world.isRemote) target.addPotionEffect(new PotionEffect(MobEffects.WITHER, 200));
} }
@Override @Override
@@ -359,7 +359,7 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp
this.updateRecipes = false; this.updateRecipes = false;
} }
this.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 0)); if(!this.world.isRemote) this.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 0));
} }
} }
@@ -33,7 +33,7 @@ public class EntityDarknessOrb extends EntityMagicProjectile {
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.WITHER).setProjectile(), MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.WITHER).setProjectile(),
damage); damage);
if(target instanceof EntityLivingBase && !MagicDamage.isEntityImmune(DamageType.WITHER, target)) if(!this.world.isRemote && target instanceof EntityLivingBase && !MagicDamage.isEntityImmune(DamageType.WITHER, target))
((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.WITHER, ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.WITHER,
Spells.darkness_orb.getProperty(Spell.EFFECT_DURATION).intValue(), Spells.darkness_orb.getProperty(Spell.EFFECT_DURATION).intValue(),
Spells.darkness_orb.getProperty(Spell.EFFECT_STRENGTH).intValue())); Spells.darkness_orb.getProperty(Spell.EFFECT_STRENGTH).intValue()));
@@ -27,7 +27,7 @@ public class EntityDart extends EntityMagicArrow {
@Override @Override
public void onEntityHit(EntityLivingBase entityHit){ public void onEntityHit(EntityLivingBase entityHit){
// Adds a weakness effect to the target. // Adds a weakness effect to the target.
entityHit.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, Spells.dart.getProperty(Spell.EFFECT_DURATION).intValue(), if(!entityHit.world.isRemote) entityHit.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, Spells.dart.getProperty(Spell.EFFECT_DURATION).intValue(),
Spells.dart.getProperty(Spell.EFFECT_STRENGTH).intValue(), false, false)); Spells.dart.getProperty(Spell.EFFECT_STRENGTH).intValue(), false, false));
this.playSound(WizardrySounds.ENTITY_DART_HIT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); this.playSound(WizardrySounds.ENTITY_DART_HIT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
} }
@@ -59,4 +59,4 @@ public class EntityDart extends EntityMagicArrow {
public int getLifetime(){ public int getLifetime(){
return -1; return -1;
} }
} }
@@ -48,7 +48,7 @@ public class EntityIceCharge extends EntityBomb {
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.FROST).setProjectile(), MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.FROST).setProjectile(),
damage); damage);
if(entityHit instanceof EntityLivingBase && !MagicDamage.isEntityImmune(DamageType.FROST, entityHit)) if(!this.world.isRemote && entityHit instanceof EntityLivingBase && !MagicDamage.isEntityImmune(DamageType.FROST, entityHit))
((EntityLivingBase)entityHit).addPotionEffect(new PotionEffect(WizardryPotions.frost, ((EntityLivingBase)entityHit).addPotionEffect(new PotionEffect(WizardryPotions.frost,
Spells.ice_charge.getProperty(Spell.DIRECT_EFFECT_DURATION).intValue(), Spells.ice_charge.getProperty(Spell.DIRECT_EFFECT_DURATION).intValue(),
Spells.ice_charge.getProperty(Spell.DIRECT_EFFECT_STRENGTH).intValue())); Spells.ice_charge.getProperty(Spell.DIRECT_EFFECT_STRENGTH).intValue()));
@@ -39,7 +39,7 @@ public class EntityIceLance extends EntityMagicArrow {
public void onEntityHit(EntityLivingBase entityHit){ public void onEntityHit(EntityLivingBase entityHit){
// Adds a freeze effect to the target. // Adds a freeze effect to the target.
if(!MagicDamage.isEntityImmune(DamageType.FROST, entityHit)) if(!entityHit.world.isRemote && !MagicDamage.isEntityImmune(DamageType.FROST, entityHit))
entityHit.addPotionEffect(new PotionEffect(WizardryPotions.frost, entityHit.addPotionEffect(new PotionEffect(WizardryPotions.frost,
Spells.ice_lance.getProperty(Spell.EFFECT_DURATION).intValue(), Spells.ice_lance.getProperty(Spell.EFFECT_DURATION).intValue(),
Spells.ice_lance.getProperty(Spell.EFFECT_STRENGTH).intValue())); Spells.ice_lance.getProperty(Spell.EFFECT_STRENGTH).intValue()));
@@ -64,4 +64,4 @@ public class EntityIceLance extends EntityMagicArrow {
@Override @Override
protected void entityInit(){} protected void entityInit(){}
} }
@@ -37,7 +37,7 @@ public class EntityIceShard extends EntityMagicArrow {
public void onEntityHit(EntityLivingBase entityHit){ public void onEntityHit(EntityLivingBase entityHit){
// Adds a freeze effect to the target. // Adds a freeze effect to the target.
if(!MagicDamage.isEntityImmune(DamageType.FROST, entityHit)) if(!entityHit.world.isRemote && !MagicDamage.isEntityImmune(DamageType.FROST, entityHit))
entityHit.addPotionEffect(new PotionEffect(WizardryPotions.frost, entityHit.addPotionEffect(new PotionEffect(WizardryPotions.frost,
Spells.ice_shard.getProperty(Spell.EFFECT_DURATION).intValue(), Spells.ice_shard.getProperty(Spell.EFFECT_DURATION).intValue(),
Spells.ice_shard.getProperty(Spell.EFFECT_STRENGTH).intValue())); Spells.ice_shard.getProperty(Spell.EFFECT_STRENGTH).intValue()));
@@ -67,4 +67,4 @@ public class EntityIceShard extends EntityMagicArrow {
@Override @Override
protected void entityInit(){} protected void entityInit(){}
} }
@@ -44,7 +44,7 @@ public class EntityPoisonBomb extends EntityBomb {
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.POISON).setProjectile(), MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.POISON).setProjectile(),
damage); damage);
if(entityHit instanceof EntityLivingBase && !MagicDamage.isEntityImmune(DamageType.POISON, entityHit)) if(!this.world.isRemote && entityHit instanceof EntityLivingBase && !MagicDamage.isEntityImmune(DamageType.POISON, entityHit))
((EntityLivingBase)entityHit).addPotionEffect(new PotionEffect(MobEffects.POISON, ((EntityLivingBase)entityHit).addPotionEffect(new PotionEffect(MobEffects.POISON,
Spells.poison_bomb.getProperty(Spell.DIRECT_EFFECT_DURATION).intValue(), Spells.poison_bomb.getProperty(Spell.DIRECT_EFFECT_DURATION).intValue(),
Spells.poison_bomb.getProperty(Spell.DIRECT_EFFECT_STRENGTH).intValue())); Spells.poison_bomb.getProperty(Spell.DIRECT_EFFECT_STRENGTH).intValue()));
@@ -69,9 +69,11 @@ public class EntityPoisonBomb extends EntityBomb {
target.attackEntityFrom( target.attackEntityFrom(
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.POISON), MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.POISON),
Spells.poison_bomb.getProperty(Spell.SPLASH_DAMAGE).floatValue() * damageMultiplier); Spells.poison_bomb.getProperty(Spell.SPLASH_DAMAGE).floatValue() * damageMultiplier);
target.addPotionEffect(new PotionEffect(MobEffects.POISON, if(!this.world.isRemote){
Spells.poison_bomb.getProperty(Spell.SPLASH_EFFECT_DURATION).intValue(), target.addPotionEffect(new PotionEffect(MobEffects.POISON,
Spells.poison_bomb.getProperty(Spell.SPLASH_EFFECT_STRENGTH).intValue())); Spells.poison_bomb.getProperty(Spell.SPLASH_EFFECT_DURATION).intValue(),
Spells.poison_bomb.getProperty(Spell.SPLASH_EFFECT_STRENGTH).intValue()));
}
} }
} }
} }
@@ -48,7 +48,7 @@ public class EntitySmokeBomb extends EntityBomb {
for(EntityLivingBase target : targets){ for(EntityLivingBase target : targets){
if(target != this.getThrower()){ if(target != this.getThrower()){
target.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, duration, 0)); if(!this.world.isRemote) target.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, duration, 0));
} }
} }
} }
@@ -675,7 +675,7 @@ public class ItemArtefact extends Item {
}else if(artefact == WizardryItems.amulet_transience){ }else if(artefact == WizardryItems.amulet_transience){
if(player.getHealth() <= 6 && player.world.rand.nextFloat() < 0.25f){ if(!player.world.isRemote && player.getHealth() <= 6 && player.world.rand.nextFloat() < 0.25f){
player.addPotionEffect(new PotionEffect(WizardryPotions.transience, 300)); player.addPotionEffect(new PotionEffect(WizardryPotions.transience, 300));
player.addPotionEffect(new PotionEffect(MobEffects.INVISIBILITY, 300, 0, false, false)); player.addPotionEffect(new PotionEffect(MobEffects.INVISIBILITY, 300, 0, false, false));
} }
@@ -701,7 +701,7 @@ public class ItemArtefact extends Item {
}else if(artefact == WizardryItems.ring_ice_melee){ }else if(artefact == WizardryItems.ring_ice_melee){
if(EntityUtils.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand if(!player.world.isRemote && EntityUtils.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
&& ((ItemWand)mainhandItem.getItem()).element == Element.ICE){ && ((ItemWand)mainhandItem.getItem()).element == Element.ICE){
event.getEntityLiving().addPotionEffect(new PotionEffect(WizardryPotions.frost, 200, 0)); event.getEntityLiving().addPotionEffect(new PotionEffect(WizardryPotions.frost, 200, 0));
} }
@@ -734,14 +734,14 @@ public class ItemArtefact extends Item {
}else if(artefact == WizardryItems.ring_necromancy_melee){ }else if(artefact == WizardryItems.ring_necromancy_melee){
if(EntityUtils.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand if(!player.world.isRemote && EntityUtils.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
&& ((ItemWand)mainhandItem.getItem()).element == Element.NECROMANCY){ && ((ItemWand)mainhandItem.getItem()).element == Element.NECROMANCY){
event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.WITHER, 200, 0)); event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.WITHER, 200, 0));
} }
}else if(artefact == WizardryItems.ring_earth_melee){ }else if(artefact == WizardryItems.ring_earth_melee){
if(EntityUtils.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand if(!player.world.isRemote && EntityUtils.isMeleeDamage(event.getSource()) && mainhandItem.getItem() instanceof ItemWand
&& ((ItemWand)mainhandItem.getItem()).element == Element.EARTH){ && ((ItemWand)mainhandItem.getItem()).element == Element.EARTH){
event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.POISON, 200, 0)); event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.POISON, 200, 0));
} }
@@ -774,12 +774,12 @@ public class ItemArtefact extends Item {
}else if(artefact == WizardryItems.ring_soulbinding){ }else if(artefact == WizardryItems.ring_soulbinding){
// Best guess at necromancy spell damage: either it's wither damage... // Best guess at necromancy spell damage: either it's wither damage...
if((event.getSource() instanceof IElementalDamage if(!player.world.isRemote && ((event.getSource() instanceof IElementalDamage
&& (((IElementalDamage)event.getSource()).getType() == MagicDamage.DamageType.WITHER)) && (((IElementalDamage)event.getSource()).getType() == MagicDamage.DamageType.WITHER))
// or it's direct, non-melee damage and the player is holding a wand with a necromancy spell selected // or it's direct, non-melee damage and the player is holding a wand with a necromancy spell selected
|| (event.getSource().getImmediateSource() == player && !EntityUtils.isMeleeDamage(event.getSource()) || (event.getSource().getImmediateSource() == player && !EntityUtils.isMeleeDamage(event.getSource())
&& Streams.stream(player.getHeldEquipment()).anyMatch(s -> s.getItem() instanceof ISpellCastingItem && Streams.stream(player.getHeldEquipment()).anyMatch(s -> s.getItem() instanceof ISpellCastingItem
&& ((ISpellCastingItem)s.getItem()).getCurrentSpell(s).getElement() == Element.NECROMANCY))){ && ((ISpellCastingItem)s.getItem()).getCurrentSpell(s).getElement() == Element.NECROMANCY)))){
event.getEntityLiving().addPotionEffect(new PotionEffect(WizardryPotions.curse_of_soulbinding, 400)); event.getEntityLiving().addPotionEffect(new PotionEffect(WizardryPotions.curse_of_soulbinding, 400));
CurseOfSoulbinding.getSoulboundCreatures(WizardData.get(player)).add(event.getEntity().getUniqueID()); CurseOfSoulbinding.getSoulboundCreatures(WizardData.get(player)).add(event.getEntity().getUniqueID());
@@ -804,14 +804,14 @@ public class ItemArtefact extends Item {
}else if(artefact == WizardryItems.ring_poison){ }else if(artefact == WizardryItems.ring_poison){
// Best guess at earth spell damage: either it's poison damage... // Best guess at earth spell damage: either it's poison damage...
if((event.getSource() instanceof IElementalDamage if(!player.world.isRemote && ((event.getSource() instanceof IElementalDamage
&& (((IElementalDamage)event.getSource()).getType() == MagicDamage.DamageType.POISON)) && (((IElementalDamage)event.getSource()).getType() == MagicDamage.DamageType.POISON))
// ...or it was from a dart... // ...or it was from a dart...
|| event.getSource().getImmediateSource() instanceof EntityDart || event.getSource().getImmediateSource() instanceof EntityDart
// ...or it's direct, non-melee damage and the player is holding a wand with an earth spell selected // ...or it's direct, non-melee damage and the player is holding a wand with an earth spell selected
|| (event.getSource().getImmediateSource() == player && !EntityUtils.isMeleeDamage(event.getSource()) || (event.getSource().getImmediateSource() == player && !EntityUtils.isMeleeDamage(event.getSource())
&& Streams.stream(player.getHeldEquipment()).anyMatch(s -> s.getItem() instanceof ISpellCastingItem && Streams.stream(player.getHeldEquipment()).anyMatch(s -> s.getItem() instanceof ISpellCastingItem
&& ((ISpellCastingItem)s.getItem()).getCurrentSpell(s).getElement() == Element.EARTH))){ && ((ISpellCastingItem)s.getItem()).getCurrentSpell(s).getElement() == Element.EARTH)))){
event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.POISON, 200, 0)); event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.POISON, 200, 0));
} }
@@ -96,7 +96,7 @@ public class ItemFrostAxe extends ItemAxe implements IConjuredItem {
@Override @Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase wielder){ public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase wielder){
if(!MagicDamage.isEntityImmune(DamageType.FROST, target)) if(!target.world.isRemote && !MagicDamage.isEntityImmune(DamageType.FROST, target))
target.addPotionEffect(new PotionEffect(WizardryPotions.frost, 160, 1)); target.addPotionEffect(new PotionEffect(WizardryPotions.frost, 160, 1));
return false; return false;
} }
@@ -209,7 +209,7 @@ public class ItemWizardArmour extends ItemArmor implements IWorkbenchItem, IMana
@Override @Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){
if(armorType == EntityEquipmentSlot.HEAD && player.ticksExisted % 20 == 0 if(!world.isRemote && armorType == EntityEquipmentSlot.HEAD && player.ticksExisted % 20 == 0
&& isWearingFullSet(player, element, ArmourClass.BATTLEMAGE) && doAllArmourPiecesHaveMana(player)){ && isWearingFullSet(player, element, ArmourClass.BATTLEMAGE) && doAllArmourPiecesHaveMana(player)){
player.addPotionEffect(new PotionEffect(WizardryPotions.ward, 219, 0, true, false)); player.addPotionEffect(new PotionEffect(WizardryPotions.ward, 219, 0, true, false));
} }
@@ -257,9 +257,9 @@ public abstract class Forfeit {
1, EntityUtils.canDamageBlocks(p, w))); 1, EntityUtils.canDamageBlocks(p, w)));
})); }));
add(Tier.NOVICE, Element.ICE, create("freeze_self", (w, p) -> p.addPotionEffect(new PotionEffect(WizardryPotions.frost, 200)))); add(Tier.NOVICE, Element.ICE, create("freeze_self", (w, p) -> { if(!w.isRemote) p.addPotionEffect(new PotionEffect(WizardryPotions.frost, 200)); }));
add(Tier.APPRENTICE, Element.ICE, create("freeze_self_2", (w, p) -> p.addPotionEffect(new PotionEffect(WizardryPotions.frost, 300, 1)))); add(Tier.APPRENTICE, Element.ICE, create("freeze_self_2", (w, p) -> { if(!w.isRemote) p.addPotionEffect(new PotionEffect(WizardryPotions.frost, 300, 1)); }));
add(Tier.APPRENTICE, Element.ICE, create("ice_spikes", (w, p) -> { add(Tier.APPRENTICE, Element.ICE, create("ice_spikes", (w, p) -> {
if(!w.isRemote){ if(!w.isRemote){
@@ -342,7 +342,7 @@ public abstract class Forfeit {
add(Tier.ADVANCED, Element.LIGHTNING, create("lightning", (w, p) -> w.addWeatherEffect(new EntityLightningBolt(w, p.posX, p.posY, p.posZ, false)))); add(Tier.ADVANCED, Element.LIGHTNING, create("lightning", (w, p) -> w.addWeatherEffect(new EntityLightningBolt(w, p.posX, p.posY, p.posZ, false))));
add(Tier.ADVANCED, Element.LIGHTNING, create("paralyse_self", (w, p) -> p.addPotionEffect(new PotionEffect(WizardryPotions.paralysis, 200)))); add(Tier.ADVANCED, Element.LIGHTNING, create("paralyse_self", (w, p) -> { if(!w.isRemote) p.addPotionEffect(new PotionEffect(WizardryPotions.paralysis, 200)); }));
add(Tier.ADVANCED, Element.LIGHTNING, create("lightning_wraiths", (w, p) -> { add(Tier.ADVANCED, Element.LIGHTNING, create("lightning_wraiths", (w, p) -> {
if(!w.isRemote){ if(!w.isRemote){
@@ -367,7 +367,7 @@ public abstract class Forfeit {
} }
})); }));
add(Tier.NOVICE, Element.NECROMANCY, create("nausea", (w, p) -> p.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 400)))); add(Tier.NOVICE, Element.NECROMANCY, create("nausea", (w, p) -> { if(!w.isRemote) p.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 400)); }));
add(Tier.APPRENTICE, Element.NECROMANCY, create("zombie_horde", (w, p) -> { add(Tier.APPRENTICE, Element.NECROMANCY, create("zombie_horde", (w, p) -> {
if(!w.isRemote){ if(!w.isRemote){
@@ -381,7 +381,7 @@ public abstract class Forfeit {
} }
})); }));
add(Tier.ADVANCED, Element.NECROMANCY, create("wither_self", (w, p) -> p.addPotionEffect(new PotionEffect(MobEffects.WITHER, 400)))); add(Tier.ADVANCED, Element.NECROMANCY, create("wither_self", (w, p) -> { if(!w.isRemote) p.addPotionEffect(new PotionEffect(MobEffects.WITHER, 400)); }));
add(Tier.MASTER, Element.NECROMANCY, create("cripple_self", (w, p) -> p.attackEntityFrom(DamageSource.MAGIC, p.getHealth() - 1))); add(Tier.MASTER, Element.NECROMANCY, create("cripple_self", (w, p) -> p.attackEntityFrom(DamageSource.MAGIC, p.getHealth() - 1)));
@@ -422,7 +422,7 @@ public abstract class Forfeit {
} }
})); }));
add(Tier.APPRENTICE, Element.EARTH, create("poison_self", (w, p) -> p.addPotionEffect(new PotionEffect(MobEffects.POISON, 400, 1)))); add(Tier.APPRENTICE, Element.EARTH, create("poison_self", (w, p) -> { if(!w.isRemote) p.addPotionEffect(new PotionEffect(MobEffects.POISON, 400, 1)); }));
add(Tier.ADVANCED, Element.EARTH, create("flood", (w, p) -> { add(Tier.ADVANCED, Element.EARTH, create("flood", (w, p) -> {
if(!w.isRemote && EntityUtils.canDamageBlocks(p, w)){ if(!w.isRemote && EntityUtils.canDamageBlocks(p, w)){
@@ -457,7 +457,7 @@ public abstract class Forfeit {
add(Tier.APPRENTICE, Element.SORCERY, create("teleport_self", (w, p) -> ((Banish)Spells.banish).teleport(p, w, 8 + w.rand.nextDouble() * 8))); add(Tier.APPRENTICE, Element.SORCERY, create("teleport_self", (w, p) -> ((Banish)Spells.banish).teleport(p, w, 8 + w.rand.nextDouble() * 8)));
add(Tier.ADVANCED, Element.SORCERY, create("levitate_self", (w, p) -> p.addPotionEffect(new PotionEffect(MobEffects.LEVITATION, 200)))); add(Tier.ADVANCED, Element.SORCERY, create("levitate_self", (w, p) -> { if(!w.isRemote) p.addPotionEffect(new PotionEffect(MobEffects.LEVITATION, 200)); }));
add(Tier.ADVANCED, Element.SORCERY, create("vex_horde", (w, p) -> { add(Tier.ADVANCED, Element.SORCERY, create("vex_horde", (w, p) -> {
if(!w.isRemote){ if(!w.isRemote){
@@ -500,16 +500,16 @@ public abstract class Forfeit {
} }
})); }));
add(Tier.APPRENTICE, Element.HEALING, create("hunger", (w, p) -> p.addPotionEffect(new PotionEffect(MobEffects.HUNGER, 400, 4)))); add(Tier.APPRENTICE, Element.HEALING, create("hunger", (w, p) -> { if(!w.isRemote) p.addPotionEffect(new PotionEffect(MobEffects.HUNGER, 400, 4)); }));
add(Tier.APPRENTICE, Element.HEALING, create("blind_self", (w, p) -> p.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, 200)))); add(Tier.APPRENTICE, Element.HEALING, create("blind_self", (w, p) -> { if(!w.isRemote) p.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, 200)); }));
add(Tier.ADVANCED, Element.HEALING, create("weaken_self", (w, p) -> p.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 600, 3)))); add(Tier.ADVANCED, Element.HEALING, create("weaken_self", (w, p) -> { if(!w.isRemote) p.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 600, 3)); }));
add(Tier.ADVANCED, Element.HEALING, create("jam_self", (w, p) -> p.addPotionEffect(new PotionEffect(WizardryPotions.arcane_jammer, 300)))); add(Tier.ADVANCED, Element.HEALING, create("jam_self", (w, p) -> { if(!w.isRemote) p.addPotionEffect(new PotionEffect(WizardryPotions.arcane_jammer, 300)); }));
add(Tier.MASTER, Element.HEALING, create("curse_self", (w, p) -> p.addPotionEffect(new PotionEffect(WizardryPotions.curse_of_undeath, Integer.MAX_VALUE)))); add(Tier.MASTER, Element.HEALING, create("curse_self", (w, p) -> { if(!w.isRemote) p.addPotionEffect(new PotionEffect(WizardryPotions.curse_of_undeath, Integer.MAX_VALUE)); }));
} }
} }
@@ -340,7 +340,7 @@ public class TileEntityShrineCore extends TileEntity implements ITickable {
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, containmentField, e -> e instanceof EntityPlayer || e instanceof EntityWizard || e instanceof EntityEvilWizard); List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, containmentField, e -> e instanceof EntityPlayer || e instanceof EntityWizard || e instanceof EntityEvilWizard);
for (EntityLivingBase entity : entities) { for (EntityLivingBase entity : entities) {
entity.addPotionEffect(new PotionEffect(WizardryPotions.containment, 219)); if(!world.isRemote) entity.addPotionEffect(new PotionEffect(WizardryPotions.containment, 219));
NBTExtras.storeTagSafely(entity.getEntityData(), PotionContainment.ENTITY_TAG, NBTUtil.createPosTag(this.pos)); NBTExtras.storeTagSafely(entity.getEntityData(), PotionContainment.ENTITY_TAG, NBTUtil.createPosTag(this.pos));
} }
} }