forked from henkelmax/replay-voice-chat
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use FullReplaySender to drop packets when skipping
not sure why, but packets received from ClientPlayNetworking#registerGlobalReceiver are delayed, so skipping was broken
- Loading branch information
Showing
6 changed files
with
50 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
- Voice audio render to AAC format using OpenAL loopback device. | ||
Rendered audio is saved in the same location and the same name (but with .aac extension) as the video. | ||
- Fixed audio playback issues when skipping on the timeline. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version=2.1.1 | ||
version=2.1.2 | ||
|
||
org.gradle.jvmargs=-Xmx4G | ||
kotlin.stdlib.default.dependency=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
versions/src/main/java/su/plo/replayvoice/mixin/MixinFullReplaySender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package su.plo.replayvoice.mixin; | ||
|
||
import com.replaymod.replay.FullReplaySender; | ||
import com.replaymod.replay.ReplaySender; | ||
import net.minecraft.network.protocol.Packet; | ||
import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket; | ||
import net.minecraft.resources.ResourceLocation; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import su.plo.replayvoice.ReplayVoiceAddon; | ||
import xyz.breadloaf.replaymodinterface.ReplayInterface; | ||
|
||
@Mixin(value = FullReplaySender.class, remap = false) | ||
public class MixinFullReplaySender { | ||
|
||
@Inject(method = "processPacket", at = @At("HEAD"), cancellable = true) | ||
public void processPacket(Packet p, CallbackInfoReturnable<Packet> cir) { | ||
if (!(p instanceof ClientboundCustomPayloadPacket)) return; | ||
|
||
ClientboundCustomPayloadPacket packet = (ClientboundCustomPayloadPacket) p; | ||
//#if MC>=12100 | ||
//$$ ResourceLocation packetId = packet.payload().type().id(); | ||
//#else | ||
ResourceLocation packetId = packet.getIdentifier(); | ||
//#endif | ||
|
||
if (!packetId.equals(ReplayVoiceAddon.SELF_AUDIO_PACKET) && | ||
!packetId.equals(ReplayVoiceAddon.SELF_AUDIO_INFO_PACKET) && | ||
!packetId.equals(ReplayVoiceAddon.SOURCE_AUDIO_PACKET) | ||
) return; | ||
|
||
boolean hurrying = false; | ||
ReplaySender replaySender = ReplayInterface.INSTANCE.replayHandler.getReplaySender(); | ||
if (replaySender instanceof FullReplaySender) { | ||
FullReplaySender fullReplaySender = (FullReplaySender) replaySender; | ||
hurrying = fullReplaySender.isHurrying(); | ||
} | ||
|
||
if (!ReplayInterface.INSTANCE.skipping && !hurrying) return; | ||
|
||
cir.setReturnValue(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters