From fd02dd5d1603eab3cd7b5074f14c9663b8066060 Mon Sep 17 00:00:00 2001 From: olebeck <31539311+olebeck@users.noreply.github.com> Date: Fri, 26 May 2023 17:23:12 +0200 Subject: [PATCH] update to fix accidentally pushed broken code --- go.mod | 2 +- handlers/second-user/chunks.go | 2 +- handlers/worlds/chunk.go | 2 +- handlers/worlds/entity.go | 21 +++++++++++++++------ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 1f154c3..631b35e 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ go 1.20 replace github.com/sandertv/gophertunnel => github.com/olebeck/gophertunnel v1.29.0-1 //replace github.com/df-mc/dragonfly => ./dragonfly -replace github.com/df-mc/dragonfly => github.com/olebeck/dragonfly v0.9.4-13 +replace github.com/df-mc/dragonfly => github.com/olebeck/dragonfly v0.9.4-14 //replace gioui.org => ./gio replace gioui.org => github.com/olebeck/gio v0.0.0-20230427194143-c9c9d8bc704d diff --git a/handlers/second-user/chunks.go b/handlers/second-user/chunks.go index cb6f2ef..e79464d 100644 --- a/handlers/second-user/chunks.go +++ b/handlers/second-user/chunks.go @@ -39,7 +39,7 @@ func (s *secondaryUser) processLevelChunk(pk *packet.LevelChunk) { subChunkCount = int(pk.SubChunkCount) } - ch, blockNBTs, err := chunk.NetworkDecode(world.AirRID(), pk.RawPayload, subChunkCount, s.dimension.Range(), s.ispre118, s.hasCustomBlocks) + ch, blockNBTs, err := chunk.NetworkDecode(world.AirRID(), pk.RawPayload, subChunkCount, s.ispre118, s.dimension.Range()) if err != nil { logrus.Error(err) return diff --git a/handlers/worlds/chunk.go b/handlers/worlds/chunk.go index 69d2046..9bb2586 100644 --- a/handlers/worlds/chunk.go +++ b/handlers/worlds/chunk.go @@ -37,7 +37,7 @@ func (w *worldsHandler) processLevelChunk(pk *packet.LevelChunk) { subChunkCount = int(pk.SubChunkCount) } - ch, blockNBTs, err := chunk.NetworkDecode(world.AirRID(), pk.RawPayload, subChunkCount, w.worldState.dimension.Range(), w.serverState.ispre118, w.bp.HasBlocks()) + ch, blockNBTs, err := chunk.NetworkDecode(world.AirRID(), pk.RawPayload, subChunkCount, w.serverState.ispre118, w.worldState.dimension.Range()) if err != nil { logrus.Error(err) return diff --git a/handlers/worlds/entity.go b/handlers/worlds/entity.go index c81b036..09da5d8 100644 --- a/handlers/worlds/entity.go +++ b/handlers/worlds/entity.go @@ -205,14 +205,23 @@ func (s *entityState) ToServerEntity() serverEntity { } entityMetadataToNBT(s.Metadata, e.EntityType.NBT) - if s.Helmet != nil || s.Chestplate != nil || s.Leggings != nil || s.Boots != nil { - e.EntityType.NBT["Armor"] = []map[string]any{ - nbtconv.WriteItem(stackToItem(s.Helmet.Stack), true), - nbtconv.WriteItem(stackToItem(s.Chestplate.Stack), true), - nbtconv.WriteItem(stackToItem(s.Leggings.Stack), true), - nbtconv.WriteItem(stackToItem(s.Boots.Stack), true), + if false { + armor := make([]map[string]any, 4) + if s.Helmet != nil { + armor[0] = nbtconv.WriteItem(stackToItem(s.Helmet.Stack), true) } + if s.Chestplate != nil { + armor[1] = nbtconv.WriteItem(stackToItem(s.Chestplate.Stack), true) + } + if s.Leggings != nil { + armor[2] = nbtconv.WriteItem(stackToItem(s.Leggings.Stack), true) + } + if s.Boots != nil { + armor[3] = nbtconv.WriteItem(stackToItem(s.Boots.Stack), true) + } + e.EntityType.NBT["Armor"] = armor } + return e }