agent_control_e2e pick: wait for the server to clear the cursor
Step 2 clones a stack in the creative tab and closes the screen. The clone lived only on the client: ItemPickerMenu's carried stack is the inventoryMenu's, and AbstractContainerMenu.removed clears the carried stack only for a ServerPlayer, so vanilla's client still holds it when the survival inventory opens. With a stack in hand the middle button's release sends CLONE (AbstractContainerScreen.mouseReleased); the server finds the carried stack it was told about wrong and sends the empty one (broadcastChanges). On single player's server thread that answer takes a round trip, as in vanilla, so step 3 now waits up to 20 ticks for it. The in-frame world puts the clone away when the menu closes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -500,6 +500,15 @@ def pick_scenario(d, out):
|
||||
d('give', item='oak_log', count=2)
|
||||
assert d('open_inventory')['screen'] == 'inventory'
|
||||
d('click', id='slot-0', middle=True)
|
||||
# The clone of step 2 lived only on this client: ItemPickerMenu's carried stack is the
|
||||
# inventoryMenu's, and AbstractContainerMenu.removed clears it only for a ServerPlayer. With a
|
||||
# stack in hand, mouseReleased sends CLONE, the server finds the carried stack it was told about
|
||||
# wrong and sends the empty one back (broadcastChanges). On the server thread that takes a
|
||||
# round trip, as in vanilla; in the frame, closing the menu already put the clone away.
|
||||
for _ in range(20):
|
||||
if carried() is None:
|
||||
break
|
||||
d('wait', ticks=1)
|
||||
assert carried() is None, carried()
|
||||
assert widgets(d)['slot-0']['stack'] == {'item': 'minecraft:oak_log', 'count': 2}
|
||||
d('close')
|
||||
|
||||
Reference in New Issue
Block a user