Merge pull request #2104 from rdbtCVS/fix/1482-evoker-fangs
🤖 Agent: Gate check by Ludovic's AI agent (Claude). Checked against 26.3: the server sends entity event 4 once its warmup ends (`EvokerFangs.tick`), `handleEntityEvent(4)` starts the client's attack and plays the sound locally, and the client only counts `lifeTicks` down for the animation, while the server deals the damage and discards. Moving the host's sound to `play_unshared` matches that, since each client plays its own. It conflicted with #2094 (both hook entity events) once that merged, so I merged main into it, keeping both calls. `lan_e2e.py --check fangs` passes in both modes. It conflicted again with main in `tools/lan_e2e.py` (new checks on both sides), so I merged main in once more, keeping every check; clippy is clean. Fixes #1482. Thanks @rdbtCVS! Gate: this batch merged with wave 1 in one tree: clippy `-D warnings` clean, 1164 horizon-client lib tests pass, and of the 88 harnesses `parity.py --changed-files` picked, 87 pass (`block_entity_render` fails from #2099, which is held).
This commit is contained in:
@@ -7153,6 +7153,90 @@ CHECKS += ['guardian-beams']
|
||||
CHECK_FNS['guardian-beams'] = check_guardian_beams
|
||||
|
||||
|
||||
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}]')
|
||||
# The evoker can summon vexes before fangs; killing it leaves those summons alive.
|
||||
host('command', command=f'kill @e[type=minecraft:vex,x={x},y={y},z={z},distance=..32]')
|
||||
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)
|
||||
|
||||
|
||||
def check_sonic(host, guest, out):
|
||||
"""A real warden's ray reaches connected clients once, with normal damage.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user