diff --git a/src/main/java/com/minelittlepony/unicopia/client/ClientInteractionManager.java b/src/main/java/com/minelittlepony/unicopia/client/ClientInteractionManager.java index ec4a26e7..56e72bf9 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/ClientInteractionManager.java +++ b/src/main/java/com/minelittlepony/unicopia/client/ClientInteractionManager.java @@ -64,7 +64,7 @@ public class ClientInteractionManager extends InteractionManager { SoundManager soundManager = client.getSoundManager(); if (type == SOUND_EARS_RINGING && source instanceof LivingEntity living) { - soundManager.play(new LoopingSoundInstance<>(living, + soundManager.playNextTick(new LoopingSoundInstance<>(living, createTicker(100).and(e -> !e.isRemoved()), USounds.ENTITY_PLAYER_EARS_RINGING, 0.01F, 2, Random.create(seed)).setFadeIn() ); @@ -75,26 +75,26 @@ public class ClientInteractionManager extends InteractionManager { : new PassiveBeeSoundInstance(bee) ); } else if (type == SOUND_MINECART && source instanceof AbstractMinecartEntity minecart) { - soundManager.play(new MovingMinecartSoundInstance(minecart)); + soundManager.playNextTick(new MovingMinecartSoundInstance(minecart)); } else if (type == SOUND_CHANGELING_BUZZ && source instanceof PlayerEntity player) { - soundManager.play(new MotionBasedSoundInstance<>(USounds.ENTITY_PLAYER_CHANGELING_BUZZ, player, e -> { + soundManager.playNextTick(new MotionBasedSoundInstance<>(USounds.ENTITY_PLAYER_CHANGELING_BUZZ, player, e -> { PlayerPhysics physics = Pony.of(e).getPhysics(); return physics.isFlying() && physics.getFlightType() == FlightType.INSECTOID; }, 0.25F, 0.5F, 0.66F, Random.create(seed))); } else if (type == SOUND_GLIDING && source instanceof PlayerEntity player && isClientPlayer(player)) { - soundManager.play(new MotionBasedSoundInstance<>(USounds.Vanilla.ITEM_ELYTRA_FLYING, player, e -> { + soundManager.playNextTick(new MotionBasedSoundInstance<>(USounds.Vanilla.ITEM_ELYTRA_FLYING, player, e -> { Pony pony = Pony.of(e); return pony.getPhysics().isFlying() && pony.getPhysics().getFlightType().isAvian(); }, 0, 1, 1, Random.create(seed))); } else if (type == SOUND_GLIDING && source instanceof PlayerEntity player) { - soundManager.play(new MotionBasedSoundInstance<>(USounds.ENTITY_PLAYER_PEGASUS_FLYING, player, e -> { + soundManager.playNextTick(new MotionBasedSoundInstance<>(USounds.ENTITY_PLAYER_PEGASUS_FLYING, player, e -> { Pony pony = Pony.of(e); return pony.getPhysics().isFlying() && pony.getPhysics().getFlightType().isAvian(); }, 0, 1, 1, Random.create(seed))); } else if (type == SOUND_MAGIC_BEAM) { - soundManager.play(new LoopedEntityTrackingSoundInstance(USounds.SPELL_CAST_SHOOT, 0.3F, 1F, source, seed)); + soundManager.playNextTick(new LoopedEntityTrackingSoundInstance(USounds.SPELL_CAST_SHOOT, 0.3F, 1F, source, seed)); } else if (type == SOUND_HEART_BEAT) { - soundManager.play(new NonLoopingFadeOutSoundInstance(USounds.ENTITY_PLAYER_HEARTBEAT, SoundCategory.PLAYERS, 0.3F, Random.create(seed), 80L)); + soundManager.playNextTick(new NonLoopingFadeOutSoundInstance(USounds.ENTITY_PLAYER_HEARTBEAT, SoundCategory.PLAYERS, 0.3F, Random.create(seed), 80L)); } }); } diff --git a/src/main/java/com/minelittlepony/unicopia/client/sound/MagicAuraSoundInstance.java b/src/main/java/com/minelittlepony/unicopia/client/sound/MagicAuraSoundInstance.java index c13c30dd..f63b077e 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/sound/MagicAuraSoundInstance.java +++ b/src/main/java/com/minelittlepony/unicopia/client/sound/MagicAuraSoundInstance.java @@ -17,7 +17,13 @@ public class MagicAuraSoundInstance extends FadeOutSoundInstance { public MagicAuraSoundInstance(SoundCategory category, Living living, Random random) { super(USounds.ITEM_MAGIC_AURA, category, 1, random); + this.relative = false; this.living = living; + + Vec3d pos = living.getOriginVector(); + x = pos.x; + y = pos.y; + z = pos.z; } @Override diff --git a/src/main/java/com/minelittlepony/unicopia/client/sound/MotionBasedSoundInstance.java b/src/main/java/com/minelittlepony/unicopia/client/sound/MotionBasedSoundInstance.java index 759a74c4..ec12f990 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/sound/MotionBasedSoundInstance.java +++ b/src/main/java/com/minelittlepony/unicopia/client/sound/MotionBasedSoundInstance.java @@ -35,6 +35,11 @@ public class MotionBasedSoundInstance extends FadeOutSoundInst this.minVolume = minVolume; this.maxVolume = maxVolume; this.playingCondition = playingCondition; + this.relative = false; // position is ABSOLUTE! We do this so the sound doesn't play to other players + + x = (float)entity.getX(); + y = (float)entity.getY(); + z = (float)entity.getZ(); } @Override