Pause MCMusic when "Ping" packet is received
This prevents Minecraft's music from playing at the same time as user-provided battle/silly music.
This commit is contained in:
parent
2b4909e1f4
commit
14581183e7
4 changed files with 19 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1483,4 +1483,14 @@ public class ClientProxy extends CommonProxy {
|
|||
public void showClientConfigGui() {
|
||||
Minecraft.getInstance().setScreen(new ClientConfigGui());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pauseMCMusic() {
|
||||
Minecraft.getInstance().getSoundManager().pause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeMCMusic() {
|
||||
Minecraft.getInstance().getSoundManager().resume();
|
||||
}
|
||||
}
|
|
@ -175,4 +175,7 @@ public class CommonProxy
|
|||
public <MSG> void handlePacket(MSG msg,CustomPayloadEvent.Context ctx) {}
|
||||
|
||||
public void showClientConfigGui() {}
|
||||
|
||||
public void pauseMCMusic() {}
|
||||
public void resumeMCMusic() {}
|
||||
}
|
|
@ -52,6 +52,7 @@ public class PacketBattlePing {
|
|||
TurnBasedMinecraftMod.proxy.setBattleGuiAsGui();
|
||||
TurnBasedMinecraftMod.proxy.setBattleGuiBattleChanged();
|
||||
TurnBasedMinecraftMod.proxy.setBattleGuiTime(pkt.decisionSeconds);
|
||||
TurnBasedMinecraftMod.proxy.pauseMCMusic();
|
||||
});
|
||||
ctx.setPacketHandled(true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue