Minecraft: Java Edition 26.3 rewritten from scratch in Rust, checked against vanilla with 281 differential harnesses. Get it with the Horizon launcher.
Rust differential-testinggame-enginegamedevlinuxminecraftminecraft-javareimplementationrustvoxelvulkanwgpu
Add physical window size native helper
SamSu6e55b944e388
diff --git a/crates/horizon-client/src/game/native_hooks.rs b/crates/horizon-client/src/game/native_hooks.rsindex 14b884c4a..54b8d7260 100644--- a/crates/horizon-client/src/game/native_hooks.rs+++ b/crates/horizon-client/src/game/native_hooks.rs@@ -4750,6 +4750,12 @@ impl Game<'_> {) -> Option<ItemStack> {self.insert_stack_through(pos, face, stack)}+ /// The window's width and height in physical pixels, independent of GUI+ /// scale; none on a server or when no window exists. API @API:physical_window_size@.+ pub(super) fn native_physical_window_size(&self) -> Option<[u32; 2]> {+ let size = self.window.as_ref()?.inner_size();+ Some([size.width, size.height])+ }/// Where the mouse is, in GUI pixels. API 20.pub(super) fn native_cursor(&self) -> [f32; 2] {[self.cursor.0, self.cursor.1]diff --git a/docs/native-mods.md b/docs/native-mods.mdindex 00898d73a..1cb6c51d1 100644--- a/docs/native-mods.md+++ b/docs/native-mods.md@@ -891,6 +891,8 @@ API 152 adds a player opening and closing any menu on a server, on the single plAPI 153 adds a player starting or stopping flight: `native_player_toggle_flight(player, name, flying, cancel)` is heard once for each change a player's client makes to its flying (vanilla honours it only for a player who may fly), on a server, with the player's state swapped in. A mod sets `cancel` to refuse it: the player keeps the state they had and the server sends their abilities back, so the client lands or flies again. Only what a client asks for is heard, not the flight a game-mode change starts or ends, and not a LAN host's own player. Bundles that use it need `"hooks": 153`.+API @API:physical_window_size@ adds `native_physical_window_size()`, the window's width and height in physical pixels, independent of GUI scale. It returns no size on a server or when no window exists. Bundles that use it need `"hooks": @API:physical_window_size@`.+## What the launcher doesIn the window: install a native mod from the Mods page, into the instance picked on the left ("Installs intodiff --git a/tools/native-hook-fragments/physical_window_size.json b/tools/native-hook-fragments/physical_window_size.jsonnew file mode 100644index 000000000..4ab27f7d9--- /dev/null+++ b/tools/native-hook-fragments/physical_window_size.json@@ -0,0 +1,5 @@+{+ "hooks": [],+ "rust_summary": "the window's physical pixel size (`native_physical_window_size`).",+ "doc_summary": "the helper `native_physical_window_size()`, which returns the window's width and height in physical pixels, independent of GUI scale. It returns no size on a server or when no window exists. Bundles that use it need `\"hooks\": @API:physical_window_size@`."+}