Skip to content

Minecraft: Java Edition 26.3 rewritten from scratch in Rust, checked against vanilla with 281 differential harnesses. Get it with the Horizon launcher.

Mod API types that can grow are non_exhaustive

arismoko610db0d288ec
diff --git a/crates/horizon-client-render/src/gfx/native_render.rs b/crates/horizon-client-render/src/gfx/native_render.rs
index 02d530aed..0b2a171e4 100644
--- a/crates/horizon-client-render/src/gfx/native_render.rs
+++ b/crates/horizon-client-render/src/gfx/native_render.rs
@@ -43,6 +43,7 @@ pub fn world_drawn_hooked() -> bool {
/// particles, weather and the world post pass, before the first-person hand, the HUD and the
/// screens. `color` holds the world's picture (copy it out before reading it: it is the target
/// drawn into), `depth` the world's depth, reversed (0 is the sky).
+#[non_exhaustive]
pub struct WorldDrawn<'a> {
pub device: &'a wgpu::Device,
pub queue: &'a wgpu::Queue,
@@ -78,6 +79,7 @@ pub struct WorldDrawn<'a> {
/// What the mods need from a frame that the game doesn't make for itself. Each mod sets what it
/// needs and leaves the rest, so several can ask.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
+#[non_exhaustive]
pub struct RenderNeeds {
/// Record `Frame::entity_spans` without a shader pack: entity runs get a stable id from
/// their type's name, block entity runs their block state.
diff --git a/crates/horizon-client/src/mod_api.rs b/crates/horizon-client/src/mod_api.rs
index 529d1a97a..8d550e198 100644
--- a/crates/horizon-client/src/mod_api.rs
+++ b/crates/horizon-client/src/mod_api.rs
@@ -42,6 +42,7 @@ pub type NativeDispensed = (Option<ItemStack>, i32);
/// What dropped the items heard by the `loot_drops` hook.
#[derive(Clone, Copy, Debug)]
+#[non_exhaustive]
pub struct NativeLootDrops<'a> {
/// The block's or mob's own loot table (`minecraft:blocks/stone`, `minecraft:entities/zombie`);
/// empty when none rolled: the block or mob has none, the `mob_drops` rule is off, a baby
@@ -84,6 +85,7 @@ pub struct NativeLootDrops<'a> {
/// 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.
#[derive(Clone, Copy, Debug)]
+#[non_exhaustive]
pub struct NativeScreenView<'a> {
/// One id per `Screen` (`Screen::id`): `inventory`, `creative`, `paused`,
/// `stats`, `options`, `win`… Stable across releases, so a mod can match
@@ -195,6 +197,7 @@ pub struct NativeStack {
/// What the player did on a native mod's panel (`native_panel_event`).
#[derive(Clone, Debug, PartialEq)]
+#[non_exhaustive]
pub enum NativePanelEvent {
/// A click on an item of the panel, by its index in
/// `native_panel_items`' list.
@@ -236,6 +239,7 @@ pub struct NativeZoom {
/// A player on the server, as a server hook sees them.
#[derive(Clone, Debug, PartialEq)]
+#[non_exhaustive]
pub struct NativeServerPlayer {
pub uuid: u128,
pub name: String,
@@ -263,6 +267,7 @@ pub struct NativeServerPlayer {
/// `item`, `block_pos`. Usages of one command share their words; the
/// server merges them into one tree.
#[derive(Clone, Debug, PartialEq, Eq)]
+#[non_exhaustive]
pub struct NativeCommand {
pub usage: String,
/// The operator level a player needs to see and run it (0: everyone).
@@ -288,6 +293,7 @@ impl NativeCommand {
/// Which `Game` observes the phase; a mirror `Game` never fires.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+#[non_exhaustive]
pub enum NativeAuthority {
LocalAuthoritative,
IntegratedServer,
@@ -332,6 +338,7 @@ impl NativeTickId {
/// The phase names are the hook log's stable vocabulary (the Debug text
/// the mixins write); keep them despite the shared prefix.
#[allow(clippy::enum_variant_names)]
+#[non_exhaustive]
pub enum WorldPhase {
WorldOpenReady,
/// The open failed; `error_text` is the engine's own error text.
@@ -343,6 +350,7 @@ pub enum WorldPhase {
/// The tick phases carry whether the world runs, including frozen steps.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+#[non_exhaustive]
pub enum ServerTickPhase {
ServerTickStart { world_running: bool },
ServerTickEnd { world_running: bool },
@@ -354,6 +362,7 @@ pub enum ServerTickPhase {
/// the same epoch identifies its ready, final-close, or failed-close event.
/// `tick` counts non-paused server ticks since the world opened.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+#[non_exhaustive]
pub struct NativeLifecycleContext {
pub authority: NativeAuthority,
pub epoch: NativeWorldEpoch,
diff --git a/crates/horizon-world/src/attachments.rs b/crates/horizon-world/src/attachments.rs
index 168b9bffb..93ff25bb9 100644
--- a/crates/horizon-world/src/attachments.rs
+++ b/crates/horizon-world/src/attachments.rs
@@ -5,6 +5,7 @@ use crate::nbt::{Compound, JavaString, Tag};
/// An attachment operation could not be completed.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+#[non_exhaustive]
pub enum AttachmentError {
/// The holder does not exist or is unavailable on this side.
MissingHolder,
@@ -34,6 +35,7 @@ pub fn attachment_compound(tag: Option<&Tag>) -> Result<Option<&Compound>, Attac
/// A server holder in the host's current dimension.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+#[non_exhaustive]
pub enum Holder {
Entity(u32),
Player(u128),