Prevent flying sounds from playing whilst disguised

This commit is contained in:
Sollace 2021-08-23 23:08:03 +02:00
parent 0d06f13ee5
commit 6fbcce7c22
3 changed files with 15 additions and 7 deletions

View file

@ -14,8 +14,7 @@ public interface SpellContainer {
}
@Override
public void put(Spell effect) {
}
public void put(Spell effect) { }
};
/**

View file

@ -3,12 +3,17 @@ package com.minelittlepony.unicopia.ability.magic.spell;
import java.util.function.Predicate;
import com.minelittlepony.unicopia.ability.magic.Attached;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.Spell;
import com.minelittlepony.unicopia.ability.magic.Suppressable;
import com.minelittlepony.unicopia.ability.magic.Thrown;
public interface SpellPredicate<T> extends Predicate<Spell> {
public interface SpellPredicate<T extends Spell> extends Predicate<Spell> {
SpellPredicate<Thrown> IS_THROWN = s -> s instanceof Thrown;
SpellPredicate<Attached> IS_ATTACHED = s -> s instanceof Attached;
SpellPredicate<Suppressable> IS_SUPPRESSABLE = s -> s instanceof Suppressable;
default boolean isOn(Caster<?> caster) {
return caster.getSpellSlot().get(this, false).isPresent();
}
}

View file

@ -315,14 +315,16 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
ticksToGlide = 20;
}
if (!SpellType.DISGUISE.isOn(pony)) {
if (ticksInAir % 200 == 1 && pony.isClient()) {
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_GLIDING);
}
}
velocity.y -= 0.02 * getGravitySignum();
velocity.x *= 0.9896;
velocity.z *= 0.9896;
} else if (type == FlightType.INSECTOID) {
} else if (type == FlightType.INSECTOID && !SpellType.DISGUISE.isOn(pony)) {
if (entity.world.isClient && !soundPlaying) {
soundPlaying = true;
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_CHANGELING_BUZZ);
@ -474,7 +476,9 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
if (thrustScale <= 0.000001F & flapping) {
flapping = false;
if (!SpellType.DISGUISE.isOn(pony)) {
entity.playSound(getFlightType().getWingFlapSound(), 0.5F, 1);
}
thrustScale = 1;
}