@@ -0,0 +1,2206 @@
+/**%0A * Aeronica's mxTune MOD%0A * Copyright %7B2016%7D Paul Boese a.k.a. Aeronica%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage net.aeronica.mods.mxtune.network.client;%0A%0Aimport java.io.IOException;%0A%0Aimport net.aeronica.mods.mxtune.groups.PlayManager;%0Aimport net.aeronica.mods.mxtune.network.AbstractMessage.AbstractClientMessage;%0Aimport net.aeronica.mods.mxtune.sound.ClientAudio;%0Aimport net.minecraft.entity.player.EntityPlayer;%0Aimport net.minecraft.network.PacketBuffer;%0Aimport net.minecraftforge.fml.common.network.ByteBufUtils;%0Aimport net.minecraftforge.fml.relauncher.Side;%0Aimport net.minecraftforge.fml.relauncher.SideOnly;%0A%0Apublic class StopPlayMessage extends AbstractClientMessage%3CStopPlayMessage%3E%0A%7B%0A%0A    private Integer playID;%0A%0A    public StopPlayMessage() %7B%7D%0A%0A    public StopPlayMessage(Integer playID) %7Bthis.playID = playID;%7D%0A%0A    @Override%0A    protected void read(PacketBuffer buffer) throws IOException%0A    %7B%0A        playID = ByteBufUtils.readVarInt(buffer, 5);%0A    %7D%0A%0A    @Override%0A    protected void write(PacketBuffer buffer) throws IOException%0A    %7B%0A        ByteBufUtils.writeVarInt(buffer, playID, 5);%0A    %7D%0A%0A    @Override%0A    public void process(EntityPlayer player, Side side)%0A    %7B%0A        if (side.isClient())%0A        %7B%0A            handleClientSide(player);%0A        %7D else%0A        %7B%0A            handleServerSide(player);%0A        %7D%0A    %7D%0A%0A    @SideOnly(Side.CLIENT)%0A    public void handleClientSide(EntityPlayer playerSP)%0A    %7B%0A        // TODO: More Cleanup for playing - resetting all the players PlayStatuses%0A        ClientAudio.stop(playID);%0A    %7D%0A%0A    public void handleServerSide(EntityPlayer playerMP)%0A    %7B%0A        //PlayManager.stopPlayID(playID);%0A    %7D%0A%0A%7D%0A

Rework Play Music chain to improve reliability, eliminate clicks and pops on abrupt cutoff. Part 1