mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 09:10:17 +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
|
MapContent []byte
|
||||||
AirId int32
|
AirId int32
|
||||||
IgnoreId int32
|
IgnoreId int32
|
||||||
|
AirOnly bool
|
||||||
IndexMap map[int32]int32
|
IndexMap map[int32]int32
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -136,6 +137,7 @@ func NewDecodedBlock(data []byte, nameIndex map[string]int32) (db *DecodedBlock,
|
|||||||
|
|
||||||
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
|
||||||
if version >= 22 {
|
if version >= 22 {
|
||||||
offset++
|
offset++
|
||||||
numMappings := int(binary.BigEndian.Uint16(data[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{
|
db = &DecodedBlock{
|
||||||
@ -167,6 +170,7 @@ func NewDecodedBlock(data []byte, nameIndex map[string]int32) (db *DecodedBlock,
|
|||||||
MapContent: mapContent,
|
MapContent: mapContent,
|
||||||
AirId: airId,
|
AirId: airId,
|
||||||
IgnoreId: ignoreId,
|
IgnoreId: ignoreId,
|
||||||
|
AirOnly: airOnly,
|
||||||
IndexMap: indexMap}
|
IndexMap: indexMap}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -182,6 +182,11 @@ func (r *Renderer) RenderBlock(block *Block, nameIndex map[string]int32) (err er
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if db.AirOnly {
|
||||||
|
r.Rejected++
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
w := r.width << 4
|
w := r.width << 4
|
||||||
ofs := int(bz)*w<<4 + int(bx)<<4
|
ofs := int(bz)*w<<4 + int(bx)<<4
|
||||||
yB := r.yBuffer
|
yB := r.yBuffer
|
||||||
|
Loading…
Reference in New Issue
Block a user