fix: Fixed potion effect desyncs in the codebase (lingering clientside-only potion effects with 0 duration)

This commit is contained in:
WinDanesz
2026-05-11 16:35:12 +00:00
parent ba71f2ae4a
commit 032f1aa1a3
25 changed files with 115 additions and 71 deletions
@@ -27,7 +27,9 @@ public class BlindingFlash extends SpellAreaEffect {
if(EntityUtils.isLiving(target)){ if(EntityUtils.isLiving(target)){
int duration = (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)); 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; return true;
@@ -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){ 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)){
((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.containment, if(!world.isRemote){
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.containment,
getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY))));
}
} }
return true; return true;
@@ -28,12 +28,14 @@ public class CurseOfEnfeeblement extends SpellRay {
if(EntityUtils.isLiving(target)){ if(EntityUtils.isLiving(target)){
// This will actually run out in the end, but only if you leave Minecraft running for 3.4 years // 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, if(!world.isRemote){
Integer.MAX_VALUE, getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.curse_of_enfeeblement,
// Reduce the target's health to its new max health if necessary Integer.MAX_VALUE, getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY))));
if(((EntityLivingBase)target).getHealth() > ((EntityLivingBase)target).getMaxHealth()){ // Reduce the target's health to its new max health if necessary
target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, MagicDamage.DamageType.WITHER), if(((EntityLivingBase)target).getHealth() > ((EntityLivingBase)target).getMaxHealth()){
((EntityLivingBase)target).getHealth() - ((EntityLivingBase)target).getMaxHealth()); target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, MagicDamage.DamageType.WITHER),
((EntityLivingBase)target).getHealth() - ((EntityLivingBase)target).getMaxHealth());
}
} }
} }
@@ -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){ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){
if(EntityUtils.isLiving(target) && caster instanceof EntityPlayer){ if(EntityUtils.isLiving(target) && caster instanceof EntityPlayer){
WizardData data = WizardData.get((EntityPlayer)caster); if(!world.isRemote){
if(data != null){ WizardData data = WizardData.get((EntityPlayer)caster);
// Return false if soulbinding failed (e.g. if the target is already soulbound) if(data != null){
if(getSoulboundCreatures(data).add(target.getUniqueID())){ // Return false if soulbinding failed (e.g. if the target is already soulbound)
// This will actually run out in the end, but only if you leave Minecraft running for 3.4 years if(getSoulboundCreatures(data).add(target.getUniqueID())){
((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.curse_of_soulbinding, Integer.MAX_VALUE)); // This will actually run out in the end, but only if you leave Minecraft running for 3.4 years
}else{ ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.curse_of_soulbinding, Integer.MAX_VALUE));
return false; }else{
return false;
}
} }
} }
} }
@@ -28,8 +28,10 @@ public class CurseOfUndeath extends SpellRay {
if(EntityUtils.isLiving(target)){ if(EntityUtils.isLiving(target)){
// This will actually run out in the end, but only if you leave Minecraft running for 3.4 years // 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, if(!world.isRemote){
getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.curse_of_undeath, Integer.MAX_VALUE,
getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY))));
}
} }
return true; return true;
@@ -42,9 +42,11 @@ public class EmpoweringPresence extends SpellAreaEffect {
int bonusAmplifier = SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)); int bonusAmplifier = SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY));
target.addPotionEffect(new PotionEffect(WizardryPotions.empowerment, if(!world.isRemote){
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), target.addPotionEffect(new PotionEffect(WizardryPotions.empowerment,
getProperty(EFFECT_STRENGTH).intValue() + bonusAmplifier)); (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
getProperty(EFFECT_STRENGTH).intValue() + bonusAmplifier));
}
} }
return true; return true;
@@ -74,4 +76,4 @@ public class EmpoweringPresence extends SpellAreaEffect {
} }
} }
} }
@@ -33,7 +33,7 @@ public class FontOfMana extends SpellAreaEffect {
@Override @Override
protected boolean affectEntity(World world, Vec3d origin, @Nullable EntityLivingBase caster, EntityLivingBase target, int targetCount, int ticksInUse, SpellModifiers modifiers){ 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, target.addPotionEffect(new PotionEffect(WizardryPotions.font_of_mana,
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
(int)(getProperty(EFFECT_STRENGTH).intValue() + (modifiers.get(SpellModifiers.POTENCY) - 1) * 2))); (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); / (2 + event.getCaster().getActivePotionEffect(WizardryPotions.font_of_mana).getAmplifier()), false);
} }
} }
} }
@@ -38,9 +38,11 @@ public class ForestsCurse extends SpellAreaEffect {
int duration = (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)); int duration = (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade));
int amplifier = (int)(getProperty(EFFECT_STRENGTH).floatValue() + bonusAmplifier); int amplifier = (int)(getProperty(EFFECT_STRENGTH).floatValue() + bonusAmplifier);
target.addPotionEffect(new PotionEffect(MobEffects.POISON, duration, amplifier)); if(!world.isRemote){
target.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, duration, amplifier)); target.addPotionEffect(new PotionEffect(MobEffects.POISON, duration, amplifier));
target.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, duration, amplifier)); target.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, duration, amplifier));
target.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, duration, amplifier));
}
} }
return true; return true;
@@ -42,9 +42,11 @@ public class Freeze extends SpellRay {
if(!world.isRemote && caster instanceof EntityPlayer) ((EntityPlayer)caster).sendStatusMessage( if(!world.isRemote && caster instanceof EntityPlayer) ((EntityPlayer)caster).sendStatusMessage(
new TextComponentTranslation("spell.resist", target.getName(), this.getNameForTranslationFormatted()), true); new TextComponentTranslation("spell.resist", target.getName(), this.getNameForTranslationFormatted()), true);
}else{ }else{
((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.frost, if(!world.isRemote){
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.frost,
getProperty(EFFECT_STRENGTH).intValue())); (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
getProperty(EFFECT_STRENGTH).intValue()));
}
} }
if(target.isBurning()) target.extinguish(); if(target.isBurning()) target.extinguish();
@@ -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. // with this mechanic for their own purposes, so this line makes sure that doesn't affect wizardry.
}else{ }else{
// For frost ray the entity can move slightly, unlike freeze // For frost ray the entity can move slightly, unlike freeze
((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.frost, if(!world.isRemote){
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.frost,
getProperty(EFFECT_STRENGTH).intValue())); (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
getProperty(EFFECT_STRENGTH).intValue()));
}
if(ticksInUse % 10 == 0){ if(ticksInUse % 10 == 0){
float damage = getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY); float damage = getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY);
@@ -60,7 +60,7 @@ public class IceAge extends SpellAreaEffect {
caster, (int)(getProperty(FREEZE_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)))){ 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); 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, target.addPotionEffect(new PotionEffect(WizardryPotions.frost,
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
getProperty(EFFECT_STRENGTH).intValue())); getProperty(EFFECT_STRENGTH).intValue()));
@@ -52,12 +52,14 @@ public class Intimidate extends SpellAreaEffect {
int bonusAmplifier = SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)); int bonusAmplifier = SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY));
NBTTagCompound entityNBT = target.getEntityData(); if(!world.isRemote){
if(entityNBT != null) entityNBT.setUniqueId(NBT_KEY, caster.getUniqueID()); NBTTagCompound entityNBT = target.getEntityData();
if(entityNBT != null) entityNBT.setUniqueId(NBT_KEY, caster.getUniqueID());
target.addPotionEffect(new PotionEffect(WizardryPotions.fear, target.addPotionEffect(new PotionEffect(WizardryPotions.fear,
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
getProperty(EFFECT_STRENGTH).intValue() + bonusAmplifier)); getProperty(EFFECT_STRENGTH).intValue() + bonusAmplifier));
}
} }
return true; return true;
@@ -29,9 +29,11 @@ public class InvigoratingPresence extends SpellAreaEffect {
int bonusAmplifier = SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)); int bonusAmplifier = SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY));
target.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, if(!world.isRemote){
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), target.addPotionEffect(new PotionEffect(MobEffects.STRENGTH,
getProperty(EFFECT_STRENGTH).intValue() + bonusAmplifier)); (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
getProperty(EFFECT_STRENGTH).intValue() + bonusAmplifier));
}
return true; return true;
} }
@@ -32,7 +32,7 @@ public class MarkSacrifice extends SpellRay {
@Override @Override
protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){ 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, ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.mark_of_sacrifice,
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY))));
@@ -120,8 +120,10 @@ public class MindControl extends SpellRay {
} }
public static void startControlling(EntityLiving target, EntityLivingBase controller, int duration){ public static void startControlling(EntityLiving target, EntityLivingBase controller, int duration){
target.getEntityData().setUniqueId(NBT_KEY, controller.getUniqueID()); if(!target.world.isRemote){
target.addPotionEffect(new PotionEffect(WizardryPotions.mind_control, duration, 0)); 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 {
} }
} }
} }
@@ -64,8 +64,10 @@ public class Paralysis extends SpellRay {
} }
float durationMultiplier = target instanceof EntityPlayer ? modifiers.get(PLAYER_EFFECT_DURATION_MULTIPLIER) : 1.0f; float durationMultiplier = target instanceof EntityPlayer ? modifiers.get(PLAYER_EFFECT_DURATION_MULTIPLIER) : 1.0f;
((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.paralysis, if(!world.isRemote){
(int)(getProperty(EFFECT_DURATION).floatValue() * durationMultiplier * modifiers.get(WizardryItems.duration_upgrade)), 0)); ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.paralysis,
(int)(getProperty(EFFECT_DURATION).floatValue() * durationMultiplier * modifiers.get(WizardryItems.duration_upgrade)), 0));
}
} }
return false; return false;
@@ -34,9 +34,11 @@ public class PlagueOfDarkness extends SpellAreaEffect {
if(!MagicDamage.isEntityImmune(DamageType.WITHER, target)){ if(!MagicDamage.isEntityImmune(DamageType.WITHER, target)){
target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.WITHER), target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.WITHER),
getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY)); getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY));
target.addPotionEffect(new PotionEffect(MobEffects.WITHER, if(!world.isRemote){
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), target.addPotionEffect(new PotionEffect(MobEffects.WITHER,
getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY))));
}
} }
return true; return true;
@@ -45,9 +45,11 @@ public class Poison extends SpellRay {
}else{ }else{
target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.POISON), target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.POISON),
getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY)); getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY));
((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.POISON, if(!world.isRemote){
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.POISON,
getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY))));
}
} }
} }
@@ -330,9 +330,11 @@ public class Possession extends SpellRay {
victim.setPosition(player.posX, player.posY, player.posZ); victim.setPosition(player.posX, player.posY, player.posZ);
if(!player.world.isRemote) player.world.spawnEntity(victim); if(!player.world.isRemote) player.world.spawnEntity(victim);
for(PotionEffect effect : player.getActivePotionEffects()){ if(!player.world.isRemote){
if(effect.getPotion() instanceof PotionSlowTime) continue; // Don't transfer slow time for(PotionEffect effect : player.getActivePotionEffects()){
victim.addPotionEffect(effect); if(effect.getPotion() instanceof PotionSlowTime) continue; // Don't transfer slow time
victim.addPotionEffect(effect);
}
} }
} }
@@ -69,8 +69,10 @@ public class RayOfPurification extends SpellRay {
EntityUtils.attackEntityWithoutKnockback(target, EntityUtils.attackEntityWithoutKnockback(target,
MagicDamage.causeDirectMagicDamage(caster, DamageType.RADIANT), damage); MagicDamage.causeDirectMagicDamage(caster, DamageType.RADIANT), damage);
// Blindness // Blindness
((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, if(!world.isRemote){
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)))); ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.BLINDNESS,
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade))));
}
} }
} }
@@ -41,8 +41,10 @@ public class Shield extends Spell {
@Override @Override
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){ public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
caster.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 10, if(!world.isRemote){
getProperty(EFFECT_STRENGTH).intValue(), false, false)); caster.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 10,
getProperty(EFFECT_STRENGTH).intValue(), false, false));
}
if(WizardData.get(caster).getVariable(SHIELD_KEY) == null){ if(WizardData.get(caster).getVariable(SHIELD_KEY) == null){
@@ -35,9 +35,11 @@ public class SixthSense extends Spell {
@Override @Override
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){ public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
caster.addPotionEffect(new PotionEffect(WizardryPotions.sixth_sense, if(!world.isRemote){
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), caster.addPotionEffect(new PotionEffect(WizardryPotions.sixth_sense,
(int)((modifiers.get(WizardryItems.range_upgrade) - 1f) / Constants.RANGE_INCREASE_PER_LEVEL))); (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){ if(world.isRemote){
Wizardry.proxy.loadShader(caster, SHADER); Wizardry.proxy.loadShader(caster, SHADER);
@@ -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 * 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). */ * (for example, {@link Heal} fails if the caster is on full health). */
protected boolean applyEffects(EntityLivingBase caster, SpellModifiers modifiers){ 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 // 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. // 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)); int bonusAmplifier = getBonusAmplifier(modifiers.get(SpellModifiers.POTENCY));
@@ -157,8 +157,10 @@ public class Transportation extends Spell {
if(BlockTransportationStone.testForCircle(world, destination)){ if(BlockTransportationStone.testForCircle(world, destination)){
this.playSound(world, player, 0, -1, modifiers); this.playSound(world, player, 0, -1, modifiers);
player.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 150, 0)); if(!world.isRemote){
data.setVariable(COUNTDOWN_KEY, getProperty(TELEPORT_COUNTDOWN).intValue()); player.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 150, 0));
data.setVariable(COUNTDOWN_KEY, getProperty(TELEPORT_COUNTDOWN).intValue());
}
return true; return true;
}else{ }else{
if(!world.isRemote) player.sendStatusMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".missing"), true); if(!world.isRemote) player.sendStatusMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".missing"), true);
@@ -39,9 +39,11 @@ public class Wither extends SpellRay {
}else{ }else{
target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.WITHER), target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.WITHER),
getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY)); getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY));
((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.WITHER, if(!world.isRemote){
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.WITHER,
getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY))));
}
} }
} }