diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleMusic.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleMusic.java index 601f839..6868f2f 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleMusic.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleMusic.java @@ -180,7 +180,7 @@ public class BattleMusic if(initialized && next != null) { logger.debug("play called with file " + next.getName() + " and vol " + volume); - Minecraft.getInstance().getSoundManager().pause(); + TurnBasedMinecraftMod.proxy.pauseMCMusic(); String suffix = next.getName().substring(next.getName().length() - 3).toLowerCase(); if(suffix.equals("mid") && sequencer != null) { @@ -362,7 +362,7 @@ public class BattleMusic } if(resumeMCSounds) { - Minecraft.getInstance().getSoundManager().resume(); + TurnBasedMinecraftMod.proxy.resumeMCMusic(); } isPlaying = false; } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java index bfe4846..2023666 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java @@ -1482,4 +1482,14 @@ public class ClientProxy extends CommonProxy { public void showClientConfigGui() { Minecraft.getInstance().setScreen(new ClientConfigGui(null, null)); } + + @Override + public void pauseMCMusic() { + Minecraft.getInstance().getSoundManager().pause(); + } + + @Override + public void resumeMCMusic() { + Minecraft.getInstance().getSoundManager().resume(); + } } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/CommonProxy.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/CommonProxy.java index 0d0a747..172eb73 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/CommonProxy.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/CommonProxy.java @@ -177,4 +177,7 @@ public class CommonProxy public static final StreamCodec> COLLECTION_INT_CODEC = ByteBufCodecs.INT.apply(ByteBufCodecs.collection(ArrayList::new)); public void showClientConfigGui() {} + + public void pauseMCMusic() {} + public void resumeMCMusic() {} } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattlePing.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattlePing.java index 3463939..1901bd0 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattlePing.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/networking/PacketBattlePing.java @@ -37,6 +37,7 @@ public record PacketBattlePing(int battleID, int remainingSeconds) implements Cu TurnBasedMinecraftMod.proxy.setBattleGuiAsGui(); TurnBasedMinecraftMod.proxy.setBattleGuiBattleChanged(); TurnBasedMinecraftMod.proxy.setBattleGuiTime(pkt.remainingSeconds); + TurnBasedMinecraftMod.proxy.pauseMCMusic(); }).exceptionally(e -> { ctx.disconnect(Component.literal("Exception handling PacketBattlePing! " + e.getMessage())); return null;