Skip to content

Commit

Permalink
Fix sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
PotatoPresident committed Dec 2, 2024
1 parent 43a5e58 commit ea805ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/java/us/potatoboy/skywars/game/ui/KitPreviewUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -39,7 +40,7 @@ public void onOpen() {
this.setSlot(this.size - 1, new GuiElementBuilder(Items.BARRIER)
.setName(Text.translatable("text.skywars.return_selector").setStyle(Style.EMPTY.withItalic(false)))
.setCallback((x, y, z) -> {
this.player.playSound(SoundEvents.ITEM_BOOK_PAGE_TURN, 0.5f, 1);
this.player.playSoundToPlayer(SoundEvents.ITEM_BOOK_PAGE_TURN, SoundCategory.MASTER, 0.5f, 1);
selectorUI.open();
this.close();

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/us/potatoboy/skywars/game/ui/KitSelectorUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import eu.pb4.sgui.api.gui.SimpleGui;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
Expand Down Expand Up @@ -82,11 +83,11 @@ public void onOpen() {

icon.setCallback((index, clickType, action) -> {
if (clickType.isLeft) {
this.player.playSound(SoundEvents.ITEM_BOOK_PAGE_TURN, 0.5f, 1);
this.player.playSoundToPlayer(SoundEvents.ITEM_BOOK_PAGE_TURN, SoundCategory.MASTER, 0.5f, 1);
PlayerKitStorage.get(player).selectedKit = KitRegistry.getId(kit);
changeKit(this.game, this.player, this.playerData, kit);
} else if (clickType.isRight) {
this.player.playSound(SoundEvents.ITEM_BOOK_PAGE_TURN, 0.5f, 1);
this.player.playSoundToPlayer(SoundEvents.ITEM_BOOK_PAGE_TURN, SoundCategory.MASTER, 0.5f, 1);
new KitPreviewUI(this, kit).open();
this.close();
}
Expand Down

0 comments on commit ea805ae

Please sign in to comment.