diff --git a/bot/world/chunks.go b/bot/world/chunks.go index 6baaab5..0bd1420 100644 --- a/bot/world/chunks.go +++ b/bot/world/chunks.go @@ -1,6 +1,8 @@ package world import ( + "errors" + "github.com/Tnze/go-mc/bot" "github.com/Tnze/go-mc/bot/basic" "github.com/Tnze/go-mc/data/packetid" @@ -40,6 +42,9 @@ func (w *World) onPlayerSpawn(pk.Packet) error { func (w *World) handleLevelChunkWithLightPacket(packet pk.Packet) error { var pos level.ChunkPos currentDimType := w.p.WorldInfo.RegistryCodec.DimensionType.Find(w.p.DimensionType) + if currentDimType == nil { + return errors.New("dimension type " + w.p.DimensionType + " not found") + } chunk := level.EmptyChunk(int(currentDimType.Height) / 16) if err := packet.Scan(&pos, chunk); err != nil { return err