From ae7064f5bec2cb4f9ec71c2d069affeff0199eb2 Mon Sep 17 00:00:00 2001 From: WinDanesz <31292708+windanesz@users.noreply.github.com> Date: Tue, 12 May 2026 15:12:13 +0000 Subject: [PATCH] fix: more potion effect desync fixed --- .../wizardry/WizardryEventHandler.java | 6 ++--- .../wizardry/block/BlockPermafrost.java | 2 +- .../wizardry/block/BlockSnare.java | 8 +++--- .../entity/construct/EntityBlizzard.java | 2 +- .../entity/construct/EntityEarthquake.java | 2 +- .../construct/EntityWitheringTotem.java | 2 +- .../entity/living/EntityHuskMinion.java | 4 +-- .../entity/living/EntityIceGiant.java | 2 +- .../entity/living/EntityMagicSlime.java | 2 +- .../entity/living/EntitySpiderMinion.java | 2 +- .../living/EntityWitherSkeletonMinion.java | 2 +- .../wizardry/entity/living/EntityWizard.java | 2 +- .../entity/projectile/EntityDarknessOrb.java | 2 +- .../entity/projectile/EntityDart.java | 4 +-- .../entity/projectile/EntityIceCharge.java | 2 +- .../entity/projectile/EntityIceLance.java | 4 +-- .../entity/projectile/EntityIceShard.java | 4 +-- .../entity/projectile/EntityPoisonBomb.java | 10 ++++--- .../entity/projectile/EntitySmokeBomb.java | 2 +- .../wizardry/item/ItemArtefact.java | 16 ++++++------ .../wizardry/item/ItemFrostAxe.java | 2 +- .../wizardry/item/ItemWizardArmour.java | 2 +- .../electroblob/wizardry/misc/Forfeit.java | 26 +++++++++---------- .../tileentity/TileEntityShrineCore.java | 2 +- 24 files changed, 58 insertions(+), 54 deletions(-) diff --git a/src/main/java/electroblob/wizardry/WizardryEventHandler.java b/src/main/java/electroblob/wizardry/WizardryEventHandler.java index 4efffc7d..c78fee7a 100644 --- a/src/main/java/electroblob/wizardry/WizardryEventHandler.java +++ b/src/main/java/electroblob/wizardry/WizardryEventHandler.java @@ -274,7 +274,7 @@ public final class WizardryEventHandler { if(event.getEntityLiving().isPotionActive(WizardryPotions.ice_shroud) && !MagicDamage.isEntityImmune(DamageType.FROST, event.getEntityLiving()) && !(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_STRENGTH).intValue())); @@ -326,7 +326,7 @@ public final class WizardryEventHandler { level = EnchantmentHelper.getEnchantmentLevel(WizardryEnchantments.freezing_weapon, attacker.getHeldItemMainhand()); // 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)); } } @@ -338,7 +338,7 @@ public final class WizardryEventHandler { int level = event.getSource().getImmediateSource().getEntityData() .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)); } diff --git a/src/main/java/electroblob/wizardry/block/BlockPermafrost.java b/src/main/java/electroblob/wizardry/block/BlockPermafrost.java index 5043cdcb..77718e1b 100644 --- a/src/main/java/electroblob/wizardry/block/BlockPermafrost.java +++ b/src/main/java/electroblob/wizardry/block/BlockPermafrost.java @@ -62,7 +62,7 @@ public class BlockPermafrost extends BlockDryFrostedIce { entity.attackEntityFrom(DamageSource.MAGIC, Spells.permafrost.getProperty(Spell.DAMAGE).floatValue()); int duration = Spells.permafrost.getProperty(Spell.EFFECT_DURATION).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 diff --git a/src/main/java/electroblob/wizardry/block/BlockSnare.java b/src/main/java/electroblob/wizardry/block/BlockSnare.java index 807425c0..d8570a63 100644 --- a/src/main/java/electroblob/wizardry/block/BlockSnare.java +++ b/src/main/java/electroblob/wizardry/block/BlockSnare.java @@ -68,9 +68,11 @@ public class BlockSnare extends Block implements ITileEntityProvider { entity.attackEntityFrom(source, Spells.snare.getProperty(Spell.DAMAGE).floatValue()); - ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, - Spells.snare.getProperty(Spell.EFFECT_DURATION).intValue(), - Spells.snare.getProperty(Spell.EFFECT_STRENGTH).intValue())); + if(!world.isRemote){ + ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, + Spells.snare.getProperty(Spell.EFFECT_DURATION).intValue(), + Spells.snare.getProperty(Spell.EFFECT_STRENGTH).intValue())); + } if(!world.isRemote) world.destroyBlock(pos, false); } diff --git a/src/main/java/electroblob/wizardry/entity/construct/EntityBlizzard.java b/src/main/java/electroblob/wizardry/entity/construct/EntityBlizzard.java index d03760b2..f4d74b8f 100644 --- a/src/main/java/electroblob/wizardry/entity/construct/EntityBlizzard.java +++ b/src/main/java/electroblob/wizardry/entity/construct/EntityBlizzard.java @@ -62,7 +62,7 @@ public class EntityBlizzard extends EntityScaledConstruct { } // 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)); } diff --git a/src/main/java/electroblob/wizardry/entity/construct/EntityEarthquake.java b/src/main/java/electroblob/wizardry/entity/construct/EntityEarthquake.java index 8fc6c454..29d2fe8e 100644 --- a/src/main/java/electroblob/wizardry/entity/construct/EntityEarthquake.java +++ b/src/main/java/electroblob/wizardry/entity/construct/EntityEarthquake.java @@ -81,7 +81,7 @@ public class EntityEarthquake extends EntityMagicConstruct { // NOT a scaled con target.attackEntityFrom( MagicDamage.causeIndirectMagicDamage(this, this.getCaster(), DamageType.BLAST), 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. diff --git a/src/main/java/electroblob/wizardry/entity/construct/EntityWitheringTotem.java b/src/main/java/electroblob/wizardry/entity/construct/EntityWitheringTotem.java index fca25006..64e4eec9 100644 --- a/src/main/java/electroblob/wizardry/entity/construct/EntityWitheringTotem.java +++ b/src/main/java/electroblob/wizardry/entity/construct/EntityWitheringTotem.java @@ -145,7 +145,7 @@ public class EntityWitheringTotem extends EntityScaledConstruct { for(EntityLivingBase target : nearby){ - if(EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(this, + if(!world.isRemote && EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC), damage)){ target.addPotionEffect(new PotionEffect(MobEffects.WITHER, Spells.withering_totem.getProperty(Spell.EFFECT_DURATION).intValue(), Spells.withering_totem.getProperty(Spell.EFFECT_STRENGTH).intValue())); diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityHuskMinion.java b/src/main/java/electroblob/wizardry/entity/living/EntityHuskMinion.java index 3a146734..f3036afb 100644 --- a/src/main/java/electroblob/wizardry/entity/living/EntityHuskMinion.java +++ b/src/main/java/electroblob/wizardry/entity/living/EntityHuskMinion.java @@ -32,11 +32,11 @@ public class EntityHuskMinion extends EntityZombieMinion { 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(); ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.HUNGER, 140 * (int)f)); } return flag; } -} \ No newline at end of file +} diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityIceGiant.java b/src/main/java/electroblob/wizardry/entity/living/EntityIceGiant.java index 10e94e52..85dab0de 100644 --- a/src/main/java/electroblob/wizardry/entity/living/EntityIceGiant.java +++ b/src/main/java/electroblob/wizardry/entity/living/EntityIceGiant.java @@ -119,7 +119,7 @@ public class EntityIceGiant extends EntityIronGolem implements ISummonedCreature target.motionX += this.getLookVec().x * 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); diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityMagicSlime.java b/src/main/java/electroblob/wizardry/entity/living/EntityMagicSlime.java index f9ae5d0f..85953c35 100644 --- a/src/main/java/electroblob/wizardry/entity/living/EntityMagicSlime.java +++ b/src/main/java/electroblob/wizardry/entity/living/EntityMagicSlime.java @@ -120,7 +120,7 @@ public class EntityMagicSlime extends EntitySlime implements ISummonedCreature { && ((EntityLivingBase)this.getRidingEntity()).getHealth() > 0){ if(this.ticksExisted % 16 == 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()) .addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 20, 2)); } diff --git a/src/main/java/electroblob/wizardry/entity/living/EntitySpiderMinion.java b/src/main/java/electroblob/wizardry/entity/living/EntitySpiderMinion.java index d3510beb..f06a204b 100644 --- a/src/main/java/electroblob/wizardry/entity/living/EntitySpiderMinion.java +++ b/src/main/java/electroblob/wizardry/entity/living/EntitySpiderMinion.java @@ -129,7 +129,7 @@ public class EntitySpiderMinion extends EntityCaveSpider implements ISummonedCre seconds = 15; } - if(seconds > 0){ + if(seconds > 0 && !target.world.isRemote){ target.addPotionEffect(new PotionEffect(MobEffects.POISON, seconds * 20, 0)); } } diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityWitherSkeletonMinion.java b/src/main/java/electroblob/wizardry/entity/living/EntityWitherSkeletonMinion.java index a34f63f6..abcf9d8c 100644 --- a/src/main/java/electroblob/wizardry/entity/living/EntityWitherSkeletonMinion.java +++ b/src/main/java/electroblob/wizardry/entity/living/EntityWitherSkeletonMinion.java @@ -139,7 +139,7 @@ public class EntityWitherSkeletonMinion extends EntityWitherSkeleton implements @Override public void onSuccessfulAttack(EntityLivingBase target){ - target.addPotionEffect(new PotionEffect(MobEffects.WITHER, 200)); + if(!target.world.isRemote) target.addPotionEffect(new PotionEffect(MobEffects.WITHER, 200)); } @Override diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java b/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java index 3d385f7d..b551c97c 100644 --- a/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java +++ b/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java @@ -359,7 +359,7 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp this.updateRecipes = false; } - this.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 0)); + if(!this.world.isRemote) this.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 0)); } } diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityDarknessOrb.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityDarknessOrb.java index 484457ba..635a4bfe 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityDarknessOrb.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityDarknessOrb.java @@ -33,7 +33,7 @@ public class EntityDarknessOrb extends EntityMagicProjectile { MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.WITHER).setProjectile(), 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, Spells.darkness_orb.getProperty(Spell.EFFECT_DURATION).intValue(), Spells.darkness_orb.getProperty(Spell.EFFECT_STRENGTH).intValue())); diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityDart.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityDart.java index 6fd4cb3c..96d04abc 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityDart.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityDart.java @@ -27,7 +27,7 @@ public class EntityDart extends EntityMagicArrow { @Override public void onEntityHit(EntityLivingBase entityHit){ // 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)); 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(){ return -1; } -} \ No newline at end of file +} diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityIceCharge.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityIceCharge.java index 79463235..5a11ba89 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityIceCharge.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityIceCharge.java @@ -48,7 +48,7 @@ public class EntityIceCharge extends EntityBomb { MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.FROST).setProjectile(), 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, Spells.ice_charge.getProperty(Spell.DIRECT_EFFECT_DURATION).intValue(), Spells.ice_charge.getProperty(Spell.DIRECT_EFFECT_STRENGTH).intValue())); diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityIceLance.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityIceLance.java index a9c2032e..0f730c00 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityIceLance.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityIceLance.java @@ -39,7 +39,7 @@ public class EntityIceLance extends EntityMagicArrow { public void onEntityHit(EntityLivingBase entityHit){ // 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, Spells.ice_lance.getProperty(Spell.EFFECT_DURATION).intValue(), Spells.ice_lance.getProperty(Spell.EFFECT_STRENGTH).intValue())); @@ -64,4 +64,4 @@ public class EntityIceLance extends EntityMagicArrow { @Override protected void entityInit(){} -} \ No newline at end of file +} diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityIceShard.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityIceShard.java index 72a2cfdf..d14e2ac1 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityIceShard.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityIceShard.java @@ -37,7 +37,7 @@ public class EntityIceShard extends EntityMagicArrow { public void onEntityHit(EntityLivingBase entityHit){ // 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, Spells.ice_shard.getProperty(Spell.EFFECT_DURATION).intValue(), Spells.ice_shard.getProperty(Spell.EFFECT_STRENGTH).intValue())); @@ -67,4 +67,4 @@ public class EntityIceShard extends EntityMagicArrow { @Override protected void entityInit(){} -} \ No newline at end of file +} diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityPoisonBomb.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityPoisonBomb.java index 2c0e7d0b..5481fddb 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityPoisonBomb.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityPoisonBomb.java @@ -44,7 +44,7 @@ public class EntityPoisonBomb extends EntityBomb { MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.POISON).setProjectile(), 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, Spells.poison_bomb.getProperty(Spell.DIRECT_EFFECT_DURATION).intValue(), Spells.poison_bomb.getProperty(Spell.DIRECT_EFFECT_STRENGTH).intValue())); @@ -69,9 +69,11 @@ public class EntityPoisonBomb extends EntityBomb { target.attackEntityFrom( MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.POISON), Spells.poison_bomb.getProperty(Spell.SPLASH_DAMAGE).floatValue() * damageMultiplier); - target.addPotionEffect(new PotionEffect(MobEffects.POISON, - Spells.poison_bomb.getProperty(Spell.SPLASH_EFFECT_DURATION).intValue(), - Spells.poison_bomb.getProperty(Spell.SPLASH_EFFECT_STRENGTH).intValue())); + if(!this.world.isRemote){ + target.addPotionEffect(new PotionEffect(MobEffects.POISON, + Spells.poison_bomb.getProperty(Spell.SPLASH_EFFECT_DURATION).intValue(), + Spells.poison_bomb.getProperty(Spell.SPLASH_EFFECT_STRENGTH).intValue())); + } } } } diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntitySmokeBomb.java b/src/main/java/electroblob/wizardry/entity/projectile/EntitySmokeBomb.java index 5e32aab1..4147c8ec 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntitySmokeBomb.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntitySmokeBomb.java @@ -48,7 +48,7 @@ public class EntitySmokeBomb extends EntityBomb { for(EntityLivingBase target : targets){ if(target != this.getThrower()){ - target.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, duration, 0)); + if(!this.world.isRemote) target.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, duration, 0)); } } } diff --git a/src/main/java/electroblob/wizardry/item/ItemArtefact.java b/src/main/java/electroblob/wizardry/item/ItemArtefact.java index 94038c9b..85d9f956 100644 --- a/src/main/java/electroblob/wizardry/item/ItemArtefact.java +++ b/src/main/java/electroblob/wizardry/item/ItemArtefact.java @@ -675,7 +675,7 @@ public class ItemArtefact extends Item { }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(MobEffects.INVISIBILITY, 300, 0, false, false)); } @@ -701,7 +701,7 @@ public class ItemArtefact extends Item { }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){ 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){ - 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){ event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.WITHER, 200, 0)); } }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){ event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.POISON, 200, 0)); } @@ -774,12 +774,12 @@ public class ItemArtefact extends Item { }else if(artefact == WizardryItems.ring_soulbinding){ // 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)) // 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()) && 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)); CurseOfSoulbinding.getSoulboundCreatures(WizardData.get(player)).add(event.getEntity().getUniqueID()); @@ -804,14 +804,14 @@ public class ItemArtefact extends Item { }else if(artefact == WizardryItems.ring_poison){ // 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)) // ...or it was from a dart... || event.getSource().getImmediateSource() instanceof EntityDart // ...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()) && 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)); } diff --git a/src/main/java/electroblob/wizardry/item/ItemFrostAxe.java b/src/main/java/electroblob/wizardry/item/ItemFrostAxe.java index e9cf5912..27067513 100644 --- a/src/main/java/electroblob/wizardry/item/ItemFrostAxe.java +++ b/src/main/java/electroblob/wizardry/item/ItemFrostAxe.java @@ -96,7 +96,7 @@ public class ItemFrostAxe extends ItemAxe implements IConjuredItem { @Override 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)); return false; } diff --git a/src/main/java/electroblob/wizardry/item/ItemWizardArmour.java b/src/main/java/electroblob/wizardry/item/ItemWizardArmour.java index 4e621920..57a3c070 100644 --- a/src/main/java/electroblob/wizardry/item/ItemWizardArmour.java +++ b/src/main/java/electroblob/wizardry/item/ItemWizardArmour.java @@ -209,7 +209,7 @@ public class ItemWizardArmour extends ItemArmor implements IWorkbenchItem, IMana @Override 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)){ player.addPotionEffect(new PotionEffect(WizardryPotions.ward, 219, 0, true, false)); } diff --git a/src/main/java/electroblob/wizardry/misc/Forfeit.java b/src/main/java/electroblob/wizardry/misc/Forfeit.java index fcc55644..85b337e4 100644 --- a/src/main/java/electroblob/wizardry/misc/Forfeit.java +++ b/src/main/java/electroblob/wizardry/misc/Forfeit.java @@ -257,9 +257,9 @@ public abstract class Forfeit { 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) -> { 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("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) -> { 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) -> { 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))); @@ -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) -> { 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.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) -> { 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)); })); } -} \ No newline at end of file +} diff --git a/src/main/java/electroblob/wizardry/tileentity/TileEntityShrineCore.java b/src/main/java/electroblob/wizardry/tileentity/TileEntityShrineCore.java index bf9e3feb..7ae632e2 100644 --- a/src/main/java/electroblob/wizardry/tileentity/TileEntityShrineCore.java +++ b/src/main/java/electroblob/wizardry/tileentity/TileEntityShrineCore.java @@ -340,7 +340,7 @@ public class TileEntityShrineCore extends TileEntity implements ITickable { List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, containmentField, e -> e instanceof EntityPlayer || e instanceof EntityWizard || e instanceof EntityEvilWizard); 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)); } }