add import storage and test

This commit is contained in:
adman
2026-04-23 22:36:34 +02:00
parent 841d91b91d
commit bd3139754d
5 changed files with 116 additions and 2 deletions
+3 -2
View File
@@ -13,6 +13,7 @@ import (
const (
ChunkWidth = 16
ChunkColumns = ChunkWidth * ChunkWidth
BlocksPerChunkSection = ChunkWidth * ChunkWidth * ChunkWidth
BiomesPerChunkSection = 4 * 4 * 4
)
@@ -182,10 +183,10 @@ func UnpackBlockData(r io.Reader) (blocks []int32, err error) {
func PackBlockData(blocks []int32, version string, w io.Writer) (err error) {
unique := util.GetUniqueSlice(blocks)
bpe := uint8(math.Ceil(math.Log2(float64(len(unique)))))
bpe := util.BpeByNum(float64(len(unique)))
if bpe > 8 {
bpe = uint8(math.Ceil(math.Log2(float64(len(data.BlocksForVersion(version))))))
bpe = util.BpeByNum(float64(len(data.BlocksForVersion(version))))
}
err = binary.Write(w, binary.BigEndian, bpe)