mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Added flight sounds for changelings
This commit is contained in:
parent
536502027d
commit
5db8150c02
11 changed files with 29 additions and 10 deletions
|
@ -3,10 +3,12 @@ package com.minelittlepony.unicopia.client;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.FlightType;
|
||||||
import com.minelittlepony.unicopia.InteractionManager;
|
import com.minelittlepony.unicopia.InteractionManager;
|
||||||
import com.minelittlepony.unicopia.USounds;
|
import com.minelittlepony.unicopia.USounds;
|
||||||
import com.minelittlepony.unicopia.client.sound.LoopingSoundInstance;
|
import com.minelittlepony.unicopia.client.sound.LoopingSoundInstance;
|
||||||
import com.minelittlepony.unicopia.entity.effect.SunBlindnessStatusEffect;
|
import com.minelittlepony.unicopia.entity.effect.SunBlindnessStatusEffect;
|
||||||
|
import com.minelittlepony.unicopia.entity.player.PlayerPhysics;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.entity.player.dummy.DummyClientPlayerEntity;
|
import com.minelittlepony.unicopia.entity.player.dummy.DummyClientPlayerEntity;
|
||||||
import com.minelittlepony.unicopia.network.handler.ClientNetworkHandler;
|
import com.minelittlepony.unicopia.network.handler.ClientNetworkHandler;
|
||||||
|
@ -50,6 +52,11 @@ public class ClientInteractionManager extends InteractionManager {
|
||||||
);
|
);
|
||||||
} else if (type == SOUND_MINECART && source instanceof AbstractMinecartEntity) {
|
} else if (type == SOUND_MINECART && source instanceof AbstractMinecartEntity) {
|
||||||
soundManager.play(new MovingMinecartSoundInstance((AbstractMinecartEntity)source));
|
soundManager.play(new MovingMinecartSoundInstance((AbstractMinecartEntity)source));
|
||||||
|
} else if (type == SOUND_CHANGELING_BUZZ && source instanceof PlayerEntity) {
|
||||||
|
soundManager.play(new LoopingSoundInstance<>((PlayerEntity)source, e -> {
|
||||||
|
PlayerPhysics physics = Pony.of(e).getPhysics();
|
||||||
|
return physics.isFlying() && physics.getFlightType() == FlightType.INSECTOID;
|
||||||
|
}, USounds.ENTITY_PLAYER_CHANGELING_BUZZ, 1F, 1F));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.entity.player;
|
package com.minelittlepony.unicopia.entity.player;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.FlightType;
|
import com.minelittlepony.unicopia.FlightType;
|
||||||
|
import com.minelittlepony.unicopia.InteractionManager;
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.Race;
|
||||||
import com.minelittlepony.unicopia.USounds;
|
import com.minelittlepony.unicopia.USounds;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.SpellType;
|
import com.minelittlepony.unicopia.ability.magic.spell.SpellType;
|
||||||
|
@ -50,6 +51,8 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
public boolean isFlyingEither = false;
|
public boolean isFlyingEither = false;
|
||||||
public boolean isFlyingSurvival = false;
|
public boolean isFlyingSurvival = false;
|
||||||
|
|
||||||
|
private boolean soundPlaying;
|
||||||
|
|
||||||
private int wallHitCooldown;
|
private int wallHitCooldown;
|
||||||
|
|
||||||
private Vec3d lastPos = Vec3d.ZERO;
|
private Vec3d lastPos = Vec3d.ZERO;
|
||||||
|
@ -89,22 +92,26 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
float spreadAmount = -0.5F;
|
float spreadAmount = -0.5F;
|
||||||
|
|
||||||
if (isFlying()) {
|
if (isFlying()) {
|
||||||
//spreadAmount += Math.sin(pony.getEntity().age / 4F) * 8;
|
if (getFlightType() == FlightType.INSECTOID) {
|
||||||
spreadAmount += isGliding() ? 3 : thrustScale * 60;
|
spreadAmount += Math.sin(pony.getEntity().age * 4F) * 8;
|
||||||
|
} else {
|
||||||
|
spreadAmount += isGliding() ? 3 : thrustScale * 60;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
spreadAmount += MathHelper.clamp(-entity.getVelocity().y, 0, 2);
|
||||||
|
spreadAmount += Math.sin(entity.age / 9F) / 9F;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.isSneaking()) {
|
if (entity.isSneaking()) {
|
||||||
spreadAmount += 2;
|
spreadAmount += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
spreadAmount += MathHelper.clamp(-entity.getVelocity().y, 0, 2);
|
|
||||||
spreadAmount += Math.sin(entity.age / 9F) / 9F;
|
|
||||||
spreadAmount = MathHelper.clamp(spreadAmount, -2, 5);
|
spreadAmount = MathHelper.clamp(spreadAmount, -2, 5);
|
||||||
|
|
||||||
return pony.getInterpolator().interpolate("wingSpreadAmount", spreadAmount, 10);
|
return pony.getInterpolator().interpolate("wingSpreadAmount", spreadAmount, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FlightType getFlightType() {
|
public FlightType getFlightType() {
|
||||||
|
|
||||||
if (UItems.PEGASUS_AMULET.isApplicable(entity)) {
|
if (UItems.PEGASUS_AMULET.isApplicable(entity)) {
|
||||||
return FlightType.ARTIFICIAL;
|
return FlightType.ARTIFICIAL;
|
||||||
|
@ -210,11 +217,14 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
tickFlight(type, velocity);
|
tickFlight(type, velocity);
|
||||||
} else {
|
} else {
|
||||||
ticksInAir = 0;
|
ticksInAir = 0;
|
||||||
|
soundPlaying = false;
|
||||||
|
|
||||||
if (!creative && type.isAvian()) {
|
if (!creative && type.isAvian()) {
|
||||||
checkAvianTakeoffConditions(velocity);
|
checkAvianTakeoffConditions(velocity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
soundPlaying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastPos = new Vec3d(entity.getX(), 0, entity.getZ());
|
lastPos = new Vec3d(entity.getX(), 0, entity.getZ());
|
||||||
|
@ -266,6 +276,11 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
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) {
|
||||||
|
if (entity.world.isClient && !soundPlaying) {
|
||||||
|
soundPlaying = true;
|
||||||
|
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_CHANGELING_BUZZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import com.minelittlepony.unicopia.ability.magic.Affine;
|
||||||
import com.minelittlepony.unicopia.ability.magic.Spell;
|
import com.minelittlepony.unicopia.ability.magic.Spell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.SpellType;
|
import com.minelittlepony.unicopia.ability.magic.spell.SpellType;
|
||||||
import com.minelittlepony.unicopia.advancement.UCriteria;
|
import com.minelittlepony.unicopia.advancement.UCriteria;
|
||||||
import com.minelittlepony.unicopia.entity.Physics;
|
|
||||||
import com.minelittlepony.unicopia.entity.PonyContainer;
|
import com.minelittlepony.unicopia.entity.PonyContainer;
|
||||||
import com.minelittlepony.unicopia.entity.Living;
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
import com.minelittlepony.unicopia.entity.Trap;
|
import com.minelittlepony.unicopia.entity.Trap;
|
||||||
|
@ -184,7 +183,7 @@ public class Pony extends Living<PlayerEntity> implements Transmittable, Copieab
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Physics getPhysics() {
|
public PlayerPhysics getPhysics() {
|
||||||
return gravity;
|
return gravity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,7 @@
|
||||||
"category": "player",
|
"category": "player",
|
||||||
"subtitle": "unicopia.subtitle.changeling_buzz",
|
"subtitle": "unicopia.subtitle.changeling_buzz",
|
||||||
"sounds": [
|
"sounds": [
|
||||||
"unicopia:cicada/cicada_4",
|
"unicopia:changeling/buzz0"
|
||||||
"unicopia:cicada/cicada_5",
|
|
||||||
"unicopia:cicada/cicada_6"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"entity.player.ears_ring": {
|
"entity.player.ears_ring": {
|
||||||
|
|
BIN
src/main/resources/assets/unicopia/sounds/changeling/buzz0.ogg
Normal file
BIN
src/main/resources/assets/unicopia/sounds/changeling/buzz0.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/unicopia/sounds/cicada/cicada_4.ogg
Normal file
BIN
src/main/resources/assets/unicopia/sounds/cicada/cicada_4.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/unicopia/sounds/cicada/cicada_5.ogg
Normal file
BIN
src/main/resources/assets/unicopia/sounds/cicada/cicada_5.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/unicopia/sounds/cicada/cicada_6.ogg
Normal file
BIN
src/main/resources/assets/unicopia/sounds/cicada/cicada_6.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/unicopia/sounds/insect/insect_1.ogg
Normal file
BIN
src/main/resources/assets/unicopia/sounds/insect/insect_1.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/unicopia/sounds/insect/insect_2.ogg
Normal file
BIN
src/main/resources/assets/unicopia/sounds/insect/insect_2.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/unicopia/sounds/insect/insect_3.ogg
Normal file
BIN
src/main/resources/assets/unicopia/sounds/insect/insect_3.ogg
Normal file
Binary file not shown.
Loading…
Reference in a new issue