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

arismokodb483268db71
diff --cc crates/horizon-client/src/game/native_hooks.rs
index 4028c0b02,fd5a9f446..55df7e677
--- a/crates/horizon-client/src/game/native_hooks.rs
+++ b/crates/horizon-client/src/game/native_hooks.rs
@@@ -2551,8 -2580,35 +2551,35 @@@ impl Game<'_>
command: &str,
ran: &mut bool,
) {
- let _ = (player, command, ran);
+ mod_api::dispatch_perform_command(self, mod_api::mods(), player, command, ran);
}
+ /// `player` (`name`) changed dimension (NeoForge's
+ /// `PlayerChangedDimensionEvent`): `from` and `to` are dimension ids
+ /// (`minecraft:overworld`, `minecraft:the_nether`, `minecraft:the_end`).
+ /// Heard once per move, when it has ended: the portal's exit is found
+ /// and the player stands there (after the destination has loaded), a
+ /// command's teleport has landed, or a respawn in another level than the
+ /// death's is placed for good (a bed or anchor, or the world spawn's
+ /// free column, after the fallback when a respawn block was gone). The
+ /// level of `to` is the one in place, and the player's state is swapped
+ /// in, as for `native_perform_command`: `native_acting_player`,
+ /// `native_tell`, the item helpers and the rest reach them. Heard for:
+ /// Nether and End portals (also riding a vehicle, and leaving the End as
+ /// its winner), `/execute in ... run tp` and any other command that
+ /// teleports a player into another level, and the death respawn. Not
+ /// heard: a move within a level (`/tp`, an End gateway), a player who
+ /// leaves before the move ends, a move that ends where it started (a
+ /// respawn in the dimension of the death), and anything outside a
+ /// dedicated server. @API:native_player_changed_dimension@.
+ pub(super) fn native_player_changed_dimension(
+ &mut self,
+ player: u128,
+ name: &str,
+ from: &str,
+ to: &str,
+ ) {
+ let _ = (player, name, from, to);
+ }
/// A player's client started (`flying`) or stopped flying (vanilla's
/// `handlePlayerAbilities`, which honours it only for a player who may
/// fly: creative or spectator), heard once for each change, on a server,
@@@ -3427,8 -3466,46 +3454,46 @@@
count: u32,
canceled: &mut bool,
) {
- let _ = (player, item, count, canceled);
+ mod_api::dispatch_item_picked_up(self, mod_api::mods(), player, item, count, canceled);
}
+ /// Whether a mod hears `native_experience_orb_pickup`: set `listened`
+ /// (a HEAD injection), or the server skips swapping the player in for it,
+ /// and with this empty the pickup costs nothing more without mods.
+ /// Server-side. @API:experience_orb_pickup@.
+ pub(super) fn native_experience_orb_pickup_listened(&self, listened: &mut bool) {
+ let _ = listened;
+ }
+ /// Before `player` picks up orb `orb` in `dimension`. Mutations to `value`
+ /// and `count` take effect only when not canceled; value is clamped to
+ /// 1..=i32::MAX and count to at least one.
+ /// Canceling leaves the orb and pickup delay unchanged. Server-side.
+ /// @API:experience_orb_pickup@.
+ pub(super) fn native_experience_orb_pickup(
+ &mut self,
+ player: u128,
+ dimension: &str,
+ orb: u32,
+ value: &mut u32,
+ count: &mut u32,
+ canceled: &mut bool,
+ ) {
+ let _ = (player, dimension, orb, value, count, canceled);
+ }
+ /// The selected damaged Mending `stack` and the proposed durability repair
+ /// for `experience` points. The amount is clamped to the stack's current damage. Zero leaves the
+ /// experience unspent when it overrides a positive proposal. If the selected
+ /// stack changes, the repair is skipped.
+ /// Server-side, including `native_give_experience`.
+ /// @API:experience_orb_pickup@.
+ pub(super) fn native_mending_repair(
+ &mut self,
+ player: u128,
+ stack: &ItemStack,
+ experience: u32,
+ repair: &mut u32,
+ ) {
+ let _ = (player, stack, experience, repair);
+ }
/// A player's hit landed on the mob `entity` of type `kind`
/// (`minecraft:zombie`), holding `stack`: where `Item.hurtEnemy` is called,
/// before the post-attack enchantments and the weapon's wear. It only