From 56643db555da6ac7b741f40eb519650309dfc45b Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 22 Aug 2021 23:49:00 +0200 Subject: [PATCH] Fixed some other sound weirdness --- .../entity/behaviour/SheepBehaviour.java | 3 +-- .../unicopia/entity/player/PlayerPhysics.java | 16 ++++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/SheepBehaviour.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/SheepBehaviour.java index e985b805..ab7121d1 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/SheepBehaviour.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/SheepBehaviour.java @@ -13,7 +13,6 @@ import net.minecraft.entity.ItemEntity; import net.minecraft.entity.passive.SheepEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; -import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; import net.minecraft.util.math.BlockPos; @@ -40,7 +39,7 @@ public class SheepBehaviour extends EntityBehaviour { } else if (!entity.isSheared()) { ItemStack dropType = new ItemStack(MixinSheepEntity.getDrops().get(entity.getColor()).asItem()); - player.getMaster().playSound(SoundEvents.ENTITY_SHEEP_SHEAR, SoundCategory.PLAYERS, 1, 1); + player.getMaster().playSound(SoundEvents.ENTITY_SHEEP_SHEAR, 1, 1); entity.setSheared(true); Random rng = entity.world.random; diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java index 2d1419e1..5834fd6d 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java @@ -141,10 +141,6 @@ public class PlayerPhysics extends EntityPhysics implements Tickab isFlyingSurvival = false; } - private void playSound(SoundEvent event, float volume, float pitch) { - entity.world.playSoundFromEntity(null, entity, event, entity.getSoundCategory(), volume, pitch); - } - private double getHorizontalMotion(Entity e) { return e.getPos().subtract(lastPos).horizontalLengthSquared(); } @@ -175,7 +171,7 @@ public class PlayerPhysics extends EntityPhysics implements Tickab if (type != lastFlightType && (lastFlightType.isArtifical() || type.isArtifical())) { ParticleUtils.spawnParticles(ParticleTypes.CLOUD, entity, 10); - entity.world.playSound(entity.getX(), entity.getY(), entity.getZ(), entity.world.getDimension().isUltrawarm() ? SoundEvents.BLOCK_BELL_USE : SoundEvents.BLOCK_BELL_RESONATE, SoundCategory.PLAYERS, 0.1125F, 1.5F, true); + entity.playSound(entity.world.getDimension().isUltrawarm() ? SoundEvents.BLOCK_BELL_USE : SoundEvents.BLOCK_BELL_RESONATE, 0.1125F, 1.5F); } entity.getAbilities().allowFlying = type.canFlyCreative(entity); @@ -236,7 +232,7 @@ public class PlayerPhysics extends EntityPhysics implements Tickab prevStrafe = strafing; strafe = 1; ticksToGlide = 20; - entity.playSound(getFlightType().getWingFlapSound(), 0.25F, 1); + entity.playSound(type.getWingFlapSound(), 0.25F, 1); } else { strafe *= 0.28; } @@ -344,7 +340,7 @@ public class PlayerPhysics extends EntityPhysics implements Tickab AmuletItem.consumeEnergy(stack, energyConsumed); if (AmuletItem.getEnergy(stack) < 9) { - playSound(SoundEvents.BLOCK_CHAIN_STEP, 0.13F, 0.5F); + entity.playSound(SoundEvents.BLOCK_CHAIN_STEP, 0.13F, 0.5F); } if (entity.world.random.nextInt(damageInterval) == 0) { @@ -352,7 +348,7 @@ public class PlayerPhysics extends EntityPhysics implements Tickab } if (!getFlightType().canFly()) { - playSound(SoundEvents.ITEM_SHIELD_BREAK, 1, 2); + entity.playSound(SoundEvents.ITEM_SHIELD_BREAK, 1, 2); cancelFlight(); } } @@ -430,12 +426,12 @@ public class PlayerPhysics extends EntityPhysics implements Tickab wallHitCooldown = 30; if (bouncyness > 0) { - playSound(USounds.ENTITY_PLAYER_REBOUND, 1, 1); + entity.playSound(USounds.ENTITY_PLAYER_REBOUND, 1, 1); ProjectileUtil.ricochet(entity, Vec3d.of(pos), 0.4F + Math.min(2, bouncyness / 18F)); velocity.fromImmutable(entity.getVelocity()); distance /= bouncyness; } else { - playSound(distance > 4 ? SoundEvents.ENTITY_PLAYER_BIG_FALL : SoundEvents.ENTITY_PLAYER_SMALL_FALL, 1, 1); + entity.playSound(distance > 4 ? SoundEvents.ENTITY_PLAYER_BIG_FALL : SoundEvents.ENTITY_PLAYER_SMALL_FALL, 1, 1); } entity.damage(DamageSource.FLY_INTO_WALL, distance); }