From 032f1aa1a3e282fe2cd30c6a7ea2acc37d9d9202 Mon Sep 17 00:00:00 2001 From: WinDanesz <31292708+windanesz@users.noreply.github.com> Date: Mon, 11 May 2026 16:35:12 +0000 Subject: [PATCH] fix: Fixed potion effect desyncs in the codebase (lingering clientside-only potion effects with 0 duration) --- .../wizardry/spell/BlindingFlash.java | 4 +++- .../wizardry/spell/Containment.java | 8 +++++--- .../wizardry/spell/CurseOfEnfeeblement.java | 14 ++++++++------ .../wizardry/spell/CurseOfSoulbinding.java | 18 ++++++++++-------- .../wizardry/spell/CurseOfUndeath.java | 6 ++++-- .../wizardry/spell/EmpoweringPresence.java | 10 ++++++---- .../electroblob/wizardry/spell/FontOfMana.java | 4 ++-- .../wizardry/spell/ForestsCurse.java | 8 +++++--- .../electroblob/wizardry/spell/Freeze.java | 8 +++++--- .../electroblob/wizardry/spell/FrostRay.java | 8 +++++--- .../electroblob/wizardry/spell/IceAge.java | 2 +- .../electroblob/wizardry/spell/Intimidate.java | 12 +++++++----- .../wizardry/spell/InvigoratingPresence.java | 8 +++++--- .../wizardry/spell/MarkSacrifice.java | 2 +- .../wizardry/spell/MindControl.java | 8 +++++--- .../electroblob/wizardry/spell/Paralysis.java | 6 ++++-- .../wizardry/spell/PlagueOfDarkness.java | 8 +++++--- .../electroblob/wizardry/spell/Poison.java | 8 +++++--- .../electroblob/wizardry/spell/Possession.java | 8 +++++--- .../wizardry/spell/RayOfPurification.java | 6 ++++-- .../electroblob/wizardry/spell/Shield.java | 6 ++++-- .../electroblob/wizardry/spell/SixthSense.java | 8 +++++--- .../electroblob/wizardry/spell/SpellBuff.java | 2 ++ .../wizardry/spell/Transportation.java | 6 ++++-- .../electroblob/wizardry/spell/Wither.java | 8 +++++--- 25 files changed, 115 insertions(+), 71 deletions(-) diff --git a/src/main/java/electroblob/wizardry/spell/BlindingFlash.java b/src/main/java/electroblob/wizardry/spell/BlindingFlash.java index 21d10dd0..4c78b6a2 100644 --- a/src/main/java/electroblob/wizardry/spell/BlindingFlash.java +++ b/src/main/java/electroblob/wizardry/spell/BlindingFlash.java @@ -27,7 +27,9 @@ public class BlindingFlash extends SpellAreaEffect { if(EntityUtils.isLiving(target)){ int duration = (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)); - target.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, duration, 0)); + if(!world.isRemote){ + target.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, duration, 0)); + } } return true; diff --git a/src/main/java/electroblob/wizardry/spell/Containment.java b/src/main/java/electroblob/wizardry/spell/Containment.java index 1584ba4d..4e2b8127 100644 --- a/src/main/java/electroblob/wizardry/spell/Containment.java +++ b/src/main/java/electroblob/wizardry/spell/Containment.java @@ -27,9 +27,11 @@ public class Containment extends SpellRay { protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){ if(EntityUtils.isLiving(target)){ - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.containment, - (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), - getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); + if(!world.isRemote){ + ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.containment, + (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), + getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); + } } return true; diff --git a/src/main/java/electroblob/wizardry/spell/CurseOfEnfeeblement.java b/src/main/java/electroblob/wizardry/spell/CurseOfEnfeeblement.java index 511e9eb1..d450ab4f 100644 --- a/src/main/java/electroblob/wizardry/spell/CurseOfEnfeeblement.java +++ b/src/main/java/electroblob/wizardry/spell/CurseOfEnfeeblement.java @@ -28,12 +28,14 @@ public class CurseOfEnfeeblement extends SpellRay { if(EntityUtils.isLiving(target)){ // This will actually run out in the end, but only if you leave Minecraft running for 3.4 years - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.curse_of_enfeeblement, - Integer.MAX_VALUE, getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); - // Reduce the target's health to its new max health if necessary - if(((EntityLivingBase)target).getHealth() > ((EntityLivingBase)target).getMaxHealth()){ - target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, MagicDamage.DamageType.WITHER), - ((EntityLivingBase)target).getHealth() - ((EntityLivingBase)target).getMaxHealth()); + if(!world.isRemote){ + ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.curse_of_enfeeblement, + Integer.MAX_VALUE, getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); + // Reduce the target's health to its new max health if necessary + if(((EntityLivingBase)target).getHealth() > ((EntityLivingBase)target).getMaxHealth()){ + target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, MagicDamage.DamageType.WITHER), + ((EntityLivingBase)target).getHealth() - ((EntityLivingBase)target).getMaxHealth()); + } } } diff --git a/src/main/java/electroblob/wizardry/spell/CurseOfSoulbinding.java b/src/main/java/electroblob/wizardry/spell/CurseOfSoulbinding.java index 8cd399ea..a800f99c 100644 --- a/src/main/java/electroblob/wizardry/spell/CurseOfSoulbinding.java +++ b/src/main/java/electroblob/wizardry/spell/CurseOfSoulbinding.java @@ -55,14 +55,16 @@ public class CurseOfSoulbinding extends SpellRay { protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){ if(EntityUtils.isLiving(target) && caster instanceof EntityPlayer){ - WizardData data = WizardData.get((EntityPlayer)caster); - if(data != null){ - // Return false if soulbinding failed (e.g. if the target is already soulbound) - if(getSoulboundCreatures(data).add(target.getUniqueID())){ - // This will actually run out in the end, but only if you leave Minecraft running for 3.4 years - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.curse_of_soulbinding, Integer.MAX_VALUE)); - }else{ - return false; + if(!world.isRemote){ + WizardData data = WizardData.get((EntityPlayer)caster); + if(data != null){ + // Return false if soulbinding failed (e.g. if the target is already soulbound) + if(getSoulboundCreatures(data).add(target.getUniqueID())){ + // This will actually run out in the end, but only if you leave Minecraft running for 3.4 years + ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.curse_of_soulbinding, Integer.MAX_VALUE)); + }else{ + return false; + } } } } diff --git a/src/main/java/electroblob/wizardry/spell/CurseOfUndeath.java b/src/main/java/electroblob/wizardry/spell/CurseOfUndeath.java index 9e0b51d1..a69da115 100644 --- a/src/main/java/electroblob/wizardry/spell/CurseOfUndeath.java +++ b/src/main/java/electroblob/wizardry/spell/CurseOfUndeath.java @@ -28,8 +28,10 @@ public class CurseOfUndeath extends SpellRay { if(EntityUtils.isLiving(target)){ // This will actually run out in the end, but only if you leave Minecraft running for 3.4 years - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.curse_of_undeath, Integer.MAX_VALUE, - getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); + if(!world.isRemote){ + ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.curse_of_undeath, Integer.MAX_VALUE, + getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); + } } return true; diff --git a/src/main/java/electroblob/wizardry/spell/EmpoweringPresence.java b/src/main/java/electroblob/wizardry/spell/EmpoweringPresence.java index d50e1dbe..58f2c2d1 100644 --- a/src/main/java/electroblob/wizardry/spell/EmpoweringPresence.java +++ b/src/main/java/electroblob/wizardry/spell/EmpoweringPresence.java @@ -42,9 +42,11 @@ public class EmpoweringPresence extends SpellAreaEffect { int bonusAmplifier = SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)); - target.addPotionEffect(new PotionEffect(WizardryPotions.empowerment, - (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), - getProperty(EFFECT_STRENGTH).intValue() + bonusAmplifier)); + if(!world.isRemote){ + target.addPotionEffect(new PotionEffect(WizardryPotions.empowerment, + (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), + getProperty(EFFECT_STRENGTH).intValue() + bonusAmplifier)); + } } return true; @@ -74,4 +76,4 @@ public class EmpoweringPresence extends SpellAreaEffect { } } -} \ No newline at end of file +} diff --git a/src/main/java/electroblob/wizardry/spell/FontOfMana.java b/src/main/java/electroblob/wizardry/spell/FontOfMana.java index 9ee1d567..c0757c07 100644 --- a/src/main/java/electroblob/wizardry/spell/FontOfMana.java +++ b/src/main/java/electroblob/wizardry/spell/FontOfMana.java @@ -33,7 +33,7 @@ public class FontOfMana extends SpellAreaEffect { @Override protected boolean affectEntity(World world, Vec3d origin, @Nullable EntityLivingBase caster, EntityLivingBase target, int targetCount, int ticksInUse, SpellModifiers modifiers){ - if(target instanceof EntityPlayer){ // Font of mana is only useful to players + if(target instanceof EntityPlayer && !world.isRemote){ // Font of mana is only useful to players target.addPotionEffect(new PotionEffect(WizardryPotions.font_of_mana, (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), (int)(getProperty(EFFECT_STRENGTH).intValue() + (modifiers.get(SpellModifiers.POTENCY) - 1) * 2))); @@ -58,4 +58,4 @@ public class FontOfMana extends SpellAreaEffect { / (2 + event.getCaster().getActivePotionEffect(WizardryPotions.font_of_mana).getAmplifier()), false); } } -} \ No newline at end of file +} diff --git a/src/main/java/electroblob/wizardry/spell/ForestsCurse.java b/src/main/java/electroblob/wizardry/spell/ForestsCurse.java index e83931ef..42d77598 100644 --- a/src/main/java/electroblob/wizardry/spell/ForestsCurse.java +++ b/src/main/java/electroblob/wizardry/spell/ForestsCurse.java @@ -38,9 +38,11 @@ public class ForestsCurse extends SpellAreaEffect { int duration = (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)); int amplifier = (int)(getProperty(EFFECT_STRENGTH).floatValue() + bonusAmplifier); - target.addPotionEffect(new PotionEffect(MobEffects.POISON, duration, amplifier)); - target.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, duration, amplifier)); - target.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, duration, amplifier)); + if(!world.isRemote){ + target.addPotionEffect(new PotionEffect(MobEffects.POISON, duration, amplifier)); + target.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, duration, amplifier)); + target.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, duration, amplifier)); + } } return true; diff --git a/src/main/java/electroblob/wizardry/spell/Freeze.java b/src/main/java/electroblob/wizardry/spell/Freeze.java index af9154fd..66959208 100644 --- a/src/main/java/electroblob/wizardry/spell/Freeze.java +++ b/src/main/java/electroblob/wizardry/spell/Freeze.java @@ -42,9 +42,11 @@ public class Freeze extends SpellRay { if(!world.isRemote && caster instanceof EntityPlayer) ((EntityPlayer)caster).sendStatusMessage( new TextComponentTranslation("spell.resist", target.getName(), this.getNameForTranslationFormatted()), true); }else{ - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.frost, - (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), - getProperty(EFFECT_STRENGTH).intValue())); + if(!world.isRemote){ + ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.frost, + (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), + getProperty(EFFECT_STRENGTH).intValue())); + } } if(target.isBurning()) target.extinguish(); diff --git a/src/main/java/electroblob/wizardry/spell/FrostRay.java b/src/main/java/electroblob/wizardry/spell/FrostRay.java index b5f18dd5..8074f7cf 100644 --- a/src/main/java/electroblob/wizardry/spell/FrostRay.java +++ b/src/main/java/electroblob/wizardry/spell/FrostRay.java @@ -61,9 +61,11 @@ public class FrostRay extends SpellRay { // with this mechanic for their own purposes, so this line makes sure that doesn't affect wizardry. }else{ // For frost ray the entity can move slightly, unlike freeze - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.frost, - (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), - getProperty(EFFECT_STRENGTH).intValue())); + if(!world.isRemote){ + ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.frost, + (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), + getProperty(EFFECT_STRENGTH).intValue())); + } if(ticksInUse % 10 == 0){ float damage = getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY); diff --git a/src/main/java/electroblob/wizardry/spell/IceAge.java b/src/main/java/electroblob/wizardry/spell/IceAge.java index f10582f1..ed1c7f38 100644 --- a/src/main/java/electroblob/wizardry/spell/IceAge.java +++ b/src/main/java/electroblob/wizardry/spell/IceAge.java @@ -60,7 +60,7 @@ public class IceAge extends SpellAreaEffect { caster, (int)(getProperty(FREEZE_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)))){ target.playSound(WizardrySounds.MISC_FREEZE, 1.0F, world.rand.nextFloat() * 0.4F + 0.8F); } - }else if(target instanceof EntityPlayer){ + }else if(target instanceof EntityPlayer && !world.isRemote){ target.addPotionEffect(new PotionEffect(WizardryPotions.frost, (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), getProperty(EFFECT_STRENGTH).intValue())); diff --git a/src/main/java/electroblob/wizardry/spell/Intimidate.java b/src/main/java/electroblob/wizardry/spell/Intimidate.java index 33594e7c..f09690a1 100644 --- a/src/main/java/electroblob/wizardry/spell/Intimidate.java +++ b/src/main/java/electroblob/wizardry/spell/Intimidate.java @@ -52,12 +52,14 @@ public class Intimidate extends SpellAreaEffect { int bonusAmplifier = SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)); - NBTTagCompound entityNBT = target.getEntityData(); - if(entityNBT != null) entityNBT.setUniqueId(NBT_KEY, caster.getUniqueID()); + if(!world.isRemote){ + NBTTagCompound entityNBT = target.getEntityData(); + if(entityNBT != null) entityNBT.setUniqueId(NBT_KEY, caster.getUniqueID()); - target.addPotionEffect(new PotionEffect(WizardryPotions.fear, - (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), - getProperty(EFFECT_STRENGTH).intValue() + bonusAmplifier)); + target.addPotionEffect(new PotionEffect(WizardryPotions.fear, + (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), + getProperty(EFFECT_STRENGTH).intValue() + bonusAmplifier)); + } } return true; diff --git a/src/main/java/electroblob/wizardry/spell/InvigoratingPresence.java b/src/main/java/electroblob/wizardry/spell/InvigoratingPresence.java index be00fa99..56879413 100644 --- a/src/main/java/electroblob/wizardry/spell/InvigoratingPresence.java +++ b/src/main/java/electroblob/wizardry/spell/InvigoratingPresence.java @@ -29,9 +29,11 @@ public class InvigoratingPresence extends SpellAreaEffect { int bonusAmplifier = SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)); - target.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, - (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), - getProperty(EFFECT_STRENGTH).intValue() + bonusAmplifier)); + if(!world.isRemote){ + target.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, + (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), + getProperty(EFFECT_STRENGTH).intValue() + bonusAmplifier)); + } return true; } diff --git a/src/main/java/electroblob/wizardry/spell/MarkSacrifice.java b/src/main/java/electroblob/wizardry/spell/MarkSacrifice.java index cd026485..48a2491c 100644 --- a/src/main/java/electroblob/wizardry/spell/MarkSacrifice.java +++ b/src/main/java/electroblob/wizardry/spell/MarkSacrifice.java @@ -32,7 +32,7 @@ public class MarkSacrifice extends SpellRay { @Override protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){ - if(EntityUtils.isLiving(target)){ + if(EntityUtils.isLiving(target) && !world.isRemote){ ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.mark_of_sacrifice, (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); diff --git a/src/main/java/electroblob/wizardry/spell/MindControl.java b/src/main/java/electroblob/wizardry/spell/MindControl.java index cdbbf6d8..90507564 100644 --- a/src/main/java/electroblob/wizardry/spell/MindControl.java +++ b/src/main/java/electroblob/wizardry/spell/MindControl.java @@ -120,8 +120,10 @@ public class MindControl extends SpellRay { } public static void startControlling(EntityLiving target, EntityLivingBase controller, int duration){ - target.getEntityData().setUniqueId(NBT_KEY, controller.getUniqueID()); - target.addPotionEffect(new PotionEffect(WizardryPotions.mind_control, duration, 0)); + if(!target.world.isRemote){ + target.getEntityData().setUniqueId(NBT_KEY, controller.getUniqueID()); + target.addPotionEffect(new PotionEffect(WizardryPotions.mind_control, duration, 0)); + } } /** @@ -238,4 +240,4 @@ public class MindControl extends SpellRay { } } -} \ No newline at end of file +} diff --git a/src/main/java/electroblob/wizardry/spell/Paralysis.java b/src/main/java/electroblob/wizardry/spell/Paralysis.java index 6f95d9ba..0abaa5f4 100644 --- a/src/main/java/electroblob/wizardry/spell/Paralysis.java +++ b/src/main/java/electroblob/wizardry/spell/Paralysis.java @@ -64,8 +64,10 @@ public class Paralysis extends SpellRay { } float durationMultiplier = target instanceof EntityPlayer ? modifiers.get(PLAYER_EFFECT_DURATION_MULTIPLIER) : 1.0f; - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.paralysis, - (int)(getProperty(EFFECT_DURATION).floatValue() * durationMultiplier * modifiers.get(WizardryItems.duration_upgrade)), 0)); + if(!world.isRemote){ + ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.paralysis, + (int)(getProperty(EFFECT_DURATION).floatValue() * durationMultiplier * modifiers.get(WizardryItems.duration_upgrade)), 0)); + } } return false; diff --git a/src/main/java/electroblob/wizardry/spell/PlagueOfDarkness.java b/src/main/java/electroblob/wizardry/spell/PlagueOfDarkness.java index 4bbac020..ba2e977b 100644 --- a/src/main/java/electroblob/wizardry/spell/PlagueOfDarkness.java +++ b/src/main/java/electroblob/wizardry/spell/PlagueOfDarkness.java @@ -34,9 +34,11 @@ public class PlagueOfDarkness extends SpellAreaEffect { if(!MagicDamage.isEntityImmune(DamageType.WITHER, target)){ target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.WITHER), getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY)); - target.addPotionEffect(new PotionEffect(MobEffects.WITHER, - (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), - getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); + if(!world.isRemote){ + target.addPotionEffect(new PotionEffect(MobEffects.WITHER, + (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), + getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); + } } return true; diff --git a/src/main/java/electroblob/wizardry/spell/Poison.java b/src/main/java/electroblob/wizardry/spell/Poison.java index 3b1d976d..79c5769f 100644 --- a/src/main/java/electroblob/wizardry/spell/Poison.java +++ b/src/main/java/electroblob/wizardry/spell/Poison.java @@ -45,9 +45,11 @@ public class Poison extends SpellRay { }else{ target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.POISON), getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY)); - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.POISON, - (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), - getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); + if(!world.isRemote){ + ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.POISON, + (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), + getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); + } } } diff --git a/src/main/java/electroblob/wizardry/spell/Possession.java b/src/main/java/electroblob/wizardry/spell/Possession.java index 7d4f600e..cf497e40 100644 --- a/src/main/java/electroblob/wizardry/spell/Possession.java +++ b/src/main/java/electroblob/wizardry/spell/Possession.java @@ -330,9 +330,11 @@ public class Possession extends SpellRay { victim.setPosition(player.posX, player.posY, player.posZ); if(!player.world.isRemote) player.world.spawnEntity(victim); - for(PotionEffect effect : player.getActivePotionEffects()){ - if(effect.getPotion() instanceof PotionSlowTime) continue; // Don't transfer slow time - victim.addPotionEffect(effect); + if(!player.world.isRemote){ + for(PotionEffect effect : player.getActivePotionEffects()){ + if(effect.getPotion() instanceof PotionSlowTime) continue; // Don't transfer slow time + victim.addPotionEffect(effect); + } } } diff --git a/src/main/java/electroblob/wizardry/spell/RayOfPurification.java b/src/main/java/electroblob/wizardry/spell/RayOfPurification.java index 150028bb..621e9455 100644 --- a/src/main/java/electroblob/wizardry/spell/RayOfPurification.java +++ b/src/main/java/electroblob/wizardry/spell/RayOfPurification.java @@ -69,8 +69,10 @@ public class RayOfPurification extends SpellRay { EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeDirectMagicDamage(caster, DamageType.RADIANT), damage); // Blindness - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, - (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)))); + if(!world.isRemote){ + ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, + (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)))); + } } } diff --git a/src/main/java/electroblob/wizardry/spell/Shield.java b/src/main/java/electroblob/wizardry/spell/Shield.java index 759ee3ed..2a27e576 100644 --- a/src/main/java/electroblob/wizardry/spell/Shield.java +++ b/src/main/java/electroblob/wizardry/spell/Shield.java @@ -41,8 +41,10 @@ public class Shield extends Spell { @Override public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){ - caster.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 10, - getProperty(EFFECT_STRENGTH).intValue(), false, false)); + if(!world.isRemote){ + caster.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 10, + getProperty(EFFECT_STRENGTH).intValue(), false, false)); + } if(WizardData.get(caster).getVariable(SHIELD_KEY) == null){ diff --git a/src/main/java/electroblob/wizardry/spell/SixthSense.java b/src/main/java/electroblob/wizardry/spell/SixthSense.java index 46eae1ac..f646852a 100644 --- a/src/main/java/electroblob/wizardry/spell/SixthSense.java +++ b/src/main/java/electroblob/wizardry/spell/SixthSense.java @@ -35,9 +35,11 @@ public class SixthSense extends Spell { @Override public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){ - caster.addPotionEffect(new PotionEffect(WizardryPotions.sixth_sense, - (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), - (int)((modifiers.get(WizardryItems.range_upgrade) - 1f) / Constants.RANGE_INCREASE_PER_LEVEL))); + if(!world.isRemote){ + caster.addPotionEffect(new PotionEffect(WizardryPotions.sixth_sense, + (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), + (int)((modifiers.get(WizardryItems.range_upgrade) - 1f) / Constants.RANGE_INCREASE_PER_LEVEL))); + } if(world.isRemote){ Wizardry.proxy.loadShader(caster, SHADER); diff --git a/src/main/java/electroblob/wizardry/spell/SpellBuff.java b/src/main/java/electroblob/wizardry/spell/SpellBuff.java index b767a6f2..6a1221a4 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellBuff.java +++ b/src/main/java/electroblob/wizardry/spell/SpellBuff.java @@ -168,6 +168,8 @@ public class SpellBuff extends Spell { * Returns a boolean to allow subclasses to cause the spell to fail if for some reason the effect cannot be applied * (for example, {@link Heal} fails if the caster is on full health). */ protected boolean applyEffects(EntityLivingBase caster, SpellModifiers modifiers){ + if(caster.world.isRemote) return true; + // This will generate 0 for novice and apprentice, and 1 for advanced and master // TODO: Once we've found a way of detecting if amplifiers actually affect the potion type, implement it here. int bonusAmplifier = getBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)); diff --git a/src/main/java/electroblob/wizardry/spell/Transportation.java b/src/main/java/electroblob/wizardry/spell/Transportation.java index 19a810f8..355c4791 100644 --- a/src/main/java/electroblob/wizardry/spell/Transportation.java +++ b/src/main/java/electroblob/wizardry/spell/Transportation.java @@ -157,8 +157,10 @@ public class Transportation extends Spell { if(BlockTransportationStone.testForCircle(world, destination)){ this.playSound(world, player, 0, -1, modifiers); - player.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 150, 0)); - data.setVariable(COUNTDOWN_KEY, getProperty(TELEPORT_COUNTDOWN).intValue()); + if(!world.isRemote){ + player.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 150, 0)); + data.setVariable(COUNTDOWN_KEY, getProperty(TELEPORT_COUNTDOWN).intValue()); + } return true; }else{ if(!world.isRemote) player.sendStatusMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".missing"), true); diff --git a/src/main/java/electroblob/wizardry/spell/Wither.java b/src/main/java/electroblob/wizardry/spell/Wither.java index 934fcd9d..462ceff6 100644 --- a/src/main/java/electroblob/wizardry/spell/Wither.java +++ b/src/main/java/electroblob/wizardry/spell/Wither.java @@ -39,9 +39,11 @@ public class Wither extends SpellRay { }else{ target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.WITHER), getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY)); - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.WITHER, - (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), - getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); + if(!world.isRemote){ + ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.WITHER, + (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), + getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); + } } }