Fixed 1.8 -> 1.7 custom payload translation issue

This commit is contained in:
RaphiMC 2024-03-09 23:00:58 +01:00
parent 87d16d3724
commit 061e09b4d5
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
1 changed files with 2 additions and 7 deletions

View File

@ -1110,13 +1110,8 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
@Override
public void register() {
handler(wrapper -> {
final String channel = wrapper.read(Type.STRING); // channel
final int length = wrapper.read(Type.UNSIGNED_SHORT); // length
final int availableDataLength = PacketUtil.calculateLength(wrapper);
if (availableDataLength < length) {
throw new IllegalStateException("Custom payload length longer than actual data: " + length + " > " + availableDataLength);
}
wrapper.write(Type.STRING, channel);
final String channel = wrapper.passthrough(Type.STRING); // channel
wrapper.read(Type.UNSIGNED_SHORT); // length
switch (channel) {
case "MC|Brand": {