Skip to content

Commit

Permalink
session/world: Add nil check for NBTer encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
TwistedAsylumMC committed Sep 8, 2024
1 parent 695963b commit 5fe94f9
Showing 1 changed file with 7 additions and 6 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

0 comments on commit 5fe94f9

Please sign in to comment.