close #163
This commit is contained in:
10
level/block/utilfuncs.go
Normal file
10
level/block/utilfuncs.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package block
|
||||||
|
|
||||||
|
func IsAir(s int) bool {
|
||||||
|
switch StateList[s].(type) {
|
||||||
|
case Air, CaveAir, VoidAir:
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
@ -143,7 +143,7 @@ func ChunkFromSave(c *save.Chunk, secs int) *Chunk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
s := block.ToStateID[b]
|
s := block.ToStateID[b]
|
||||||
if !isAir(s) {
|
if !block.IsAir(s) {
|
||||||
blockCount++
|
blockCount++
|
||||||
}
|
}
|
||||||
stateRawPalette[i] = s
|
stateRawPalette[i] = s
|
||||||
@ -297,7 +297,7 @@ func (s *Section) GetBlock(i int) int {
|
|||||||
return s.States.Get(i)
|
return s.States.Get(i)
|
||||||
}
|
}
|
||||||
func (s *Section) SetBlock(i int, v int) {
|
func (s *Section) SetBlock(i int, v int) {
|
||||||
if isAir(s.States.Get(i)) {
|
if block.IsAir(s.States.Get(i)) {
|
||||||
s.BlockCount--
|
s.BlockCount--
|
||||||
}
|
}
|
||||||
if v != 0 {
|
if v != 0 {
|
||||||
@ -362,12 +362,3 @@ func (l *lightData) ReadFrom(r io.Reader) (int64, error) {
|
|||||||
pk.Array(&l.BlockLight),
|
pk.Array(&l.BlockLight),
|
||||||
}.ReadFrom(r)
|
}.ReadFrom(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func isAir(s int) bool {
|
|
||||||
switch block.StateList[s].(type) {
|
|
||||||
case block.Air, block.CaveAir, block.VoidAir:
|
|
||||||
return true
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user