Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
check chunk==nil
Browse files Browse the repository at this point in the history
  • Loading branch information
CMA2401PT committed Aug 12, 2022
1 parent 20169f6 commit 2de44f8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mirror/io/world/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ func (w *World) SetBlockNbt(pos define.CubePos, nbt map[string]interface{}) (suc
w.lastChunk = c
w.lastPos = chunkPos
}
if c == nil {
return false
}
if nbtBlockPos, success := define.GetCubePosFromNBT(nbt); success {
if c.BlockNbts == nil {
c.BlockNbts = make(map[define.CubePos]map[string]interface{})
Expand All @@ -140,6 +143,9 @@ func (w *World) SetBlockWithNbt(pos define.CubePos, rtid uint32, nbt map[string]
w.lastChunk = c
w.lastPos = chunkPos
}
if c == nil {
return false
}
x, y, z := uint8(pos[0]), int16(pos[1]), uint8(pos[2])
c.Chunk.SetBlock(x, y, z, 0, rtid)
if nbtBlockPos, success := define.GetCubePosFromNBT(nbt); success {
Expand Down

0 comments on commit 2de44f8

Please sign in to comment.