mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 11:06:11 -10:00
Merge pull request #10126 from lightcodegit/fix/spectator-cant-open
A refused spectator opening gets the red action bar
This commit is contained in:
2 files changed
+16
No files matched your search
@@ -1499,6 +1499,17 @@ impl Game<'_> {
|
||||
// loot table is still to roll, and the table stays.
|
||||
let spectator = host.hub.guest(conn).is_some_and(|g| g.spectator());
|
||||
if spectator && self.boat_loot_pending(self.boats[i].id) {
|
||||
// ServerPlayer.openMenu: the refused spectator's action bar, red.
|
||||
let message =
|
||||
horizon_client::text::Text::translate("container.spectatorCantOpen", &[])
|
||||
.with_color(horizon_client::text::RED);
|
||||
host.hub.send_to(
|
||||
conn,
|
||||
&C::SystemChat(play::SystemChat {
|
||||
content: horizon_client::lan::data::component_nbt(&message.component()),
|
||||
overlay: true,
|
||||
}),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
self.unpack_boat_loot(i);
|
||||
|
||||
@@ -51,6 +51,7 @@ impl Game<'_> {
|
||||
}
|
||||
// BaseContainerBlockEntity.canOpen: a spectator opens no container that still
|
||||
// has a loot table to unpack (it clears while it rolls, on first open).
|
||||
// ServerPlayer.openMenu sends the refused spectator a red action bar.
|
||||
if self
|
||||
.world
|
||||
.chunks
|
||||
@@ -58,6 +59,10 @@ impl Game<'_> {
|
||||
.and_then(|c| c.saved.as_ref())
|
||||
.is_some_and(|s| s.rolled_loot.iter().any(|r| r.pos == key))
|
||||
{
|
||||
self.send_overlay_message(
|
||||
Text::translate("container.spectatorCantOpen", &[])
|
||||
.with_color(horizon_client::text::RED),
|
||||
);
|
||||
return;
|
||||
}
|
||||
let Some(entity) = BlockEntity::for_block(&name) else {
|
||||
|
||||
Reference in new issue
Block a user