Skip to content

Commit 3e66148

Browse files
committed
Fix sounds
1 parent f1e3f34 commit 3e66148

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/java/fr/hugman/build_rush/game/state/BRActive.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public void tick() {
271271
if (otherData != data && otherData.plot != null && otherData.plot.safeZone().contains(player.getBlockPos())) {
272272
resetPlayer(player, true);
273273
player.sendMessage(TextUtil.translatable(TextUtil.WARNING, TextUtil.DANGER, "text.build_rush.do_not_disturb"));
274-
player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_DIDGERIDOO.value(), 1, 1);
274+
player.playSoundToPlayer(SoundEvents.BLOCK_NOTE_BLOCK_DIDGERIDOO.value(), SoundCategory.PLAYERS, 1, 1);
275275
break;
276276
}
277277
}
@@ -303,18 +303,18 @@ public void tick() {
303303
}
304304
if (stateSeconds == 30 || stateSeconds == 15 || stateSeconds == 10) {
305305
TextUtil.sendSubtitle(player, Text.literal(String.valueOf(stateSeconds)).setStyle(Style.EMPTY.withColor(Formatting.YELLOW)), 0, 30, 10);
306-
player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), 1, 1.3f);
306+
player.playSoundToPlayer(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), SoundCategory.PLAYERS, 1, 1.3f);
307307
}
308308
if (stateSeconds <= 5) {
309309
TextUtil.sendSubtitle(player, Text.literal(String.valueOf(stateSeconds)).setStyle(Style.EMPTY.withColor(Formatting.RED)), 0, 20, 0);
310-
player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), 1, 1.6f);
310+
player.playSoundToPlayer(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), SoundCategory.PLAYERS, 1, 1.6f);
311311
}
312312
} else {
313313
data.bar.setColor(BossBar.Color.GREEN);
314314
}
315315
if (stateSeconds == 0 && (stateMinutes == 1 || stateMinutes == 2)) {
316316
TextUtil.sendSubtitle(player, Text.literal(String.valueOf(60)).setStyle(Style.EMPTY.withColor(Formatting.GREEN)), 0, 40, 20);
317-
player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), 1, 1);
317+
player.playSoundToPlayer(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), SoundCategory.PLAYERS, 1, 1);
318318
}
319319
}
320320
data.bar.setPercent(statePercent);
@@ -394,7 +394,7 @@ public void eliminate(PlayerData data) {
394394
player.sendMessage(TextUtil.translatable(TextUtil.SKULL, TextUtil.DANGER, "text.build_rush.eliminated.self", player.getName().getString()));
395395
TextUtil.clearSubtitle(player);
396396
TextUtil.sendTitle(player, TextUtil.translatable(TextUtil.DANGER, "title.build_rush.eliminated"), 0, 5 * 20, 20);
397-
player.playSound(SoundEvents.ENTITY_BLAZE_DEATH, 1, 2f);
397+
player.playSoundToPlayer(SoundEvents.ENTITY_BLAZE_DEATH, SoundCategory.PLAYERS, 1, 2f);
398398
}
399399
this.refreshSidebar();
400400

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

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

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

0 commit comments

Comments
 (0)