mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 11:29:15 +00:00
Fix OpenContainer message not resetting reader index of additional data.
This commit is contained in:
1 parent
47dfa83cff
commit
18886e5128
2 files changed
+4
-2
No files matched your search
@@ -58,7 +58,7 @@ public abstract class Channel<MSG> {
|
||||
return NetworkDirection.LOGIN_TO_CLIENT.buildPacket(data, getName()).getThis();
|
||||
} else if (protocol == ConnectionProtocol.PLAY || protocol == ConnectionProtocol.CONFIGURATION) {
|
||||
var dir = serverbound ? NetworkDirection.PLAY_TO_SERVER : NetworkDirection.PLAY_TO_CLIENT;
|
||||
return dir.buildPacket(toBuffer(message), getName()).getThis();
|
||||
return dir.buildPacket(data, getName()).getThis();
|
||||
} else
|
||||
throw new IllegalStateException("Unsupported protocol " + protocol.name() + " in Forge Networking Channel");
|
||||
}
|
||||
|
||||
@@ -44,7 +44,9 @@ public class OpenContainer {
|
||||
buf.writeVarInt(msg.id);
|
||||
buf.writeVarInt(msg.windowId);
|
||||
buf.writeComponent(msg.name);
|
||||
msg.additionalData.markReaderIndex();
|
||||
buf.writeByteArray(msg.additionalData.readByteArray());
|
||||
msg.additionalData.resetReaderIndex();
|
||||
}
|
||||
|
||||
public static OpenContainer decode(FriendlyByteBuf buf) {
|
||||
@@ -88,4 +90,4 @@ public class OpenContainer {
|
||||
public FriendlyByteBuf getAdditionalData() {
|
||||
return additionalData;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user