mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-09 17:19:15 -10:00
/data get entity @s prints the acting player's own UUID, not the world owner's
entity_nbt_in_level stamped UUID from level.player_uuid, the world owner's,
on a guest's turn too: on the server thread every player is a guest, so
/data get entity @s UUID gave every player offline_uuid("Player"). Use the
acting guest's UUID, as acting_uuid does. lan_e2e data_uuid checks the
guest and the host.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
f8bfa06b90
commit
755d2215c5
2 files changed
+22
-1
No files matched your search
@@ -68,7 +68,12 @@ impl Game<'_> {
|
||||
.flatten()
|
||||
}
|
||||
fn entity_nbt_in_level(&mut self, t: Target) -> Option<Tag> {
|
||||
let player_uuid = self.level.player_uuid;
|
||||
// The acting player's own UUID: a guest's turn (the window's player on
|
||||
// the server thread) keeps the world owner's in `level`.
|
||||
let player_uuid = self
|
||||
.lan_acting_uuid
|
||||
.map(horizon_client::lan::playerdata::uuid_ints)
|
||||
.or(self.level.player_uuid);
|
||||
Some(match t {
|
||||
Target::Guest(_) => {
|
||||
return self
|
||||
|
||||
@@ -10989,6 +10989,22 @@ CHECKS += ['pet_death']
|
||||
CHECK_FNS['pet_death'] = check_pet_death
|
||||
|
||||
|
||||
def check_data_uuid(host, guest, out):
|
||||
"""EntityDataAccessor: `/data get entity @s UUID` prints the player who runs it, their own
|
||||
offline UUID, for the guest and for the host (a server player too), not the world owner's."""
|
||||
seen = {}
|
||||
for game, name in ((guest, GUEST_NAME), (host, host.player)):
|
||||
reply = server_reply(game, 'data get entity @s UUID', '[I;')
|
||||
seen[name] = ','.join(re.findall(r'-?\d+', reply.partition('[I;')[2].partition(']')[0]))
|
||||
for name, ints in seen.items():
|
||||
assert ints == offline_uuid_ints(name), f"{name}'s UUID is not their own: {seen}"
|
||||
return seen
|
||||
|
||||
|
||||
CHECKS += ['data_uuid']
|
||||
CHECK_FNS['data_uuid'] = check_data_uuid
|
||||
|
||||
|
||||
def check_arrow_pickup(host, guest, out):
|
||||
"""ClientPacketListener.handleTakeItemEntity (#4486): an arrow a player picks up
|
||||
(AbstractArrow.playerTouch, once in the ground) flies into them on every client, the
|
||||
|
||||
Reference in new issue
Block a user