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
252b3a5272
commit
b676a00c1c
4 changed files with 19 additions and 5 deletions
|
@ -180,7 +180,7 @@ public class BattleMusic
|
||||||
if(initialized && next != null)
|
if(initialized && next != null)
|
||||||
{
|
{
|
||||||
logger.debug("play called with file " + next.getName() + " and vol " + volume);
|
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();
|
String suffix = next.getName().substring(next.getName().length() - 3).toLowerCase();
|
||||||
if(suffix.equals("mid") && sequencer != null)
|
if(suffix.equals("mid") && sequencer != null)
|
||||||
{
|
{
|
||||||
|
@ -362,7 +362,7 @@ public class BattleMusic
|
||||||
}
|
}
|
||||||
if(resumeMCSounds)
|
if(resumeMCSounds)
|
||||||
{
|
{
|
||||||
Minecraft.getInstance().getSoundManager().resume();
|
TurnBasedMinecraftMod.proxy.resumeMCMusic();
|
||||||
}
|
}
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1483,4 +1483,14 @@ public class ClientProxy extends CommonProxy {
|
||||||
public void showClientConfigGui() {
|
public void showClientConfigGui() {
|
||||||
Minecraft.getInstance().setScreen(new ClientConfigGui());
|
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 <MSG> void handlePacket(MSG msg,CustomPayloadEvent.Context ctx) {}
|
||||||
|
|
||||||
public void showClientConfigGui() {}
|
public void showClientConfigGui() {}
|
||||||
|
|
||||||
|
public void pauseMCMusic() {}
|
||||||
|
public void resumeMCMusic() {}
|
||||||
}
|
}
|
|
@ -52,6 +52,7 @@ public class PacketBattlePing {
|
||||||
TurnBasedMinecraftMod.proxy.setBattleGuiAsGui();
|
TurnBasedMinecraftMod.proxy.setBattleGuiAsGui();
|
||||||
TurnBasedMinecraftMod.proxy.setBattleGuiBattleChanged();
|
TurnBasedMinecraftMod.proxy.setBattleGuiBattleChanged();
|
||||||
TurnBasedMinecraftMod.proxy.setBattleGuiTime(pkt.decisionSeconds);
|
TurnBasedMinecraftMod.proxy.setBattleGuiTime(pkt.decisionSeconds);
|
||||||
|
TurnBasedMinecraftMod.proxy.pauseMCMusic();
|
||||||
});
|
});
|
||||||
ctx.setPacketHandled(true);
|
ctx.setPacketHandled(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue