simple conversion between save.Chunk and level.Chunk

This commit is contained in:
Tnze
2021-12-20 15:32:44 +08:00
parent 5bc8513039
commit 5acd7f73c5
7 changed files with 376 additions and 189 deletions

View File

@ -4,12 +4,12 @@
package block
import (
"math"
"math/bits"
)
// BitsPerBlock indicates how many bits are needed to represent all possible
// block states. This value is used to determine the size of the global palette.
var BitsPerBlock = int(math.Ceil(math.Log2(float64(len(StateID)))))
var BitsPerBlock = bits.Len(uint(len(StateID)))
// ID describes the numeric ID of a block.
type ID uint32

View File

@ -24,12 +24,12 @@ const (
package block
import (
"math"
"math/bits"
)
// BitsPerBlock indicates how many bits are needed to represent all possible
// block states. This value is used to determine the size of the global palette.
var BitsPerBlock = int(math.Ceil(math.Log2(float64(len(StateID)))))
var BitsPerBlock = bits.Len(uint(len(StateID)))
// ID describes the numeric ID of a block.
type ID uint32