Fixed a rare audio crash with particle bunches

This commit is contained in:
LemADEC 2017-05-01 01:44:48 +02:00
parent ed2e5fd81d
commit 75a6ae8cd0

View file

@ -97,7 +97,7 @@ public class EntityParticleBunch extends Entity {
if (soundTicks < 0) {
final double factor = Commons.interpolate(PARTICLE_BUNCH_ENERGY_TO_X, PARTICLE_BUNCH_ENERGY_TO_SOUND_Y, getEnergy());
final int indexSound = (int) Math.floor(factor);
final String sound = PARTICLE_BUNCH_SOUNDS[ Commons.clamp(0, PARTICLE_BUNCH_SOUNDS.length, indexSound) ];
final String sound = PARTICLE_BUNCH_SOUNDS[ Commons.clamp(0, PARTICLE_BUNCH_SOUNDS.length - 1, indexSound) ];
final float pitch = 0.6F + 0.4F * (float) (factor - indexSound);
soundTicks = (int) Math.floor(ACCELERATION_SOUND_UPDATE_TICKS * pitch);