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

View File

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