diff --git a/level/block/utilfuncs.go b/level/block/utilfuncs.go new file mode 100644 index 0000000..3a03a92 --- /dev/null +++ b/level/block/utilfuncs.go @@ -0,0 +1,10 @@ +package block + +func IsAir(s int) bool { + switch StateList[s].(type) { + case Air, CaveAir, VoidAir: + return true + default: + return false + } +} diff --git a/level/chunk.go b/level/chunk.go index 8fa5ca3..c56e4a7 100644 --- a/level/chunk.go +++ b/level/chunk.go @@ -143,7 +143,7 @@ func ChunkFromSave(c *save.Chunk, secs int) *Chunk { } } s := block.ToStateID[b] - if !isAir(s) { + if !block.IsAir(s) { blockCount++ } stateRawPalette[i] = s @@ -297,7 +297,7 @@ func (s *Section) GetBlock(i int) int { return s.States.Get(i) } func (s *Section) SetBlock(i int, v int) { - if isAir(s.States.Get(i)) { + if block.IsAir(s.States.Get(i)) { s.BlockCount-- } if v != 0 { @@ -362,12 +362,3 @@ func (l *lightData) ReadFrom(r io.Reader) (int64, error) { pk.Array(&l.BlockLight), }.ReadFrom(r) } - -func isAir(s int) bool { - switch block.StateList[s].(type) { - case block.Air, block.CaveAir, block.VoidAir: - return true - default: - return false - } -}