Synchronize world chunk index updates
This commit is contained in:
+12
-4
@@ -60,7 +60,11 @@ class World:
|
||||
def find_signs(self, center, distance=16):
|
||||
"""Return nearby loaded signs as position/side/four-lines records."""
|
||||
result = []
|
||||
for position, entity in self.g.chunks.block_entities.items():
|
||||
chunks = self.g.chunks
|
||||
entities = (chunks.block_entities_snapshot()
|
||||
if hasattr(chunks, 'block_entities_snapshot') else
|
||||
dict(chunks.block_entities))
|
||||
for position, entity in entities.items():
|
||||
if utils.phyp(center, position) > distance:
|
||||
continue
|
||||
get_block_at = getattr(self.g.chunks, 'get_block_at', None)
|
||||
@@ -348,9 +352,13 @@ class World:
|
||||
yield check
|
||||
|
||||
def find_blocks_indexed(self, center, block_ids, distance=0):
|
||||
index = []
|
||||
for bid in block_ids:
|
||||
index.extend(self.g.chunks.index.get(bid, []))
|
||||
chunks = self.g.chunks
|
||||
if hasattr(chunks, 'indexed_positions'):
|
||||
index = chunks.indexed_positions(block_ids)
|
||||
else:
|
||||
index = []
|
||||
for bid in block_ids:
|
||||
index.extend(chunks.index.get(bid, []))
|
||||
|
||||
result = []
|
||||
for block in index:
|
||||
|
||||
Reference in New Issue
Block a user