better error in level packet decoder
This commit is contained in:
+5
-1
@@ -2,6 +2,7 @@ package level
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
@@ -91,10 +92,13 @@ func UnpackBlockData(r io.Reader) (blocks [BlocksPerChunkSection]int32, err erro
|
|||||||
case 1, 2, 3, 4:
|
case 1, 2, 3, 4:
|
||||||
blocksSlice, err = UnpackArrayPalette(r, bitsPerEntry, BlocksPerChunkSection)
|
blocksSlice, err = UnpackArrayPalette(r, bitsPerEntry, BlocksPerChunkSection)
|
||||||
case 5, 6, 7, 8:
|
case 5, 6, 7, 8:
|
||||||
panic("unimplemented")
|
err = errors.New("unimplemented")
|
||||||
default:
|
default:
|
||||||
blocksSlice, err = UnpackLongData(r, bitsPerEntry, BlocksPerChunkSection)
|
blocksSlice, err = UnpackLongData(r, bitsPerEntry, BlocksPerChunkSection)
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
blocks = [BlocksPerChunkSection]int32(blocksSlice)
|
blocks = [BlocksPerChunkSection]int32(blocksSlice)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user