Clear stale sign data when signs break
This commit is contained in:
@@ -25,6 +25,11 @@ class World:
|
||||
def block_at(self, x, y, z):
|
||||
return self.g.chunks.get_block_at(x, y, z)
|
||||
|
||||
@staticmethod
|
||||
def _is_sign_state(state_id):
|
||||
name = blocks.BLOCKS.get(state_id)
|
||||
return name is not None and name.endswith('_sign')
|
||||
|
||||
@staticmethod
|
||||
def _sign_component_text(value):
|
||||
if value is None:
|
||||
@@ -58,6 +63,12 @@ class World:
|
||||
for position, entity in self.g.chunks.block_entities.items():
|
||||
if utils.phyp(center, position) > distance:
|
||||
continue
|
||||
get_block_at = getattr(self.g.chunks, 'get_block_at', None)
|
||||
if callable(get_block_at):
|
||||
state_id = get_block_at(*position)
|
||||
if (state_id is not None and
|
||||
not self._is_sign_state(state_id)):
|
||||
continue
|
||||
data = entity.get('data') or {}
|
||||
for side in ('front', 'back'):
|
||||
text_data = data.get(side + '_text')
|
||||
|
||||
Reference in New Issue
Block a user