Dont store air only information in decoded block. This can be found out pretty easy by analysing the other fields if needed.

This commit is contained in:
Sascha L. Teichmann 2015-07-20 13:27:46 +02:00
parent b66c7fdff3
commit 232feaa435
2 changed files with 7 additions and 7 deletions

View File

@ -44,11 +44,10 @@ type (
DecodedBlock struct {
Version byte
Transparent bool
MapContent []byte
AirId int32
IgnoreId int32
AirOnly bool
Transparent bool
IndexMap map[int32]int32
}
)
@ -140,7 +139,6 @@ func NewDecodedBlock(data []byte, colors *Colors) (db *DecodedBlock, err error)
airId, ignoreId := int32(-1), int32(-1)
indexMap := make(map[int32]int32)
var airOnly bool
var transparent bool
if version >= 22 {
offset++
@ -169,21 +167,23 @@ func NewDecodedBlock(data []byte, colors *Colors) (db *DecodedBlock, err error)
}
}
}
airOnly = airId != -1 && len(indexMap) == 0
}
db = &DecodedBlock{
Version: version,
Transparent: transparent,
MapContent: mapContent,
AirId: airId,
IgnoreId: ignoreId,
AirOnly: airOnly,
Transparent: transparent,
IndexMap: indexMap}
return
}
func (db *DecodedBlock) AirOnly() bool {
return db.AirId != -1 && len(db.IndexMap) == 0
}
func (db *DecodedBlock) Content(x, y, z int) (content int32, found bool) {
pos := z<<8 + y<<4 + x

View File

@ -215,7 +215,7 @@ func (r *Renderer) RenderBlock(block *Block, colors *Colors) (err error) {
return
}
if db.AirOnly {
if db.AirOnly() {
r.RejectedBlocks++
return
}