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("stdlib-jdk8"))
implementation(kotlin("reflect")) implementation(kotlin("reflect"))
val vvVer = "4.3.2-1.19.1-rc1-SNAPSHOT" val vvVer = "4.4.0-1.19.1-pre2-SNAPSHOT"
val vbVer = "4.3.1-1.19.1-pre1-SNAPSHOT" val vbVer = "4.4.0-1.19.1-pre2-SNAPSHOT"
val vrVer = "d189537" val vrVer = "d189537"
implementation("com.viaversion:viaversion:$vvVer") { isTransitive = false } implementation("com.viaversion:viaversion:$vvVer") { isTransitive = false }
implementation("com.viaversion:viabackwards:$vbVer") { isTransitive = false } implementation("com.viaversion:viabackwards:$vbVer") { isTransitive = false }

View File

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

View File

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