Skip to content

Commit

Permalink
Fix sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugman76 committed Dec 20, 2024
1 parent f1e3f34 commit 3e66148
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/java/fr/hugman/build_rush/game/state/BRActive.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public void tick() {
if (otherData != data && otherData.plot != null && otherData.plot.safeZone().contains(player.getBlockPos())) {
resetPlayer(player, true);
player.sendMessage(TextUtil.translatable(TextUtil.WARNING, TextUtil.DANGER, "text.build_rush.do_not_disturb"));
player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_DIDGERIDOO.value(), 1, 1);
player.playSoundToPlayer(SoundEvents.BLOCK_NOTE_BLOCK_DIDGERIDOO.value(), SoundCategory.PLAYERS, 1, 1);
break;
}
}
Expand Down Expand Up @@ -303,18 +303,18 @@ public void tick() {
}
if (stateSeconds == 30 || stateSeconds == 15 || stateSeconds == 10) {
TextUtil.sendSubtitle(player, Text.literal(String.valueOf(stateSeconds)).setStyle(Style.EMPTY.withColor(Formatting.YELLOW)), 0, 30, 10);
player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), 1, 1.3f);
player.playSoundToPlayer(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), SoundCategory.PLAYERS, 1, 1.3f);
}
if (stateSeconds <= 5) {
TextUtil.sendSubtitle(player, Text.literal(String.valueOf(stateSeconds)).setStyle(Style.EMPTY.withColor(Formatting.RED)), 0, 20, 0);
player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), 1, 1.6f);
player.playSoundToPlayer(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), SoundCategory.PLAYERS, 1, 1.6f);
}
} else {
data.bar.setColor(BossBar.Color.GREEN);
}
if (stateSeconds == 0 && (stateMinutes == 1 || stateMinutes == 2)) {
TextUtil.sendSubtitle(player, Text.literal(String.valueOf(60)).setStyle(Style.EMPTY.withColor(Formatting.GREEN)), 0, 40, 20);
player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), 1, 1);
player.playSoundToPlayer(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), SoundCategory.PLAYERS, 1, 1);
}
}
data.bar.setPercent(statePercent);
Expand Down Expand Up @@ -394,7 +394,7 @@ public void eliminate(PlayerData data) {
player.sendMessage(TextUtil.translatable(TextUtil.SKULL, TextUtil.DANGER, "text.build_rush.eliminated.self", player.getName().getString()));
TextUtil.clearSubtitle(player);
TextUtil.sendTitle(player, TextUtil.translatable(TextUtil.DANGER, "title.build_rush.eliminated"), 0, 5 * 20, 20);
player.playSound(SoundEvents.ENTITY_BLAZE_DEATH, 1, 2f);
player.playSoundToPlayer(SoundEvents.ENTITY_BLAZE_DEATH, SoundCategory.PLAYERS, 1, 2f);
}
this.refreshSidebar();

Expand Down Expand Up @@ -691,7 +691,7 @@ public void onBlockPlaced(ServerPlayerEntity player) {
data.score = this.maxScore;
//TODO: store and send time
player.sendMessage(TextUtil.translatable(TextUtil.CHECKMARK, TextUtil.SUCCESS, "text.build_rush.finished"), false);
player.playSound(SoundEvents.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f);
player.playSoundToPlayer(SoundEvents.ENTITY_PLAYER_LEVELUP, SoundCategory.PLAYERS, 1.0f, 1.0f);
resetPlayer(player, false);
TextUtil.clearTitle(player);
}
Expand Down Expand Up @@ -926,7 +926,7 @@ public void startElimination() {

if (data.score == this.maxScore) {
TextUtil.sendSubtitle(player, Text.translatable("title.build_rush.perfect").setStyle(Style.EMPTY.withColor(TextUtil.LEGENDARY).withBold(true)), 0, 3 * 20, 10);
player.playSound(SoundEvents.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f);
player.playSoundToPlayer(SoundEvents.ENTITY_PLAYER_LEVELUP, SoundCategory.PLAYERS, 1.0f, 1.0f);
} else {
float scorePercentage = data.score / (float) this.maxScore;
String scoreAsPercent = String.format("%.2f", scorePercentage * 100).replaceAll("0*$", "").replaceAll("[,.]$", "");
Expand All @@ -935,7 +935,7 @@ public void startElimination() {

player.sendMessage(TextUtil.translatable(TextUtil.DASH, TextUtil.NEUTRAL, "text.build_rush.score", scoreText), false);
TextUtil.sendSubtitle(player, scoreText, 0, 2 * 20, 5);
player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 1.0f);
player.playSoundToPlayer(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 1.0f, 1.0f);
}
}

Expand Down

0 comments on commit 3e66148

Please sign in to comment.