pk.Ary and pk.Array using generic now

This commit is contained in:
Tnze
2022-03-20 01:17:25 +08:00
parent 7997a5faea
commit 4c2510565d
15 changed files with 95 additions and 155 deletions

View File

@ -56,15 +56,13 @@ type ServInfo struct {
}
func (p *Player) handleLoginPacket(packet pk.Packet) error {
var WorldCount pk.VarInt
var WorldNames = make([]pk.Identifier, 0)
err := packet.Scan(
(*pk.Int)(&p.EID),
(*pk.Boolean)(&p.Hardcore),
(*pk.UnsignedByte)(&p.Gamemode),
(*pk.Byte)(&p.PrevGamemode),
&WorldCount,
pk.Ary{Len: &WorldCount, Ary: &WorldNames},
pk.Ary[pk.VarInt, *pk.VarInt]{Ary: &WorldNames},
pk.NBT(&p.WorldInfo.DimensionCodec),
pk.NBT(&p.WorldInfo.Dimension),
(*pk.Identifier)(&p.WorldName),