From 232feaa435853aa446947f437166c7345ef8af73 Mon Sep 17 00:00:00 2001 From: "Sascha L. Teichmann" Date: Mon, 20 Jul 2015 13:27:46 +0200 Subject: [PATCH] Dont store air only information in decoded block. This can be found out pretty easy by analysing the other fields if needed. --- common/block.go | 12 ++++++------ common/renderer.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/block.go b/common/block.go index da3f891..0f8b864 100644 --- a/common/block.go +++ b/common/block.go @@ -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 diff --git a/common/renderer.go b/common/renderer.go index d5046f3..b2b8e3e 100644 --- a/common/renderer.go +++ b/common/renderer.go @@ -215,7 +215,7 @@ func (r *Renderer) RenderBlock(block *Block, colors *Colors) (err error) { return } - if db.AirOnly { + if db.AirOnly() { r.RejectedBlocks++ return }