mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 03:26:44 +01:00
Fix lag when both a dark vortex and hydrophobic (as well as other combinations) of spells are active at once
This commit is contained in:
parent
7b1f5ce0db
commit
e017fb1b89
3 changed files with 9 additions and 9 deletions
|
@ -44,9 +44,10 @@ public class AttractiveSpell extends ShieldSpell implements HomingSpell, TimedSp
|
||||||
if (timer.getTicksRemaining() <= 0) {
|
if (timer.getTicksRemaining() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
setDirty();
|
|
||||||
target.getOrEmpty(caster.asWorld())
|
target.getOrEmpty(caster.asWorld())
|
||||||
.filter(entity -> entity.distanceTo(caster.asEntity()) > getDrawDropOffRange(caster))
|
.filter(entity -> entity.distanceTo(caster.asEntity()) > getDrawDropOffRange(caster))
|
||||||
.ifPresent(entity -> {
|
.ifPresent(entity -> {
|
||||||
|
|
|
@ -80,10 +80,7 @@ public class DarkVortexSpell extends AttractiveSpell implements ProjectileDelega
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
age++;
|
if (++age % 20 == 0) {
|
||||||
setDirty();
|
|
||||||
|
|
||||||
if (age % 20 == 0) {
|
|
||||||
source.asWorld().playSound(null, source.getOrigin(), USounds.AMBIENT_DARK_VORTEX_ADDITIONS, SoundCategory.AMBIENT, 1, 1);
|
source.asWorld().playSound(null, source.getOrigin(), USounds.AMBIENT_DARK_VORTEX_ADDITIONS, SoundCategory.AMBIENT, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +159,6 @@ public class DarkVortexSpell extends AttractiveSpell implements ProjectileDelega
|
||||||
applyRadialEffect(source, e, e.getPos().distanceTo(origin), radius);
|
applyRadialEffect(source, e, e.getPos().distanceTo(origin), radius);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setDirty();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,8 +217,11 @@ public class DarkVortexSpell extends AttractiveSpell implements ProjectileDelega
|
||||||
|
|
||||||
double massOfTarget = AttractionUtils.getMass(target);
|
double massOfTarget = AttractionUtils.getMass(target);
|
||||||
|
|
||||||
accumulatedMass += massOfTarget;
|
if (massOfTarget != 0) {
|
||||||
setDirty();
|
accumulatedMass += massOfTarget;
|
||||||
|
setDirty();
|
||||||
|
}
|
||||||
|
|
||||||
target.damage(source.damageOf(UDamageTypes.GAVITY_WELL_RECOIL, source), Integer.MAX_VALUE);
|
target.damage(source.damageOf(UDamageTypes.GAVITY_WELL_RECOIL, source), Integer.MAX_VALUE);
|
||||||
if (!(target instanceof PlayerEntity)) {
|
if (!(target instanceof PlayerEntity)) {
|
||||||
target.discard();
|
target.discard();
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class EffectSync implements SpellContainer, NbtSerialisable {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private <T extends Spell> Stream<T> read(@Nullable SpellPredicate<T> type, boolean synchronize, boolean sendUpdate) {
|
private <T extends Spell> Stream<T> read(@Nullable SpellPredicate<T> type, boolean synchronize, boolean sendUpdate) {
|
||||||
if (synchronize && spells.fromNbt(owner.asEntity().getDataTracker().get(param)) && sendUpdate) {
|
if (synchronize && spells.fromNbt(owner.asEntity().getDataTracker().get(param)) && sendUpdate) {
|
||||||
owner.asEntity().getDataTracker().set(param, spells.toNbt());
|
write();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
|
|
Loading…
Reference in a new issue