Complete tab-complete support back to Minecraft 1.8.

This commit is contained in:
Andrew Steinborn 2018-08-09 10:14:44 -04:00
parent 9a36bd6cae
commit 2e1de306fb
2 changed files with 13 additions and 3 deletions

View File

@ -33,7 +33,10 @@ public enum StateRegistry {
PLAY {
{
SERVERBOUND.register(TabCompleteRequest.class, TabCompleteRequest::new,
map(0x01, MINECRAFT_1_12_2),
map(0x14, MINECRAFT_1_8),
map(0x01, MINECRAFT_1_9),
map(0x02, MINECRAFT_1_12),
map(0x01, MINECRAFT_1_12_1),
map(0x05, MINECRAFT_1_13));
SERVERBOUND.register(Chat.class, Chat::new,
map(0x01, MINECRAFT_1_8),
@ -69,6 +72,8 @@ public enum StateRegistry {
map(0x0F, MINECRAFT_1_12),
map(0x0E, MINECRAFT_1_13));
CLIENTBOUND.register(TabCompleteResponse.class, TabCompleteResponse::new,
map(0x3A, MINECRAFT_1_8),
map(0x0E, MINECRAFT_1_9),
map(0x0E, MINECRAFT_1_12),
map(0x10, MINECRAFT_1_13));
CLIENTBOUND.register(PluginMessage.class, PluginMessage::new,

View File

@ -6,6 +6,7 @@ import com.velocitypowered.proxy.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf;
import static com.velocitypowered.proxy.protocol.ProtocolConstants.MINECRAFT_1_13;
import static com.velocitypowered.proxy.protocol.ProtocolConstants.MINECRAFT_1_9;
public class TabCompleteRequest implements MinecraftPacket {
private int transactionId;
@ -72,7 +73,9 @@ public class TabCompleteRequest implements MinecraftPacket {
this.command = ProtocolUtils.readString(buf);
} else {
this.command = ProtocolUtils.readString(buf);
if (protocolVersion >= MINECRAFT_1_9) {
this.assumeCommand = buf.readBoolean();
}
this.hasPosition = buf.readBoolean();
if (hasPosition) {
this.position = buf.readLong();
@ -87,7 +90,9 @@ public class TabCompleteRequest implements MinecraftPacket {
ProtocolUtils.writeString(buf, command);
} else {
ProtocolUtils.writeString(buf, command);
if (protocolVersion >= MINECRAFT_1_9) {
buf.writeBoolean(assumeCommand);
}
buf.writeBoolean(hasPosition);
if (hasPosition) {
buf.writeLong(position);