mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
Fix SplitPacketTransformer not saving enough space for packet id (#273)
[norelease] to avoid an unnecessary release before merging the biome context PR
(cherry picked from commit 796ee4fc14)
This commit is contained in:
@@ -35,6 +35,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
@ApiStatus.Experimental
|
||||
@@ -179,7 +180,7 @@ public class SplitPacketTransformer implements PacketTransformer {
|
||||
|
||||
@Override
|
||||
public void outbound(NetworkManager.Side side, ResourceLocation id, FriendlyByteBuf buf, TransformationSink sink) {
|
||||
int maxSize = (side == NetworkManager.Side.C2S ? 32767 : 1048576) - 1 - 20;
|
||||
int maxSize = (side == NetworkManager.Side.C2S ? 32767 : 1048576) - 1 - 20 - id.toString().getBytes(StandardCharsets.UTF_8).length;
|
||||
if (buf.readableBytes() <= maxSize) {
|
||||
ByteBuf stateBuf = Unpooled.buffer(1);
|
||||
stateBuf.writeByte(ONLY);
|
||||
|
||||
Reference in New Issue
Block a user