mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-24 05:47:59 +01:00
Prevent flying sounds from playing whilst disguised
This commit is contained in:
parent
0d06f13ee5
commit
6fbcce7c22
3 changed files with 15 additions and 7 deletions
|
@ -14,8 +14,7 @@ public interface SpellContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void put(Spell effect) {
|
public void put(Spell effect) { }
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,12 +3,17 @@ package com.minelittlepony.unicopia.ability.magic.spell;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.ability.magic.Attached;
|
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.Spell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.Suppressable;
|
import com.minelittlepony.unicopia.ability.magic.Suppressable;
|
||||||
import com.minelittlepony.unicopia.ability.magic.Thrown;
|
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<Thrown> IS_THROWN = s -> s instanceof Thrown;
|
||||||
SpellPredicate<Attached> IS_ATTACHED = s -> s instanceof Attached;
|
SpellPredicate<Attached> IS_ATTACHED = s -> s instanceof Attached;
|
||||||
SpellPredicate<Suppressable> IS_SUPPRESSABLE = s -> s instanceof Suppressable;
|
SpellPredicate<Suppressable> IS_SUPPRESSABLE = s -> s instanceof Suppressable;
|
||||||
|
|
||||||
|
default boolean isOn(Caster<?> caster) {
|
||||||
|
return caster.getSpellSlot().get(this, false).isPresent();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -315,14 +315,16 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
ticksToGlide = 20;
|
ticksToGlide = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ticksInAir % 200 == 1 && pony.isClient()) {
|
if (!SpellType.DISGUISE.isOn(pony)) {
|
||||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_GLIDING);
|
if (ticksInAir % 200 == 1 && pony.isClient()) {
|
||||||
|
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_GLIDING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
velocity.y -= 0.02 * getGravitySignum();
|
velocity.y -= 0.02 * getGravitySignum();
|
||||||
velocity.x *= 0.9896;
|
velocity.x *= 0.9896;
|
||||||
velocity.z *= 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) {
|
if (entity.world.isClient && !soundPlaying) {
|
||||||
soundPlaying = true;
|
soundPlaying = true;
|
||||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_CHANGELING_BUZZ);
|
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) {
|
if (thrustScale <= 0.000001F & flapping) {
|
||||||
flapping = false;
|
flapping = false;
|
||||||
entity.playSound(getFlightType().getWingFlapSound(), 0.5F, 1);
|
if (!SpellType.DISGUISE.isOn(pony)) {
|
||||||
|
entity.playSound(getFlightType().getWingFlapSound(), 0.5F, 1);
|
||||||
|
}
|
||||||
thrustScale = 1;
|
thrustScale = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue