Fix evoker fangs rendering on server clients

Track fang entities and deliver their start event to the existing client renderer. Exercise warmup, animation, authoritative positions and removal in the LAN harness.

Co-Authored-By: OpenAI Codex GPT-6.1 Sol <noreply@openai.com>
This commit is contained in:
rdbtCVS
2026-10-26 10:46:18 +00:00
parent 707348fcd5
commit f98528bbfc
6 changed files with 137 additions and 5 deletions
+83
View File
@@ -6591,5 +6591,88 @@ CHECKS += ['replant']
CHECK_FNS['replant'] = check_replant
def check_fangs(host, guest, out):
"""EvokerFangs: authoritative spawn, event 4, client animation and server removal (#1482)."""
x, y, z = (int(v // 1) for v in pos_of(host))
tag = 'lan_evoker_fangs'
selector = f'@e[type=minecraft:evoker,tag={tag},limit=1]'
paths = {g.name: {} for g in (host, guest)}
warmup = dict.fromkeys(paths, False)
drawn = dict.fromkeys(paths, False)
stopped = False
photographed = False
def fangs(status):
return [p for p in status['projectiles'] if p['kind'] == 'minecraft:evoker_fangs']
try:
host('command', command='difficulty normal')
host('command', command='gamemode creative')
guest('command', command='gamemode survival')
guest('command', command='effect give @s minecraft:resistance 120 4 true')
host('command', command=f'fill {x - 10} {y - 1} {z - 10} {x + 10} {y - 1} {z + 18} minecraft:stone')
host('command', command=f'fill {x - 10} {y} {z - 10} {x + 10} {y + 8} {z + 18} minecraft:air')
host('command', command=f'tp @s {x + 4.5} {y} {z - 2.5}')
guest('command', command=f'tp @s {x + 0.5} {y} {z + 0.5}')
guest.wait(10)
host('command', command=f'summon minecraft:evoker {x + 0.5} {y} {z + 9.5} '
f'{{PersistenceRequired:1b,Tags:["{tag}"]}}')
for game in (host, guest):
game.raw('look-at', x + 0.5, y + 0.5, z + 5.5)
for _ in range(200):
guest.wait(2)
statuses = {g.name: g('status') for g in (host, guest)}
for name, status in statuses.items():
live = fangs(status)
ids = [f['id'] for f in live]
assert all(ids) and len(ids) == len(set(ids)), f'{name}: invalid fang ids {ids}'
warmup[name] |= any(not f['started'] for f in live)
drawn[name] |= status['fangs_vertices'] > 0
for f in live:
paths[name].setdefault(f['id'], []).append(f)
if paths['host'] and not stopped:
host('command', command=f'data merge entity {selector} {{NoAI:1b}}')
stopped = True
if (all(drawn.values()) and not photographed
and any(f['started'] and 8 <= f['life'] <= 16
for f in fangs(statuses['guest']))):
host('command', command='tick freeze')
try:
for game in (host, guest):
game.raw('key', 'f1', 'tap')
try:
game.shot(out, 'evoker-fangs')
finally:
game.raw('key', 'f1', 'tap')
finally:
host('command', command='tick unfreeze')
photographed = True
if stopped and not any(fangs(s) for s in statuses.values()):
break
lab.write_json(out / 'evoker-fangs.json', {'paths': paths, 'warmup': warmup, 'drawn': drawn})
assert all(warmup.values()), f'fang warmup not received: {warmup}'
assert all(drawn.values()), f'fang renderer produced no geometry: {drawn}'
assert paths['host'].keys() == paths['guest'].keys(), 'clients received different fang ids'
for id, samples in paths['host'].items():
other = paths['guest'][id]
assert all(f['position'] == samples[0]['position'] for f in samples + other), \
f'fang {id} is not at its authoritative position'
for name, frames in (('host', samples), ('guest', other)):
life = {f['life'] for f in frames if f['started']}
assert len(life) > 1, f'{name}: fang {id} did not animate: {frames}'
assert not any(fangs(g('status')) for g in (host, guest)), 'fangs survived server removal'
finally:
host('command', command='tick unfreeze')
host('command', command=f'kill @e[tag={tag}]')
guest('command', command='effect clear @s')
face_each_other(host, guest)
return {'fangs': len(paths['host']), 'warmup': warmup, 'drawn': drawn, 'removed': True}
CHECKS += ['fangs']
CHECK_FNS.update(fangs=check_fangs)
if __name__ == '__main__':
main()