better nbt error message & dimensioncodec decoder

This commit is contained in:
Tnze
2022-06-19 23:05:10 +08:00
parent 30479d6ea5
commit d94993f34f
6 changed files with 67 additions and 142 deletions

View File

@ -39,8 +39,8 @@ func (w *World) onPlayerSpawn(pk.Packet) error {
func (w *World) handleLevelChunkWithLightPacket(packet pk.Packet) error {
var pos level.ChunkPos
chunk := level.EmptyChunk(int(w.p.WorldInfo.Dimension.Element.Height / 16))
currentDimType := w.p.WorldInfo.DimensionCodec.DimensionType.Find(w.p.DimensionType)
chunk := level.EmptyChunk(int(currentDimType.Height) / 16)
if err := packet.Scan(&pos, chunk); err != nil {
return err
}