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.

Merge remote-tracking branch 'upstream/main' into v2/ses_01M6BECNQ499TYMMBQBDF00VJ5-mod-api

arismoko99fcc59bf6ea
diff --cc crates/horizon-client/src/game/native_hooks.rs
index 55df7e677,14b884c4a..3a293979f
--- a/crates/horizon-client/src/game/native_hooks.rs
+++ b/crates/horizon-client/src/game/native_hooks.rs
@@@ -967,16 -847,110 +967,51 @@@ impl GameLevel<'_>
pos: BlockPos,
state: BlockStateId,
) {
- let _ = (ticks, dimension, pos, state);
+ horizon_client::mod_api::dispatch_perform_bonemeal(
+ &mut super::mod_api_host::LevelTicks { level: self, ticks },
+ horizon_client::mod_api::mods(),
+ dimension,
+ pos,
+ state,
+ );
}
+
+ /// On an authoritative server, how fire treats the block `state`
+ /// (`FireBlock.setFlammable(block, igniteOdds, burnOdds)`): put
+ /// `(ignite, burn)` in `odds` for your own blocks, and vanilla's table
+ /// isn't read. Ignite odds above zero let fire stand beside the block and
+ /// spread into the air around it (planks 5, wool 30, leaves 30); burn odds
+ /// are how fast fire destroys it (planks 20, wool 60, leaves 60). `(0, 0)`
+ /// never burns; keep both within vanilla's 0 to 100. A waterlogged state
+ /// never burns and isn't asked. Answer only for your own blocks and leave
+ /// `odds` empty otherwise; the level is read-only. Asked hundreds of times
+ /// per fire tick: keep it short. API @API:fire_odds@.
+ #[inline(always)]
+ pub(super) fn native_fire_odds(
+ &self,
+ dimension: LevelDimension,
+ state: BlockStateId,
+ odds: &mut Option<(i32, i32)>,
+ ) {
+ let _ = (dimension, state, odds);
+ }
+
+ /// On an authoritative server, `CampfireBlock.isSmokeSource` for the
+ /// block `state` under a campfire, as the campfire is placed or the block
+ /// under it changes: `Some(true)` for your own blocks makes the campfire a
+ /// signal fire whose smoke rises higher, as over a hay bale. The level is
+ /// read-only. API @API:fire_odds@.
+ #[inline(always)]
+ pub(super) fn native_smoke_source(
+ &self,
+ dimension: LevelDimension,
+ state: BlockStateId,
+ smoke: &mut Option<bool>,
+ ) {
+ let _ = (dimension, state, smoke);
+ }
}
-/// What dropped the items [`Game::native_loot_drops`] hears.
-#[allow(dead_code)]
-#[derive(Clone, Copy, Debug)]
-pub(crate) 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
- /// animal. A mob's drops may hold more: a charged creeper's head, a fox's mouth item.
- pub(crate) table: &'a str,
- /// The level they drop in (`minecraft:overworld`).
- pub(crate) dimension: &'a str,
- /// `LootContextParams.ORIGIN`: a broken block's centre, a mob's position.
- pub(crate) origin: [f64; 3],
- /// The block broken: its position and state.
- pub(crate) block: Option<([i32; 3], BlockStateId)>,
- /// The mob that died, or the entity a player's use dropped them from (the
- /// sheep sheared, the item frame broken): its entity ID and type
- /// (`minecraft:zombie`).
- pub(crate) entity: Option<(u32, &'a str)>,
- /// The player who broke the block or killed the mob, when known. A mob
- /// names one only while it remembers the player's hit (100 ticks), so one
- /// that dies to lava long after names none.
- pub(crate) player: Option<u128>,
- /// What broke the block (`LootContextParams.TOOL`).
- pub(crate) tool: Option<&'a ItemStack>,
- /// The radius of the explosion that broke the block.
- pub(crate) explosion: Option<f32>,
- /// A player's use dropped them rather than a break or a death: shears on a
- /// sheep, a mooshroom, a snow golem or a bogged, a brush on an armadillo or
- /// a suspicious block, shears carving a pumpkin, picking sweet berries or
- /// cave vines, a hit taking an item frame or its item, or untying a lead
- /// or cutting it with shears. `player` names them; `block` or `entity` says
- /// what dropped them. API 100. A mob that a player killed while
- /// leashed drops its lead on its next tick as a call of its own (`entity`
- /// the mob, `player` its killer, `table` empty, `used` false). API
- /// 102.
- pub(crate) used: bool,
-}
-
-/// A depth-tested outline of the client's block selection shape.
-#[derive(Clone, Copy, Debug, PartialEq)]
-pub(crate) struct NativeBlockRim {
- pub(crate) pos: [i32; 3],
- pub(crate) argb: u32,
- pub(crate) width: f32,
-}
-
-/// A camera-local visual light, with no gameplay light or shadow writes.
-#[derive(Clone, Copy, Debug, PartialEq)]
-pub(crate) struct NativeColoredLight {
- pub(crate) at: [f64; 3],
- pub(crate) rgb: u32,
- pub(crate) radius: f32,
- pub(crate) intensity: f32,
-}
-
-/// The zoom a native mod asks for (`native_zoom`): the factor (1 is none),
-/// eased through the field of view like the spyglass when `smooth`, and the
-/// scale of mouse turning.
-#[derive(Clone, Copy, Debug, PartialEq)]
-pub(crate) struct NativeZoom {
- pub(crate) factor: f32,
- pub(crate) smooth: bool,
- pub(crate) turn: f32,
-}
-
/// The camera shake native mods ask for (`native_camera_shake`): turns in
/// degrees, and an offset in blocks along the camera's right, up and back.
#[derive(Clone, Copy, Debug, Default, PartialEq)]