major optimizations to getting xp values for specific blocks

This commit is contained in:
nossr50
2024-11-02 18:56:11 -07:00
parent 03c9dfda02
commit ce18f3df97
28 changed files with 254 additions and 261 deletions

View File

@@ -9,14 +9,7 @@ import org.bukkit.World;
import org.bukkit.entity.Player;
public class SoundManager {
public static Sound CRIPPLE_SOUND;
static {
try {
CRIPPLE_SOUND = Sound.valueOf("ITEM_MACE_SMASH_GROUND");
} catch (IllegalArgumentException e) {
CRIPPLE_SOUND = Sound.BLOCK_ANVIL_PLACE;
}
}
private static Sound CRIPPLE_SOUND;
/**
* Sends a sound to the player
@@ -107,10 +100,24 @@ public class SoundManager {
case DEFLECT_ARROWS, BLEED -> Sound.ENTITY_ENDER_EYE_DEATH;
case GLASS -> Sound.BLOCK_GLASS_BREAK;
case ITEM_CONSUMED -> Sound.ITEM_BOTTLE_EMPTY;
case CRIPPLE -> CRIPPLE_SOUND;
case CRIPPLE -> getCrippleSound();
};
}
private static Sound getCrippleSound() {
if (CRIPPLE_SOUND != null) {
return CRIPPLE_SOUND;
}
try {
CRIPPLE_SOUND = Sound.valueOf("ITEM_MACE_SMASH_GROUND");
return CRIPPLE_SOUND;
} catch (IllegalArgumentException e) {
CRIPPLE_SOUND = Sound.BLOCK_ANVIL_PLACE;
return CRIPPLE_SOUND;
}
}
public static float getFizzPitch() {
return 2.6F + (Misc.getRandom().nextFloat() - Misc.getRandom().nextFloat()) * 0.8F;
}