Skip to content

Commit

Permalink
Merge branch 'df-mc:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
xNatsuri authored Sep 8, 2024
2 parents 136e2e8 + 5fe94f9 commit cdd8847
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions server/session/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -851,12 +851,13 @@ func (s *Session) ViewBlockUpdate(pos cube.Pos, b world.Block, layer int) {
Layer: uint32(layer),
})
if v, ok := b.(world.NBTer); ok {
NBTData := v.EncodeNBT()
NBTData["x"], NBTData["y"], NBTData["z"] = int32(pos.X()), int32(pos.Y()), int32(pos.Z())
s.writePacket(&packet.BlockActorData{
Position: blockPos,
NBTData: NBTData,
})
if nbtData := v.EncodeNBT(); nbtData != nil {
nbtData["x"], nbtData["y"], nbtData["z"] = int32(pos.X()), int32(pos.Y()), int32(pos.Z())
s.writePacket(&packet.BlockActorData{
Position: blockPos,
NBTData: nbtData,
})
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions server/world/chunk/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (blockPaletteEncoding) decode(buf *bytes.Buffer) (uint32, error) {
version, _ := m["version"].(int32)

// Now check for a state field.
stateI, _ := m["states"]
stateI, ok := m["states"]
if version < 17694723 {
// This entry is a pre-1.13 block state, so decode the meta value instead.
meta, _ := m["val"].(int16)
Expand All @@ -83,7 +83,7 @@ func (blockPaletteEncoding) decode(buf *bytes.Buffer) (uint32, error) {
name = state.Name
stateI = state.State
version = state.Version
} else if stateI == nil {
} else if !ok {
// The state is a post-1.13 block state, but the states field is missing, likely due to a broken world
// conversion.
stateI = make(map[string]any)
Expand Down

0 comments on commit cdd8847

Please sign in to comment.