Skip to content

Commit

Permalink
🐛 Fix incorrect block rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
unhappychoice committed Jun 28, 2021
1 parent 8704fb4 commit eb3fe8e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
16 changes: 11 additions & 5 deletions src/main/java/com/replaymod/recording/packet/PacketRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.PacketDirection;
import net.minecraft.network.ProtocolType;
import net.minecraft.network.login.server.SCustomPayloadLoginPacket;
import net.minecraft.network.play.server.SCustomPayloadPlayPacket;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -106,17 +107,22 @@ private PacketData getPacketData(int timestamp, IPacket packet) throws Exception
}
}

ByteBuf byteBuf = Unpooled.buffer();
ByteBuf byteBuf = Unpooled.buffer(256, 1048576);
PacketBuffer buf = new PacketBuffer(byteBuf);

try {
packet.writePacketData(new PacketBuffer(byteBuf));
if (packet instanceof SCustomPayloadLoginPacket) {
((SCustomPayloadLoginPacket) packet).getInternalData().resetReaderIndex();
}

packet.writePacketData(buf);
return new PacketData(timestamp, new com.replaymod.replaystudio.protocol.Packet(
MCVer.getPacketTypeRegistry(loginPhase),
packetId,
com.github.steveice10.netty.buffer.Unpooled.wrappedBuffer(
byteBuf.array(),
byteBuf.arrayOffset(),
byteBuf.readableBytes()
buf.array(),
buf.arrayOffset(),
buf.readableBytes()
)
));
} finally {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/replaymod/replay/ReplayHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import com.replaymod.replay.events.ReplayClosingCallback;
import com.replaymod.replay.events.ReplayOpenedCallback;
import com.replaymod.replay.gui.overlay.GuiReplayOverlay;
import com.replaymod.replay.sender.FullReplaySender;
import com.replaymod.replay.sender.QuickReplaySender;
import com.replaymod.replaystudio.data.Marker;
import com.replaymod.replaystudio.replay.ReplayFile;
import com.replaymod.replaystudio.util.Location;
Expand Down Expand Up @@ -119,7 +121,7 @@ public ReplayHandler(ReplayFile replayFile, boolean asyncMode) throws IOExceptio
fullReplaySender.setAsyncMode(asyncMode);
}

void restartedReplay() {
public void restartedReplay() {
Preconditions.checkState(mc.isOnExecutionThread(), "Must be called from Minecraft thread.");

channel.close();
Expand Down Expand Up @@ -188,7 +190,6 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable t) {
}
));


channel = new EmbeddedChannel();
channel.pipeline().addLast("ReplayModReplay_quickReplaySender", quickReplaySender);
channel.pipeline().addLast("ReplayModReplay_replaySender", fullReplaySender);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.replaymod.replay;
package com.replaymod.replay.sender;

import com.github.steveice10.packetlib.io.NetOutput;
import com.github.steveice10.packetlib.tcp.io.ByteBufNetOutput;
Expand All @@ -11,6 +11,10 @@
import com.replaymod.gui.versions.callbacks.PreTickCallback;
import com.replaymod.mixin.MinecraftAccessor;
import com.replaymod.mixin.TimerAccessor;
import com.replaymod.replay.ReplayHandler;
import com.replaymod.replay.ReplayModReplay;
import com.replaymod.replay.ReplaySender;
import com.replaymod.replay.Setting;
import com.replaymod.replay.camera.CameraEntity;
import com.replaymod.replaystudio.io.ReplayInputStream;
import com.replaymod.replaystudio.replay.ReplayFile;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.replaymod.replay;
package com.replaymod.replay.sender;

import com.github.steveice10.packetlib.io.NetInput;
import com.github.steveice10.packetlib.tcp.io.ByteBufNetInput;
Expand All @@ -11,6 +11,8 @@
import com.replaymod.gui.versions.callbacks.PreTickCallback;
import com.replaymod.mixin.MinecraftAccessor;
import com.replaymod.mixin.TimerAccessor;
import com.replaymod.replay.ReplayModReplay;
import com.replaymod.replay.ReplaySender;
import com.replaymod.replaystudio.replay.ReplayFile;
import com.replaymod.replaystudio.util.RandomAccessReplay;
import io.netty.buffer.ByteBuf;
Expand Down

0 comments on commit eb3fe8e

Please sign in to comment.