1.19.1-pre2

This commit is contained in:
creeper123123321 2022-07-01 09:46:18 -03:00
parent 1c9405199c
commit fe95bd2090
3 changed files with 35 additions and 18 deletions

View File

@ -57,8 +57,8 @@ dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
val vvVer = "4.3.2-1.19.1-rc1-SNAPSHOT"
val vbVer = "4.3.1-1.19.1-pre1-SNAPSHOT"
val vvVer = "4.4.0-1.19.1-pre2-SNAPSHOT"
val vbVer = "4.4.0-1.19.1-pre2-SNAPSHOT"
val vrVer = "d189537"
implementation("com.viaversion:viaversion:$vvVer") { isTransitive = false }
implementation("com.viaversion:viabackwards:$vbVer") { isTransitive = false }

View File

@ -1,17 +1,35 @@
package com.viaversion.aas.codec.packet.login;
import com.viaversion.aas.codec.packet.Packet;
import com.viaversion.viaversion.api.minecraft.ProfileKey;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.StringType;
import io.netty.buffer.ByteBuf;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
public class LoginStart implements Packet {
private String username;
private long timestamp;
private byte[] key;
private byte[] signature;
private ProfileKey profileKey;
private UUID profileId;
public ProfileKey getProfileKey() {
return profileKey;
}
public void setProfileKey(ProfileKey profileKey) {
this.profileKey = profileKey;
}
public UUID getProfileId() {
return profileId;
}
public void setProfileId(UUID profileId) {
this.profileId = profileId;
}
public String getUsername() {
return username;
@ -25,11 +43,11 @@ public class LoginStart implements Packet {
public void decode(@NotNull ByteBuf byteBuf, int protocolVersion) throws Exception {
username = new StringType(16).read(byteBuf);
if (protocolVersion >= ProtocolVersion.v1_19.getVersion()) {
if (byteBuf.readBoolean()) {
timestamp = byteBuf.readLong();
key = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf);
signature = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf);
}
profileKey = Type.OPTIONAL_PROFILE_KEY.read(byteBuf);
}
if (protocolVersion >= ProtocolVersion.v1_19_1.getVersion()) {
profileId = Type.OPTIONAL_UUID.read(byteBuf);
}
}
@ -37,14 +55,10 @@ public class LoginStart implements Packet {
public void encode(@NotNull ByteBuf byteBuf, int protocolVersion) throws Exception {
Type.STRING.write(byteBuf, username);
if (protocolVersion >= ProtocolVersion.v1_19.getVersion()) {
if (key == null) {
byteBuf.writeBoolean(false);
} else {
byteBuf.writeBoolean(true);
byteBuf.writeLong(timestamp);
Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, key);
Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, signature);
}
Type.OPTIONAL_PROFILE_KEY.write(byteBuf, profileKey);
}
if (protocolVersion >= ProtocolVersion.v1_19_1.getVersion()) {
Type.OPTIONAL_UUID.write(byteBuf, profileId);
}
}
}

View File

@ -269,6 +269,9 @@ class LoginState : ConnectionState {
extraData
)
loginStart.username = backName!!
// todo implement profile public key?
loginStart.profileKey = null
loginStart.profileId = null
send(handler.data.backChannel!!, loginStart, true)
} catch (e: Exception) {
handler.data.frontChannel.fireExceptionCaughtIfOpen(e)