From 9ab0e2b6a8bfa5a96de27f6fc7b05d5b990158e0 Mon Sep 17 00:00:00 2001 From: levzzz <86072227+levzzz5154@users.noreply.github.com> Date: Tue, 27 Oct 2026 05:08:40 +0500 Subject: [PATCH] Cover the slime block's push and bounce in the LAN harness A piston pushing a slime block moves the body in front of it and bounces it: the block's swept collision shape pushes the body out of the way, and the slime block sets the body's velocity along the push axis (`PistonMovingBlockEntity.moveCollidedEntities`, the `causeBounce` branch). The new `piston-slime` LAN case checks both for the host and the guest, with a plain block as the control: a plain block only pushes the body 0.81 blocks, the slime block pushes and bounces it 2.5. Co-Authored-By: minimax-m3.1-flash (Claude Code) --- tools/lan_e2e.py | 62 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/tools/lan_e2e.py b/tools/lan_e2e.py index 585b3000b..72b069965 100755 --- a/tools/lan_e2e.py +++ b/tools/lan_e2e.py @@ -298,7 +298,7 @@ CHECKS = ['tab', 'self', 'armour', 'nametags', 'walls', 'chest', 'crafting', 'sp 'arrows', 'kills', 'hurt', 'looks', 'leads', 'respawn', 'containers', 'feedback', 'titles', 'chat', 'styles', 'commands', 'recipes', 'machines', 'brewing', 'loom', 'stonecutter', 'grindstone', 'anvil', 'smithing', 'enchanting', 'beacon', 'crafter', 'lectern', 'cartography', 'trials', 'clicks', 'sleep', 'predict', 'push', - 'piston-push', 'eat', 'eating', 'xp', 'objects', 'projectiles', 'thrown', 'sparks', 'hud', 'sidebar', 'border', 'particles', + 'piston-push', 'piston-slime', 'eat', 'eating', 'xp', 'objects', 'projectiles', 'thrown', 'sparks', 'hud', 'sidebar', 'border', 'particles', 'worn', 'blast', 'barter', 'deflect', 'fireball', 'light', 'time', 'swings', 'cracks', 'plates', 'effects', 'portals', 'distance', 'growth', 'doors', 'flight', 'ladder', 'boats', 'minecarts', 'frames', 'hands', 'lightning', 'riding', 'mounts', 'worldspawn', 'beds', 'shield', 'deathmining', 'contacts', 'absorption', @@ -2506,6 +2506,65 @@ def piston_push_at_border(host, guest): return results +def check_piston_slime(host, guest, out): + """A piston pushing a slime block: the block pushes the body in front of + it and bounces it (`PistonMovingBlockEntity.moveCollidedEntities`).""" + hx, _, hz = pos_of(host) + x, y, z = (int(hx // 16) * 16 + 8, 100, int(hz // 16) * 16 + 8) + results = {} + + def setup(): + # The previous case may have left a mob where the body stands. + host('command', command='kill @e[type=minecraft:pig]') + host('command', command=f'setblock {x} {y} {z} minecraft:air') + host.wait(10) + host('command', command=f'fill {x-4} {y-1} {z-4} {x+7} {y-1} {z+4} minecraft:stone') + host('command', command=f'fill {x-4} {y} {z-4} {x+7} {y+5} {z+4} minecraft:air') + host('command', command=f'setblock {x} {y} {z} minecraft:piston[facing=east]') + host.wait(5) + + for player, name in ((host, host.player), (guest, GUEST_NAME)): + setup() + host('command', command=f'setblock {x+1} {y} {z} minecraft:slime_block') + host('command', command=f'tp @s {x+5.5} {y} {z+2.5}') + host('command', command=f'tp {GUEST_NAME} {x+5.5} {y} {z-1.5}') + host('command', command=f'tp {"@s" if player is host else GUEST_NAME} {x+2.5} {y} {z+0.5}') + player.wait(15) + before = pos_of(player) + assert abs(before[0] - (x + 2.5)) < 0.1, f'{name} did not reach the slime: {before}' + host('command', command=f'setblock {x-1} {y} {z} minecraft:redstone_block') + # The bounce sets the velocity along the push axis; it decays fast, so + # sample it while the block is still moving. + speed = 0.0 + for _ in range(6): + player.wait(2) + speed = max(speed, player('state')['player']['velocity'][0]) + after = pos_of(player) + results[name] = round(after[0] - before[0], 3) + # The block pushes the body out of its way, and the bounce launches it. + assert results[name] > 1.5, f'the slime block did not push and bounce {name}: {before} -> {after}' + assert speed > 0.05, f'the slime block did not bounce {name}: {speed}' + host('command', command=f'setblock {x-1} {y} {z} minecraft:air') + player.wait(10) + # A plain block only pushes: the body is not launched. + setup() + host('command', command=f'setblock {x+1} {y} {z} minecraft:stone') + host('command', command=f'tp @s {x+2.5} {y} {z+0.5}') + host.wait(15) + before = pos_of(host) + host('command', command=f'setblock {x-1} {y} {z} minecraft:redstone_block') + speed = 0.0 + for _ in range(6): + host.wait(2) + speed = max(speed, host('state')['player']['velocity'][0]) + after = pos_of(host) + results['stone'] = round(after[0] - before[0], 3) + assert results['stone'] < 1.5, f'a plain block bounced the player: {before} -> {after}' + host('command', command=f'setblock {x-1} {y} {z} minecraft:air') + host.wait(10) + return results + + def check_plates(host, guest, out): guest('command', command='gamemode survival') x, y, z = (int(v // 1) for v in pos_of(guest)) @@ -4819,6 +4878,7 @@ CHECK_FNS = {'tab': check_tab, 'self': check_self, 'armour': check_armour, 'recipes': check_recipes, 'trials': check_trials, 'walls': check_walls, 'effects': check_effects, 'portals': check_portals, 'distance': check_distance, 'clicks': check_clicks, 'sleep': check_sleep, 'push': check_push, 'piston-push': check_piston_push, + 'piston-slime': check_piston_slime, 'eat': check_eat, 'eating': check_eating, 'xp': check_xp, 'objects': check_objects, 'projectiles': check_projectiles, 'blast': check_blast, 'light': check_light, 'plates': check_plates, 'swings': check_swings,