mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 01:00:18 +01:00
Do not render air only blocks. Nice performance speed up! :-)
This commit is contained in:
parent
1c530a2ce7
commit
8b42446acc
@ -47,6 +47,7 @@ type (
|
||||
MapContent []byte
|
||||
AirId int32
|
||||
IgnoreId int32
|
||||
AirOnly bool
|
||||
IndexMap map[int32]int32
|
||||
}
|
||||
)
|
||||
@ -136,6 +137,7 @@ func NewDecodedBlock(data []byte, nameIndex map[string]int32) (db *DecodedBlock,
|
||||
|
||||
airId, ignoreId := int32(-1), int32(-1)
|
||||
indexMap := make(map[int32]int32)
|
||||
var airOnly bool
|
||||
if version >= 22 {
|
||||
offset++
|
||||
numMappings := int(binary.BigEndian.Uint16(data[offset:]))
|
||||
@ -160,6 +162,7 @@ func NewDecodedBlock(data []byte, nameIndex map[string]int32) (db *DecodedBlock,
|
||||
}
|
||||
}
|
||||
}
|
||||
airOnly = airId != -1 && len(indexMap) == 0
|
||||
}
|
||||
|
||||
db = &DecodedBlock{
|
||||
@ -167,6 +170,7 @@ func NewDecodedBlock(data []byte, nameIndex map[string]int32) (db *DecodedBlock,
|
||||
MapContent: mapContent,
|
||||
AirId: airId,
|
||||
IgnoreId: ignoreId,
|
||||
AirOnly: airOnly,
|
||||
IndexMap: indexMap}
|
||||
|
||||
return
|
||||
|
@ -182,6 +182,11 @@ func (r *Renderer) RenderBlock(block *Block, nameIndex map[string]int32) (err er
|
||||
return
|
||||
}
|
||||
|
||||
if db.AirOnly {
|
||||
r.Rejected++
|
||||
return
|
||||
}
|
||||
|
||||
w := r.width << 4
|
||||
ofs := int(bz)*w<<4 + int(bx)<<4
|
||||
yB := r.yBuffer
|
||||
|
Loading…
Reference in New Issue
Block a user