Play sounds during replay relative to camera

This commit is contained in:
johni0702
2015-06-01 22:58:09 +02:00
parent 479523d883
commit cc4d8f67c2
5 changed files with 103 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.network.EnumPacketDirection;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;
import java.io.File;
@@ -119,7 +120,11 @@ public class ReplayHandler {
public static void setCameraEntity(CameraEntity entity) {
if(entity == null) return;
if (cameraEntity != null) {
FMLCommonHandler.instance().bus().unregister(cameraEntity);
}
cameraEntity = entity;
FMLCommonHandler.instance().bus().register(cameraEntity);
spectateCamera();
}

View File

@@ -44,7 +44,6 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
* These packets are ignored completely during replay.
*/
private static final List<Class> BAD_PACKETS = Arrays.<Class>asList(
S28PacketEffect.class,
S2BPacketChangeGameState.class,
S06PacketUpdateHealth.class,
S2DPacketOpenWindow.class,
@@ -255,8 +254,10 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
protected Packet processPacket(Packet p) throws Exception {
if(BAD_PACKETS.contains(p.getClass())) return null;
if(p instanceof S29PacketSoundEffect && ReplayProcess.isVideoRecording()) {
return null;
if (p instanceof S29PacketSoundEffect || p instanceof S28PacketEffect) {
if (!asyncMode || isHurrying()) {
return null;
}
}
if(p instanceof S03PacketTimeUpdate) {