Struct ScreenView
#[non_exhaustive]pub struct ScreenView<'a> {
pub id: &'static str,
pub menu: Option<&'a str>,
pub title: Option<&'a Text>,
pub rect: [f32; 4],
pub slots: usize,
pub mouse: [f32; 2],
pub partial_tick: f32,
}Expand description
The open screen, for the screen hooks (native_screen_render_post, the
mouse ones native_screen_mouse_button_pressed_pre, ..._released_pre and
native_screen_mouse_scrolled_pre, and the key ones
native_screen_key_pressed_pre and native_screen_char_typed_pre): what
it is, its menu and title, where its container panel is, how many slots its
menu has, and where the mouse and the frame’s partial tick are.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: &'static strOne id per Screen (Screen::id): inventory, creative, paused,
stats, options, win… Stable across releases, so a mod can match
on it. Every container, station and mod window draws on the inventory
screen and so reports inventory: tell them apart by menu and
title (both None on a window the client opened itself) and by
slots. The title’s own screens report theirs: title,
world_select, world_create, world_create_flat, world_edit,
multiplayer, add_server, direct_connect…, with no menu, no title
and no slots.
The type id of the menu the server opened for this screen
(minecraft:generic_9x3, minecraft:furnace, a mod’s own id; a mount’s
inventory is horizon:mount<n>). None on a screen without one (the
client’s own inventory, creative, the pause menu, stats…) and for a
menu type the client does not know.
title: Option<&'a Text>The title the server gave the open menu, if it has one: the component itself, borrowed as an owned API component tree. None when the server gave none, on a screen the client opened, and while playing.
rect: [f32; 4]The screen’s container panel in GUI pixels, [x, y, width, height];
the whole window for a screen with none. The panel is where the game
draws the window: 176 wide for most, wider for the merchant and the
beacon, a mod screen’s own size for a mod’s.
slots: usizeThe slots the open menu has, as Game::slots counts them: the player
inventory’s 36, then the container’s, the station’s, the mod screen’s
or the crafting grid’s (a screen with no menu of its own still counts
the inventory menu’s). Counted, not listed.
mouse: [f32; 2]The pointer in GUI pixels (Screen.mouseX, mouseY, from the
window’s top left), as cursor gives it: for hover highlights.
partial_tick: f32This frame’s partial tick (getGameTimeDeltaPartialTick(false), 0 to
1): what the screen draws animation against.
Trait Implementations§
§impl<'a> Clone for ScreenView<'a>
impl<'a> Clone for ScreenView<'a>
§fn clone(&self) -> ScreenView<'a>
fn clone(&self) -> ScreenView<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more