Fixed some other sound weirdness

This commit is contained in:
Sollace 2021-08-22 23:49:00 +02:00
parent 9f4713018f
commit 56643db555
2 changed files with 7 additions and 12 deletions

View file

@ -13,7 +13,6 @@ import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.passive.SheepEntity; import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -40,7 +39,7 @@ public class SheepBehaviour extends EntityBehaviour<SheepEntity> {
} else if (!entity.isSheared()) { } else if (!entity.isSheared()) {
ItemStack dropType = new ItemStack(MixinSheepEntity.getDrops().get(entity.getColor()).asItem()); 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); entity.setSheared(true);
Random rng = entity.world.random; Random rng = entity.world.random;

View file

@ -141,10 +141,6 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
isFlyingSurvival = false; 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) { private double getHorizontalMotion(Entity e) {
return e.getPos().subtract(lastPos).horizontalLengthSquared(); return e.getPos().subtract(lastPos).horizontalLengthSquared();
} }
@ -175,7 +171,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
if (type != lastFlightType && (lastFlightType.isArtifical() || type.isArtifical())) { if (type != lastFlightType && (lastFlightType.isArtifical() || type.isArtifical())) {
ParticleUtils.spawnParticles(ParticleTypes.CLOUD, entity, 10); 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); entity.getAbilities().allowFlying = type.canFlyCreative(entity);
@ -236,7 +232,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
prevStrafe = strafing; prevStrafe = strafing;
strafe = 1; strafe = 1;
ticksToGlide = 20; ticksToGlide = 20;
entity.playSound(getFlightType().getWingFlapSound(), 0.25F, 1); entity.playSound(type.getWingFlapSound(), 0.25F, 1);
} else { } else {
strafe *= 0.28; strafe *= 0.28;
} }
@ -344,7 +340,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
AmuletItem.consumeEnergy(stack, energyConsumed); AmuletItem.consumeEnergy(stack, energyConsumed);
if (AmuletItem.getEnergy(stack) < 9) { 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) { if (entity.world.random.nextInt(damageInterval) == 0) {
@ -352,7 +348,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
} }
if (!getFlightType().canFly()) { if (!getFlightType().canFly()) {
playSound(SoundEvents.ITEM_SHIELD_BREAK, 1, 2); entity.playSound(SoundEvents.ITEM_SHIELD_BREAK, 1, 2);
cancelFlight(); cancelFlight();
} }
} }
@ -430,12 +426,12 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
wallHitCooldown = 30; wallHitCooldown = 30;
if (bouncyness > 0) { 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)); ProjectileUtil.ricochet(entity, Vec3d.of(pos), 0.4F + Math.min(2, bouncyness / 18F));
velocity.fromImmutable(entity.getVelocity()); velocity.fromImmutable(entity.getVelocity());
distance /= bouncyness; distance /= bouncyness;
} else { } 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); entity.damage(DamageSource.FLY_INTO_WALL, distance);
} }