update to 1.18.2 & fix bug in snbt encoding

This commit is contained in:
Tnze
2022-03-10 12:29:03 +08:00
parent 0bbd279dd1
commit 46b021e1ef
18 changed files with 70 additions and 2147 deletions

View File

@ -10,11 +10,8 @@ import (
// WorldInfo content player info in server.
type WorldInfo struct {
DimensionCodec struct {
DimensionType interface{} `nbt:"minecraft:dimension_type"`
WorldgenBiome interface{} `nbt:"minecraft:worldgen/biome"`
}
Dimension interface{}
DimensionCodec nbt.StringifiedMessage
Dimension nbt.StringifiedMessage
WorldNames []string // Identifiers for all worlds on the server.
WorldName string // Name of the world being spawned into.
HashedSeed int64 // First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise
@ -49,8 +46,8 @@ func (p *Player) handleLoginPacket(packet pk.Packet) error {
(*pk.Byte)(&p.PrevGamemode),
&WorldCount,
pk.Ary{Len: &WorldCount, Ary: &WorldNames},
pk.NBT(new(nbt.RawMessage)),
pk.NBT(new(nbt.RawMessage)),
pk.NBT(&p.WorldInfo.DimensionCodec),
pk.NBT(&p.WorldInfo.Dimension),
(*pk.Identifier)(&p.WorldName),
(*pk.Long)(&p.HashedSeed),
(*pk.VarInt)(&p.MaxPlayers),