Refactor: Remove VarInt type, replace with int32, and consolidate encoding/decoding logic

This commit is contained in:
adman
2025-12-24 00:29:43 +01:00
parent 2f81976fe8
commit dd41115ca2
10 changed files with 41 additions and 32 deletions
+2 -2
View File
@@ -36,7 +36,7 @@ type LoginServer struct {
func (l *LoginServer) OnHandshake(packet v1_21_8.HandshakingToServerPacketSetProtocol) (err error) {
l.State = proto_base.State(packet.NextState)
if packet.NextState != proto_base.VarInt(proto_base.Login) {
if packet.NextState != int32(proto_base.Login) {
err = UnexpectedNextStateError{proto_base.State(packet.NextState)}
return
}
@@ -44,7 +44,7 @@ func (l *LoginServer) OnHandshake(packet v1_21_8.HandshakingToServerPacketSetPro
}
func (l *LoginServer) SetCompressionThreshold(threshold int32) (err error) {
err = l.Send(v1_21_8.LoginToClientPacketCompress{Threshold: proto_base.VarInt(threshold)})
err = l.Send(v1_21_8.LoginToClientPacketCompress{Threshold: threshold})
if err != nil {
return
}