Don't copy (and allocate) ByteBuf when reading Carpet packets
Should fix #1589
This commit is contained in:
1 parent
1466006638
commit
48c804fcaa
1 file changed
+1
-3
@@ -2,7 +2,6 @@ package carpet.mixins;
|
||||
|
||||
import carpet.network.CarpetClient;
|
||||
import carpet.network.ServerNetworkHandler;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.PacketUtils;
|
||||
import net.minecraft.network.protocol.game.ServerGamePacketListener;
|
||||
import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket;
|
||||
@@ -29,9 +28,8 @@ public class ServerGamePacketListenerImplMixin
|
||||
// We should force onto the main thread here
|
||||
// ServerNetworkHandler.handleData can possibly mutate data that isn't
|
||||
// thread safe, and also allows for client commands to be executed
|
||||
// [TODO] need to investigate if that is actually an issue since carpet doesn't fiddle with its packets.
|
||||
PacketUtils.ensureRunningOnSameThread(packet, (ServerGamePacketListener) this, player.getLevel());
|
||||
ServerNetworkHandler.handleData(new FriendlyByteBuf(packet.getData().copy()), player);
|
||||
ServerNetworkHandler.handleData(packet.getData(), player);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user