Give mob, beacon, sculk and splash effects to every player
On a server (the integrated server thread and the dedicated server) the host has no player of its own, so effects that only touched the host's player reached nobody; on a LAN world they reached only the host. Beacons, the warden's and shriekers' darkness, the elder guardian's mining fatigue, splash and lingering potions' splash and the raid victory's Hero of the Village now run for each player in the level, guests through `as_guest`. The elder guardian's curse sends the guest the GUARDIAN_ELDER_EFFECT game event, which the remote client now shows (the apparition and the curse sound). lan_e2e.py gains an `effects` check: a speed beacon next to both players must give both of them speed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+25
-2
@@ -22,6 +22,7 @@ address. The script then checks, from both sides, what a guest's game used to ge
|
||||
- containers: the guest's ender chest holds the guest's items, not the host's, and a double chest
|
||||
opens as 9x6 with the right half first;
|
||||
- feedback: the guest's command feedback names the guest and shows the numbers;
|
||||
- effects: a beacon's power reaches every player in range, the host and the guest;
|
||||
- portals: (--server-thread) the server holds a level per dimension: the guest goes to the Nether
|
||||
through a portal while the host stays, then the host goes to the End while the guest is in
|
||||
the Nether, and both come back.
|
||||
@@ -56,7 +57,7 @@ ROOT = Path(__file__).resolve().parents[1]
|
||||
GUEST_NAME = 'Guest'
|
||||
# The host plays single player on its server thread (--server-thread).
|
||||
SERVER_THREAD = False
|
||||
CHECKS = ['tab', 'self', 'armour', 'nametags', 'walls', 'chest', 'crafting', 'sign', 'damage', 'mobs', 'hazards', 'pvp', 'containers', 'feedback', 'trials', 'portals']
|
||||
CHECKS = ['tab', 'self', 'armour', 'nametags', 'walls', 'chest', 'crafting', 'sign', 'damage', 'mobs', 'hazards', 'pvp', 'containers', 'feedback', 'trials', 'effects', 'portals']
|
||||
|
||||
|
||||
class Game:
|
||||
@@ -294,6 +295,28 @@ def check_sign(host, guest, out):
|
||||
return placed
|
||||
|
||||
|
||||
def effect_ids(game):
|
||||
return [e.get('id', '').removeprefix('minecraft:') for e in game('state')['player'].get('effects', [])]
|
||||
|
||||
|
||||
def check_effects(host, guest, out):
|
||||
x, y, z = (int(v // 1) for v in pos_of(host))
|
||||
bx, by, bz = x - 3, y, z - 3
|
||||
host('command', command=f'fill {bx - 1} {by - 1} {bz - 1} {bx + 1} {by - 1} {bz + 1} minecraft:iron_block')
|
||||
host('command', command=f'setblock {bx} {by} {bz} minecraft:beacon{{primary_effect:"minecraft:speed"}}')
|
||||
# BeaconBlockEntity.tick applies its powers every 80 ticks, once the beam has reached the sky.
|
||||
seen = {}
|
||||
for _ in range(15):
|
||||
host.wait(20)
|
||||
seen = {'host': effect_ids(host), 'guest': effect_ids(guest)}
|
||||
if all('speed' in v for v in seen.values()):
|
||||
break
|
||||
host.shot(out, 'effects')
|
||||
guest.shot(out, 'effects')
|
||||
assert 'speed' in seen['host'] and 'speed' in seen['guest'], f'beacon effects: {seen}'
|
||||
return seen
|
||||
|
||||
|
||||
def wait_dimension(game, dimension, ticks):
|
||||
"""Wait up to `ticks` for the game to be in `dimension` with its world loaded around it."""
|
||||
for _ in range(ticks // 20):
|
||||
@@ -727,7 +750,7 @@ CHECK_FNS = {'tab': check_tab, 'self': check_self, 'armour': check_armour, 'name
|
||||
'chest': check_chest, 'crafting': check_crafting, 'sign': check_sign, 'damage': check_damage,
|
||||
'mobs': check_mobs, 'hazards': check_hazards, 'pvp': check_pvp,
|
||||
'containers': check_containers, 'feedback': check_feedback, 'trials': check_trials,
|
||||
'walls': check_walls, 'portals': check_portals}
|
||||
'walls': check_walls, 'effects': check_effects, 'portals': check_portals}
|
||||
|
||||
|
||||
def run(ctl, out, resources, checks):
|
||||
|
||||
Reference in New Issue
Block a user