commands: an unbounded selector reaches the other loaded levels
`Game::select` gathered its candidates from the level in place only, so `@e[tag=...]` never found an entity in another dimension the server still holds: vanilla's `EntitySelector` searches every loaded level unless the selector carries a spatial constraint. The selector now searches each loaded level in turn, and the commands that act on the entity it found (`/data get entity`, `/kill`, `/tp`) act on it in the level that holds it. The experience orbs and the projectiles are named by their entity id, like the other entities, so the entity a command acts on is the one the selector found. Fixes #1524 Co-Authored-By: minimax-m3.1-flash (Claude Code) <noreply@users.noreply.github.com>
This commit is contained in:
@@ -533,13 +533,21 @@ def execute():
|
||||
|
||||
def levels():
|
||||
"""A nether portal round trip: on the way back the Overworld's entities (the
|
||||
pig left by `entities`) are found and a summon names what it summoned."""
|
||||
pig left by `entities`) are found and a summon names what it summoned. An
|
||||
unbounded selector also reaches the level the player is not in, while a
|
||||
bounded one does not."""
|
||||
return [
|
||||
*setup('/fill 2 231 12 5 236 12 minecraft:obsidian', '/fill 3 232 12 4 235 12 minecraft:nether_portal[axis=x]',
|
||||
'/tp @s 3.5 232 12.5 0 0'),
|
||||
'/tp @s 3.5 232 12.5 0 0',
|
||||
# A cow in the Overworld, in a chunk that stays loaded while the
|
||||
# player is in the nether.
|
||||
'/forceload add 0 0',
|
||||
'/summon minecraft:cow 10.5 210 4.5 {NoAI:1b,NoGravity:1b,Tags:["remote_cow"]}'),
|
||||
{'op': 'portal'},
|
||||
{'op': 'settle'},
|
||||
cmd('/execute if dimension minecraft:the_nether run say through the portal'),
|
||||
cmd('/data get entity @e[tag=remote_cow,limit=1] Pos'),
|
||||
cmd('/data get entity @e[tag=remote_cow,distance=..128,limit=1] Pos'),
|
||||
{'op': 'portal'},
|
||||
{'op': 'settle'},
|
||||
cmd('/execute if dimension minecraft:overworld run say back through the portal'),
|
||||
|
||||
Reference in New Issue
Block a user