mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 11:06:11 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe126cfbea |
No files matched your search
@@ -937,7 +937,7 @@ impl Game<'_> {
|
||||
self.capture(false);
|
||||
}
|
||||
/// The open chat box's text and its cursor, counted in characters; `None`
|
||||
/// while the chat screen isn't open. API @API:chat_input@.
|
||||
/// while the chat screen isn't open. API 557.
|
||||
#[allow(dead_code)]
|
||||
pub(super) fn native_chat_input(&self) -> Option<(String, usize)> {
|
||||
let screen = self.ui.chat_screen.as_ref()?;
|
||||
@@ -947,7 +947,7 @@ impl Game<'_> {
|
||||
/// (characters, clamped to the text), as an edit: completions refresh as
|
||||
/// they do for typing. What typing can't put in the box isn't put there
|
||||
/// either (`chat_box_text`), and the 256-character limit holds. An error
|
||||
/// while the chat screen isn't open. API @API:chat_input@.
|
||||
/// while the chat screen isn't open. API 557.
|
||||
#[allow(dead_code)]
|
||||
pub(super) fn native_set_chat_input(
|
||||
&mut self,
|
||||
|
||||
@@ -319,7 +319,7 @@ impl Game<'_> {
|
||||
}
|
||||
/// `native_fluid_insert`: up to `amount` millibuckets of `fluid`
|
||||
/// (`minecraft:water`, `minecraft:lava`, or since API
|
||||
/// @API:mod_fluids@ a mod's own, `create:chocolate`) into the block at
|
||||
/// 423 a mod's own, `create:chocolate`) into the block at
|
||||
/// `pos`, through its side `face`, in the level in place: a mod block's
|
||||
/// tanks first those with the same fluid, then empty ones, by the sides
|
||||
/// and tanks its table gave and every fillable tank that accepts the
|
||||
|
||||
@@ -224,7 +224,7 @@ impl BlockEntityDraw {
|
||||
/// with a new speed, pass the phase that keeps the part where it was
|
||||
/// (`old_angle - game_time * new_speed`), or it jumps. Until
|
||||
/// `still` or the next `spin`. A block entity's frame only: a mob's
|
||||
/// (`native_mob_submit`) draws it at rest. API @API:spinning_geometry@.
|
||||
/// (`native_mob_submit`) draws it at rest. API 421.
|
||||
pub fn spin(&mut self, axis: [f32; 3], pivot: [f32; 3], degrees_per_tick: f32, phase: f32) {
|
||||
let spin = Spin {
|
||||
axis: Vec3::from_array(axis).normalize_or(Vec3::Y),
|
||||
@@ -239,7 +239,7 @@ impl BlockEntityDraw {
|
||||
self.spins.push((self.vertices.len(), Some(spin)));
|
||||
}
|
||||
/// What is drawn next stands still again, after `spin`.
|
||||
/// API @API:spinning_geometry@.
|
||||
/// API 421.
|
||||
pub fn still(&mut self) {
|
||||
self.spins.push((self.vertices.len(), None));
|
||||
}
|
||||
@@ -578,7 +578,7 @@ impl Game<'_> {
|
||||
/// `glowing` text is full bright (a glow ink sac's), the rest lit by
|
||||
/// `draw.light`; a nonzero 0xRRGGBB `outline` rings each glyph, as glowing
|
||||
/// sign text's. Returns the width drawn, in font pixels: centre a line
|
||||
/// by starting it at minus half its width. API @API:draw_text@.
|
||||
/// by starting it at minus half its width. API 419.
|
||||
pub(super) fn native_draw_text(
|
||||
&self,
|
||||
draw: &mut BlockEntityDraw,
|
||||
@@ -716,7 +716,7 @@ impl Game<'_> {
|
||||
/// its front towards -z, its feet 24 texels down): in `native_mob_submit`,
|
||||
/// `draw.scale([1.0, -1.0, -1.0])` then `draw.translate([0.0, -1.501,
|
||||
/// 0.0])` first, as `LivingEntityRenderer` does. False for an unknown
|
||||
/// sprite. API @API:model_layers@.
|
||||
/// sprite. API 434.
|
||||
pub(super) fn native_draw_model_part(
|
||||
&self,
|
||||
draw: &mut BlockEntityDraw,
|
||||
@@ -739,7 +739,7 @@ impl Game<'_> {
|
||||
/// once, as a renderer does, and set its parts' poses each frame. None
|
||||
/// for a layer neither has. A vanilla layer no mob has (a player's, a
|
||||
/// chest's) is read from the resources each call, so slow. API
|
||||
/// @API:model_layers@.
|
||||
/// 434.
|
||||
pub(super) fn native_bake_layer(&self, layer: &str) -> Option<ModelPart> {
|
||||
if let Some(definition) = model_layers::registered(layer) {
|
||||
return Some(definition.bake_root());
|
||||
|
||||
@@ -33,7 +33,7 @@ impl Game<'_> {
|
||||
/// `native_draw_quad` take, and that face's
|
||||
/// tint index (-1 for none): a copycat block drawing a box of its material's textures with `native_draw_cube`,
|
||||
/// kept with `BlockEntityDraw::keep`. The face culled against that side comes first, else the first facing it;
|
||||
/// None when the model has no face that way or isn't baked. API @API:block_face_sprite@.
|
||||
/// None when the model has no face that way or isn't baked. API 418.
|
||||
pub(super) fn native_block_face_sprite(
|
||||
&self,
|
||||
state: BlockStateId,
|
||||
@@ -60,7 +60,7 @@ impl Game<'_> {
|
||||
}
|
||||
/// For a client mod: every block state by its id, with its facts, what its model draws on each side and the
|
||||
/// texture behind each sprite, as the resources loaded now; a copy to keep and use on any thread. Ask again when
|
||||
/// `native_block_sprites_version` changes. API @API:block_appearance@.
|
||||
/// `native_block_sprites_version` changes. API 455.
|
||||
pub(super) fn native_block_states(&self) -> BlockStates {
|
||||
BlockStates::new(
|
||||
self.res.facts(),
|
||||
@@ -71,7 +71,7 @@ impl Game<'_> {
|
||||
}
|
||||
/// For a client mod: the files of the resources loaded now, resource packs' over vanilla's, to read textures
|
||||
/// and other resources on any thread. Ask again when `native_block_sprites_version` changes. API
|
||||
/// @API:block_appearance@.
|
||||
/// 455.
|
||||
pub(super) fn native_client_resources(&self) -> ClientResources {
|
||||
ClientResources::new(self.options.resources.clone())
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ impl Game<'_> {
|
||||
/// None off a server, for a player not here (another level than the one in place, a
|
||||
/// guest out of reach inside another player's hook, where the hub is taken out), dead, a
|
||||
/// spectator or riding, an input that is not a number, and when the movement code fails.
|
||||
/// API @API:player_bots@.
|
||||
/// API 452.
|
||||
pub(super) fn native_simulate_player_move(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -151,7 +151,7 @@ impl Game<'_> {
|
||||
/// snow as for nothing standing on them). Entities and the world border are not in it. For a
|
||||
/// bot's own collision checks and pathfinding. Empty off a server, for another level than the
|
||||
/// one in place, a box that isn't a box (not numbers, or min past max), and one over about a
|
||||
/// million blocks. API @API:player_bots@.
|
||||
/// million blocks. API 452.
|
||||
pub(super) fn native_collision_boxes(&self, dimension: &str, aabb: [f64; 6]) -> Vec<[f64; 6]> {
|
||||
let Some(bounds) = aabb_of(aabb) else {
|
||||
return Vec::new();
|
||||
|
||||
@@ -79,7 +79,7 @@ impl Game<'_> {
|
||||
/// A snapshot of loaded chunk `chunk` (`[x, z]`) of the level `dimension`
|
||||
/// (`minecraft:the_nether`), in place or open with nobody in it. None off
|
||||
/// a server, for a level not open and for a chunk not loaded; nothing is
|
||||
/// loaded or generated for it. API @API:chunk_snapshot@.
|
||||
/// loaded or generated for it. API 458.
|
||||
pub(super) fn native_chunk_snapshot(
|
||||
&self,
|
||||
dimension: &str,
|
||||
@@ -111,7 +111,7 @@ impl Game<'_> {
|
||||
/// The map colour of block state `state` (`BlockState.getMapColor`):
|
||||
/// `(id, colour)`, the `MapColor` id and its `col` (0xRRGGBB), `(0, 0)`
|
||||
/// for `MapColor.NONE` (air, glass). None for an unknown state. API
|
||||
/// @API:chunk_snapshot@.
|
||||
/// 458.
|
||||
pub(super) fn native_block_map_color(&self, state: BlockStateId) -> Option<(u8, u32)> {
|
||||
let known = usize::try_from(state.0).is_ok_and(|s| s < self.pack.assets.registry.len());
|
||||
if !known {
|
||||
@@ -123,7 +123,7 @@ impl Game<'_> {
|
||||
|
||||
/// The name of biome id `biome` (`minecraft:plains`), as a snapshot's
|
||||
/// `noise_biome` gives it. None for an unknown id. API
|
||||
/// @API:chunk_snapshot@.
|
||||
/// 458.
|
||||
pub(super) fn native_biome_name(&self, biome: u16) -> Option<&str> {
|
||||
let biomes = world_biomes!(self);
|
||||
biomes.list.get(usize::from(biome)).map(|b| b.name.as_str())
|
||||
@@ -134,7 +134,7 @@ impl Game<'_> {
|
||||
/// modifiers), foliage, dry foliage and water, after
|
||||
/// `native_biome_colors`. The biome's own, not blended over the biome
|
||||
/// blend radius as the client draws them. None for an unknown id. API
|
||||
/// @API:chunk_snapshot@.
|
||||
/// 458.
|
||||
pub(super) fn native_biome_tint(&self, biome: u16, x: i32, z: i32) -> Option<BiomeColors> {
|
||||
let biomes = world_biomes!(self);
|
||||
let b = biomes.list.get(usize::from(biome))?;
|
||||
|
||||
@@ -122,7 +122,7 @@ impl Game<'_> {
|
||||
|
||||
/// An entity id no entity of this server will take
|
||||
/// (`Entity.nextEntityId`'s counter), for a mod's own packets to a
|
||||
/// client. API @API:client_entities@.
|
||||
/// client. API 517.
|
||||
pub(super) fn native_reserve_entity_id(&mut self) -> i32 {
|
||||
self.take_entity_id() as i32
|
||||
}
|
||||
@@ -140,7 +140,7 @@ impl Game<'_> {
|
||||
/// `_move` and `_remove`. None when `viewer` isn't on, for an unknown
|
||||
/// type, a player, a position or yaw that isn't finite, and inside a
|
||||
/// player's hook where the server is out of reach. Bukkit has no such API
|
||||
/// (plugins send the packets). API @API:client_entities@.
|
||||
/// (plugins send the packets). API 517.
|
||||
pub(super) fn native_client_entity_spawn(
|
||||
&mut self,
|
||||
viewer: u128,
|
||||
@@ -194,7 +194,7 @@ impl Game<'_> {
|
||||
/// display's `start_interpolation` is sent with it, so a changed
|
||||
/// transformation eases over `interpolation_duration`. False when it is
|
||||
/// not their client-side entity, and where the server is out of reach.
|
||||
/// API @API:client_entities@.
|
||||
/// API 517.
|
||||
pub(super) fn native_client_entity_set(
|
||||
&mut self,
|
||||
viewer: u128,
|
||||
@@ -214,7 +214,7 @@ impl Game<'_> {
|
||||
/// (`ClientboundTeleportEntityPacket`, absolute; a display eases over its
|
||||
/// `teleport_duration`). False when it is not their client-side entity,
|
||||
/// for a position or yaw that isn't finite, and where the server is out
|
||||
/// of reach. API @API:client_entities@.
|
||||
/// of reach. API 517.
|
||||
pub(super) fn native_client_entity_move(
|
||||
&mut self,
|
||||
viewer: u128,
|
||||
@@ -244,7 +244,7 @@ impl Game<'_> {
|
||||
/// (`ClientboundRemoveEntitiesPacket`); ids that are not theirs are left
|
||||
/// alone (an entity the server tracks is hidden with
|
||||
/// `native_hide_entity_from`). False when none of them was theirs, and
|
||||
/// where the server is out of reach. API @API:client_entities@.
|
||||
/// where the server is out of reach. API 517.
|
||||
pub(super) fn native_client_entity_remove(&mut self, viewer: u128, ids: &[i32]) -> bool {
|
||||
let Some(host) = &mut self.lan else {
|
||||
return false;
|
||||
|
||||
@@ -29,7 +29,7 @@ impl Game<'_> {
|
||||
/// color or size values in `velocity`. Normal distance, settings and population
|
||||
/// limits still apply. True means submitted, not necessarily visible: an unknown
|
||||
/// provider or missing sprite set draws nothing. False on a server, without a
|
||||
/// client player/level, or for non-finite numeric input. API @API:client_particles@.
|
||||
/// client player/level, or for non-finite numeric input. API 451.
|
||||
pub(super) fn native_add_particle(
|
||||
&mut self,
|
||||
options: &ParticleOptions,
|
||||
|
||||
@@ -42,15 +42,15 @@ pub struct NativeClientState {
|
||||
pub yaw: f32,
|
||||
pub pitch: f32,
|
||||
pub menu_blur: f32,
|
||||
/// What covers the world. API @API:session_state@.
|
||||
/// What covers the world. API 559.
|
||||
pub screen: NativeScreenKind,
|
||||
/// F3's debug screen is showing (`DebugScreenOverlay.showDebugScreen`).
|
||||
/// API @API:session_state@.
|
||||
/// API 559.
|
||||
pub debug_screen: bool,
|
||||
/// The world joined, None before one is. API @API:session_state@.
|
||||
/// The world joined, None before one is. API 559.
|
||||
pub world: Option<NativeWorldId>,
|
||||
/// The head of the bed the player sleeps in, as the server says
|
||||
/// (`LivingEntity.getSleepingPos`). API @API:session_state@.
|
||||
/// (`LivingEntity.getSleepingPos`). API 559.
|
||||
pub sleeping_pos: Option<[i32; 3]>,
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ pub struct NativeClientEntity {
|
||||
pub head_pitch: f32,
|
||||
pub alive: bool,
|
||||
pub invisible: bool,
|
||||
/// Its entity type (`minecraft:zombie`). API @API:client_entity_list@.
|
||||
/// Its entity type (`minecraft:zombie`). API 556.
|
||||
pub kind: String,
|
||||
/// `Entity.getYRot` in degrees, 0 facing south and 90 west.
|
||||
pub yaw: f32,
|
||||
@@ -163,13 +163,13 @@ pub struct NativeClientEntity {
|
||||
|
||||
impl NativeClientEntity {
|
||||
/// Where this frame draws it (`Entity.getPosition(partialTick)`), given
|
||||
/// `NativeClientState::world_partial_tick`. API @API:client_entity_list@.
|
||||
/// `NativeClientState::world_partial_tick`. API 556.
|
||||
pub fn position_at(&self, partial_tick: f64) -> [f64; 3] {
|
||||
position_at(self.previous_position, self.position, partial_tick)
|
||||
}
|
||||
}
|
||||
|
||||
/// A dropped item the client shows. API @API:client_entity_list@.
|
||||
/// A dropped item the client shows. API 556.
|
||||
#[derive(Clone, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct NativeClientItem {
|
||||
@@ -223,7 +223,7 @@ impl Game<'_> {
|
||||
/// vanilla's file name, and the same "Saved screenshot as" line in chat.
|
||||
/// The file it will write, as a path string; an error without a window to draw, or while
|
||||
/// another screenshot waits for the frame (F2's, an agent's, the world
|
||||
/// icon's), which a mod's would replace. API @API:take_screenshot@.
|
||||
/// icon's), which a mod's would replace. API 555.
|
||||
pub(super) fn native_take_screenshot(&mut self) -> Result<String, String> {
|
||||
let Some(renderer) = self.renderer.as_ref() else {
|
||||
return Err("no window to take it from".into());
|
||||
@@ -304,7 +304,7 @@ impl Game<'_> {
|
||||
.collect()
|
||||
}
|
||||
/// The dropped items the server shows this window, by the same rules as
|
||||
/// `native_client_entities`. API @API:client_entity_list@.
|
||||
/// `native_client_entities`. API 556.
|
||||
pub(super) fn native_client_items(&self) -> Vec<NativeClientItem> {
|
||||
if !self.native_window() || self.remote.is_none() {
|
||||
return Vec::new();
|
||||
@@ -325,7 +325,7 @@ impl Game<'_> {
|
||||
/// downloaded skin while the client holds it, else
|
||||
/// `native_client_resources().texture(name)`. Decodes on each call; None
|
||||
/// on a server or for a texture it can't read. API
|
||||
/// @API:client_entity_list@.
|
||||
/// 556.
|
||||
pub(super) fn native_client_texture(&self, texture: &str) -> Option<TexturePixels> {
|
||||
if !self.native_window() {
|
||||
return None;
|
||||
|
||||
@@ -177,7 +177,7 @@ impl Game<'_> {
|
||||
/// either order) as they are now, to read on any thread, shared with the world rather than copied. On a client
|
||||
/// of a server it is what the server sent. `Err`, taking nothing, on a server, which has no client world, or for
|
||||
/// an area of more than 66,049 chunks (the square a render distance of 128 loads). API
|
||||
/// @API:client_world_snapshots@.
|
||||
/// 453.
|
||||
pub(super) fn native_client_chunks(
|
||||
&self,
|
||||
from: [i32; 2],
|
||||
@@ -193,7 +193,7 @@ impl Game<'_> {
|
||||
/// world differs from the snapshot's now: written to since it was taken (blocks, biomes or light, even a write
|
||||
/// that left them the same), or loaded or unloaded where the snapshot had them the other way. Empty when the
|
||||
/// snapshot's blocks and biomes are the world's; their tints are `native_client_biomes_changed`'s. API
|
||||
/// @API:client_world_snapshots@.
|
||||
/// 453.
|
||||
pub(super) fn native_client_chunks_changed(
|
||||
&self,
|
||||
snapshot: &NativeClientChunks,
|
||||
@@ -202,7 +202,7 @@ impl Game<'_> {
|
||||
}
|
||||
|
||||
/// For a client mod: the biome table the client world's terrain is drawn with, for the ids its snapshots read.
|
||||
/// None on a server. API @API:client_world_snapshots@.
|
||||
/// None on a server. API 453.
|
||||
pub(super) fn native_client_biomes(&self) -> Option<NativeClientBiomes> {
|
||||
self.native_window()
|
||||
.then(|| NativeClientBiomes(self.worker_context().biomes.clone()))
|
||||
@@ -211,7 +211,7 @@ impl Game<'_> {
|
||||
/// For a client mod: whether the terrain is now drawn with another biome table than `biomes`: a mod recoloured
|
||||
/// the biomes (`native_refresh_biome_colors`, a season), the resources loaded again or another world opened.
|
||||
/// Then what was tinted from `biomes` is out of date, even where no chunk changed. API
|
||||
/// @API:client_world_snapshots@.
|
||||
/// 453.
|
||||
pub(super) fn native_client_biomes_changed(&self, biomes: &NativeClientBiomes) -> bool {
|
||||
// `biomes` holds its table, so the game replaces it rather than edit it: the same allocation is the same table.
|
||||
!Arc::ptr_eq(&biomes.0, &self.worker_context().biomes)
|
||||
|
||||
@@ -91,7 +91,7 @@ impl Game<'_> {
|
||||
|
||||
/// `native_trigger_criterion` with its test behind a reference, as a
|
||||
/// trait mod calls it through `dyn Host`: the same players, criteria and
|
||||
/// answer. API @API:host_bridge@.
|
||||
/// answer. API 414.
|
||||
pub(super) fn native_trigger_mod_criterion(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
|
||||
@@ -18,7 +18,7 @@ impl Game<'_> {
|
||||
/// `MinecraftServer.getTickTimesNanos` lays them out: the tick numbered
|
||||
/// `n` at index `n % 100` (0 where none was recorded yet). Sort a copy
|
||||
/// for percentiles; the average is `native_tick_stats`'. On a client, its
|
||||
/// own ticks. API @API:tick_times@.
|
||||
/// own ticks. API 552.
|
||||
pub(super) fn native_tick_times(&self) -> Vec<u64> {
|
||||
self.clock.tick_times_nanos()
|
||||
}
|
||||
@@ -26,7 +26,7 @@ impl Game<'_> {
|
||||
/// (Bukkit's `Server.getTPS`), measured between the ends of the recorded
|
||||
/// ticks and averaged once a second as a load average is; 20 at the
|
||||
/// start. A sprint reads more than the rate, a server that falls behind
|
||||
/// less. API @API:tick_times@.
|
||||
/// less. API 552.
|
||||
pub(super) fn native_tps(&self) -> [f64; 3] {
|
||||
self.clock.tps()
|
||||
}
|
||||
@@ -37,7 +37,7 @@ impl Game<'_> {
|
||||
/// are those the hub holds, so inside a player's own hook (the hub taken
|
||||
/// out) none are counted. A walk over every entity: once a second or
|
||||
/// less, not every tick. None on a client and for a level that isn't
|
||||
/// open. API @API:level_stats@.
|
||||
/// open. API 527.
|
||||
pub(super) fn native_level_stats(&mut self, dimension: &str) -> Option<NativeLevelStats> {
|
||||
let dim = self.diagnosed_level(dimension)?;
|
||||
self.with_level_in_place(dim, |game| {
|
||||
@@ -62,7 +62,7 @@ impl Game<'_> {
|
||||
/// Every entity of the open level `dimension`: its id (the one events
|
||||
/// and `native_entity` take), its type and its position, players
|
||||
/// included (as `native_level_stats` counts them). Empty on a client and
|
||||
/// for a level that isn't open. API @API:level_stats@.
|
||||
/// for a level that isn't open. API 527.
|
||||
pub(super) fn native_level_entities(
|
||||
&mut self,
|
||||
dimension: &str,
|
||||
@@ -77,7 +77,7 @@ impl Game<'_> {
|
||||
/// its type, the vanilla block entity type of its block (`minecraft:chest`,
|
||||
/// `minecraft:barrel`, `minecraft:mob_spawner`), else the block's name (a
|
||||
/// mod's). Empty on a client and for a level that isn't open. API
|
||||
/// @API:level_stats@.
|
||||
/// 527.
|
||||
pub(super) fn native_level_block_entities(&self, dimension: &str) -> Vec<([i32; 3], String)> {
|
||||
let world = match self.diagnosed_level(dimension) {
|
||||
Some(dim) if dim == self.dim => Some(&self.world),
|
||||
@@ -91,7 +91,7 @@ impl Game<'_> {
|
||||
/// `native_server_packets`, from now on: while on, each packet costs the
|
||||
/// network thread a lock and a list entry, so turn it on for a session
|
||||
/// and off after. Off drops what is kept. A switch for the whole server,
|
||||
/// shared by every mod. API @API:server_packets@.
|
||||
/// shared by every mod. API 547.
|
||||
pub(super) fn native_count_packets(&self, on: bool) {
|
||||
horizon_client::lan::conn::count_packets(on);
|
||||
if !on {
|
||||
@@ -128,7 +128,7 @@ impl Game<'_> {
|
||||
/// `HORIZON_SPIKES`, performance reports and every mod: spans stay on
|
||||
/// while anyone wants them. Spans are recorded on every thread (two clock
|
||||
/// reads a step): turn them on for a profiling session and off after.
|
||||
/// Only on a server. API @API:server_tick_timed@.
|
||||
/// Only on a server. API 548.
|
||||
pub(super) fn native_spans(&self, on: bool) {
|
||||
if self.native_authoritative() {
|
||||
tick_profile::want_spans(tick_profile::SPANS_MOD, on);
|
||||
@@ -140,12 +140,12 @@ impl Game<'_> {
|
||||
/// read off. Sampled apart from a performance report's, so both can run.
|
||||
/// For a lighter profile, turn it on in `ServerTickStart` of one tick in
|
||||
/// N and off after. Call it from a server hook (it belongs to the server
|
||||
/// thread). API @API:server_tick_timed@.
|
||||
/// thread). API 548.
|
||||
pub(super) fn native_mob_cost_sampling(&self, on: bool) {
|
||||
tick_profile::set_mod_sampling(on);
|
||||
}
|
||||
/// The mob costs sampled since the last call (`native_mob_cost_sampling`),
|
||||
/// costliest first; clears them. API @API:server_tick_timed@.
|
||||
/// costliest first; clears them. API 548.
|
||||
pub(super) fn native_take_mob_costs(&self) -> Vec<NativeMobCost> {
|
||||
tick_profile::take_mod()
|
||||
.into_iter()
|
||||
|
||||
@@ -207,7 +207,7 @@ impl Game<'_> {
|
||||
/// client's copy of the world, for a position outside
|
||||
/// `/summon`'s bounds, a chunk that isn't loaded, a kind Horizon can't
|
||||
/// load, or one a mod kept out (`native_entity_join_level`). API
|
||||
/// 59. Since API @API:npc_any_level@, `dimension` may be any level the
|
||||
/// 59. Since API 533, `dimension` may be any level the
|
||||
/// server has loaded, which is put in place for the summon (`execute in
|
||||
/// <dimension> run summon`); a level not loaded is refused.
|
||||
pub(super) fn native_summon(
|
||||
@@ -336,7 +336,7 @@ impl Game<'_> {
|
||||
/// Removes entity `id`, one Horizon keeps without simulating, as `/kill`
|
||||
/// does (it drops nothing and isn't saved). False for no such entity or
|
||||
/// another dimension. Mobs go with `native_remove_mob`. API
|
||||
/// 59. Since API @API:remove_projectiles@ it also takes projectiles
|
||||
/// 59. Since API 541 it also takes projectiles
|
||||
/// (arrows, tridents, snowballs, eggs, pearls, fireballs, wind charges,
|
||||
/// llama spit, shulker bullets, firework rockets) as `/kill` does, and a
|
||||
/// server player's fishing bobber (`Entity.discard`; the player in place's,
|
||||
@@ -370,7 +370,7 @@ impl Game<'_> {
|
||||
/// hooks (`native_living_incoming_damage` and its versions) hear it. Whether it was hurt:
|
||||
/// false for an invulnerable, dead or creative target, another dimension, an entity that
|
||||
/// isn't living, an attacker that isn't there, or an amount that isn't a finite number.
|
||||
/// API @API:hurt_entity@.
|
||||
/// API 522.
|
||||
pub(super) fn native_hurt_entity(
|
||||
&mut self,
|
||||
dimension: &str,
|
||||
|
||||
@@ -92,7 +92,7 @@ impl Game<'_> {
|
||||
}
|
||||
/// The entity's name as plain text (`Entity.getName`): its custom name,
|
||||
/// a player's name, else its type's name. On a client (API
|
||||
/// @API:client_entity_refs@), from the custom name the server synced
|
||||
/// 426), from the custom name the server synced
|
||||
/// (`Entity.DATA_CUSTOM_NAME`) and a player's profile name. API
|
||||
/// 386.
|
||||
pub(super) fn native_entity_name(&self, entity: EntityRef) -> Option<String> {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! `EntityRef` (docs/native-mods.md, "Entity and level handles", #7387):
|
||||
//! velocity, ground, box, eyes and view. They read the entity a handle names
|
||||
//! as `native_entity_refs.rs` finds it, and return `None` (or `false`) for a
|
||||
//! stale handle. On a client (API @API:client_entity_refs@) they read the
|
||||
//! stale handle. On a client (API 426) they read the
|
||||
//! entities the server shows the window, and nothing moves one.
|
||||
use super::entity::{Entity as _, EntityHandle, with_entity, with_entity_mut};
|
||||
use super::{Game, commands::Target};
|
||||
|
||||
@@ -18,7 +18,7 @@ impl Game<'_> {
|
||||
/// Moves the entity to `pos` in its level (`Entity.teleportTo`), as
|
||||
/// `/tp` does: a player is placed there and told, a rider gets off. With
|
||||
/// `rotation` (yaw, pitch in degrees) it also turns. False for a position
|
||||
/// outside the world's bounds. API @API:entity_moves@.
|
||||
/// outside the world's bounds. API 568.
|
||||
pub(super) fn native_entity_teleport_to(
|
||||
&mut self,
|
||||
entity: EntityRef,
|
||||
@@ -36,7 +36,7 @@ impl Game<'_> {
|
||||
}
|
||||
/// Turns the entity to `yaw` and `pitch` in degrees (`Entity.setYRot`,
|
||||
/// `setXRot`), as `/rotate` does: the pitch is clamped to -90..90, and a
|
||||
/// player's client is told. API @API:entity_moves@.
|
||||
/// player's client is told. API 568.
|
||||
pub(super) fn native_entity_set_rotation(
|
||||
&mut self,
|
||||
entity: EntityRef,
|
||||
@@ -54,7 +54,7 @@ impl Game<'_> {
|
||||
}
|
||||
/// The yaw of the entity's head (`Entity.getYHeadRot`): a mob's or a
|
||||
/// player's own, the body's yaw for the kinds without a head. API
|
||||
/// @API:entity_moves@.
|
||||
/// 568.
|
||||
pub(super) fn native_entity_head_yaw(&self, entity: EntityRef) -> Option<f32> {
|
||||
let t = self.native_entity_target(entity)?;
|
||||
if let Some(g) = self.native_target_guest(t) {
|
||||
@@ -66,7 +66,7 @@ impl Game<'_> {
|
||||
Some(self.target_rotation(t)[0])
|
||||
}
|
||||
/// Turns a mob's head to `yaw` (`Entity.setYHeadRot`); its body follows
|
||||
/// as its AI turns it. False for the other kinds. API @API:entity_moves@.
|
||||
/// as its AI turns it. False for the other kinds. API 568.
|
||||
pub(super) fn native_entity_set_head_yaw(&mut self, entity: EntityRef, yaw: f32) -> bool {
|
||||
let Some(Target::Mob(id)) = self.native_entity_target(entity) else {
|
||||
return false;
|
||||
@@ -81,14 +81,14 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
/// The horizontal direction the entity faces (`Entity.getDirection`):
|
||||
/// `north`, `south`, `east` or `west`. API @API:entity_moves@.
|
||||
/// `north`, `south`, `east` or `west`. API 568.
|
||||
pub(super) fn native_entity_direction(&self, entity: EntityRef) -> Option<&'static str> {
|
||||
let t = self.native_entity_target(entity)?;
|
||||
Some(facing(self.target_rotation(t)[0]))
|
||||
}
|
||||
/// The entity's width and height (`Entity.getBbWidth`, `getBbHeight`):
|
||||
/// its box's, so a baby's or a scaled entity's own. API
|
||||
/// @API:entity_moves@.
|
||||
/// 568.
|
||||
pub(super) fn native_entity_dimensions(&self, entity: EntityRef) -> Option<[f64; 2]> {
|
||||
let [min, max] = self.native_entity_bounding_box(entity)?;
|
||||
Some([max[0] - min[0], max[1] - min[1]])
|
||||
@@ -96,7 +96,7 @@ impl Game<'_> {
|
||||
/// Adds `delta` to the entity's velocity (`Entity.push`,
|
||||
/// `addDeltaMovement`). False for a player (its client moves it), an
|
||||
/// entity Horizon doesn't simulate, or a value that isn't finite. API
|
||||
/// @API:entity_moves@.
|
||||
/// 568.
|
||||
pub(super) fn native_entity_push(&mut self, entity: EntityRef, delta: [f64; 3]) -> bool {
|
||||
if !delta.iter().all(|v| v.is_finite()) || self.native_entity_target(entity).is_none() {
|
||||
return false;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! into an `EntityRef`, and each `native_entity_*` helper reads the entity a
|
||||
//! handle names. On a server the entities are those of the level in place
|
||||
//! (the one a hook runs in) and the server's players, whatever their level.
|
||||
//! On a client (API @API:client_entity_refs@) they are the entities the
|
||||
//! On a client (API 426) they are the entities the
|
||||
//! server shows this window, read from what it synced: positions, rotations,
|
||||
//! types, UUIDs, custom names and equipment, never saved data or tags. With
|
||||
//! no world open, or for a handle of an earlier open (on a client, of an
|
||||
@@ -58,7 +58,7 @@ impl Game<'_> {
|
||||
/// The entity `id` (the id events carry) as a handle for the `entity_*`
|
||||
/// methods: None with no world open, or for no such entity in the level
|
||||
/// in place or among the server's players. On a client (API
|
||||
/// @API:client_entity_refs@), any entity the server shows this window,
|
||||
/// 426), any entity the server shows this window,
|
||||
/// this window's own player included. API 373.
|
||||
pub(super) fn native_entity(&self, id: u32) -> Option<EntityRef> {
|
||||
let epoch = match &self.remote {
|
||||
|
||||
@@ -71,7 +71,7 @@ impl Game<'_> {
|
||||
})
|
||||
}
|
||||
/// Whether the player holds the sneak key (`Entity.isShiftKeyDown`);
|
||||
/// false for the other kinds. API @API:entity_state@.
|
||||
/// false for the other kinds. API 567.
|
||||
pub(super) fn native_entity_is_shift_key_down(&self, entity: EntityRef) -> Option<bool> {
|
||||
Some(match self.native_entity_body(entity)? {
|
||||
Body::Player(p) => p.shift_key_down,
|
||||
@@ -79,12 +79,12 @@ impl Game<'_> {
|
||||
})
|
||||
}
|
||||
/// Whether the entity crouches (`Entity.isCrouching`: the crouching
|
||||
/// pose). API @API:entity_state@.
|
||||
/// pose). API 567.
|
||||
pub(super) fn native_entity_is_crouching(&self, entity: EntityRef) -> Option<bool> {
|
||||
Some(self.native_entity_pose(entity)? == "crouching")
|
||||
}
|
||||
/// Whether the player sprints (`Entity.isSprinting`); false for the
|
||||
/// other kinds. API @API:entity_state@.
|
||||
/// other kinds. API 567.
|
||||
pub(super) fn native_entity_is_sprinting(&self, entity: EntityRef) -> Option<bool> {
|
||||
Some(match self.native_entity_body(entity)? {
|
||||
Body::Player(p) => p.sprinting,
|
||||
@@ -92,7 +92,7 @@ impl Game<'_> {
|
||||
})
|
||||
}
|
||||
/// Whether the entity touched water at its last fluid update
|
||||
/// (`Entity.isInWater`): players and mobs. API @API:entity_state@.
|
||||
/// (`Entity.isInWater`): players and mobs. API 567.
|
||||
pub(super) fn native_entity_is_in_water(&self, entity: EntityRef) -> Option<bool> {
|
||||
match self.native_entity_body(entity)? {
|
||||
Body::Player(p) => Some(p.fluids.was_touching_water),
|
||||
@@ -101,7 +101,7 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
/// Whether the entity is in lava (`Entity.isInLava`): players and mobs.
|
||||
/// API @API:entity_state@.
|
||||
/// API 567.
|
||||
pub(super) fn native_entity_is_in_lava(&self, entity: EntityRef) -> Option<bool> {
|
||||
match self.native_entity_body(entity)? {
|
||||
Body::Player(p) => Some(p.is_in_lava()),
|
||||
@@ -110,7 +110,7 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
/// Whether the entity's type never burns (`EntityType.fireImmune`):
|
||||
/// players and mobs. API @API:entity_state@.
|
||||
/// players and mobs. API 567.
|
||||
pub(super) fn native_entity_fire_immune(&self, entity: EntityRef) -> Option<bool> {
|
||||
match self.native_entity_body(entity)? {
|
||||
Body::Player(_) => Some(false),
|
||||
@@ -119,7 +119,7 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
/// The ticks the entity burns for (`Entity.getRemainingFireTicks`):
|
||||
/// players, mobs, armor stands and items. API @API:entity_state@.
|
||||
/// players, mobs, armor stands and items. API 567.
|
||||
pub(super) fn native_entity_fire_ticks(&self, entity: EntityRef) -> Option<i32> {
|
||||
match self.native_entity_body(entity)? {
|
||||
Body::Player(p) => Some(p.fire_ticks),
|
||||
@@ -134,7 +134,7 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
/// The entity's air (`Entity.getAirSupply`): players and mobs. API
|
||||
/// @API:entity_state@.
|
||||
/// 567.
|
||||
pub(super) fn native_entity_air_supply(&self, entity: EntityRef) -> Option<i32> {
|
||||
match self.native_entity_body(entity)? {
|
||||
Body::Player(p) => Some(p.air),
|
||||
@@ -143,7 +143,7 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
/// The most air the entity holds (`Entity.getMaxAirSupply`): 300, a
|
||||
/// dolphin's 4800, an axolotl's 6000. API @API:entity_state@.
|
||||
/// dolphin's 4800, an axolotl's 6000. API 567.
|
||||
pub(super) fn native_entity_max_air_supply(&self, entity: EntityRef) -> Option<i32> {
|
||||
match self.native_entity_body(entity)? {
|
||||
Body::Mob(m) => Some(max_air(Some(m.species()))),
|
||||
@@ -151,7 +151,7 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
/// Whether the mob makes no sounds (`Entity.isSilent`, its `Silent`
|
||||
/// tag); false for a player. API @API:entity_state@.
|
||||
/// tag); false for a player. API 567.
|
||||
pub(super) fn native_entity_is_silent(&self, entity: EntityRef) -> Option<bool> {
|
||||
match self.native_entity_body(entity)? {
|
||||
Body::Player(_) => Some(false),
|
||||
@@ -160,7 +160,7 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
/// Silences the mob or lets it make sounds again (`Entity.setSilent`).
|
||||
/// False for the other kinds. API @API:entity_state@.
|
||||
/// False for the other kinds. API 567.
|
||||
pub(super) fn native_entity_set_silent(&mut self, entity: EntityRef, silent: bool) -> bool {
|
||||
let Some(Target::Mob(id)) = self.native_entity_target(entity) else {
|
||||
return false;
|
||||
@@ -176,7 +176,7 @@ impl Game<'_> {
|
||||
/// Whether the entity's model is hidden (`Entity.isInvisible`): the
|
||||
/// invisibility effect on a player or a mob, a mob's or an armor stand's
|
||||
/// flag.
|
||||
/// API @API:entity_state@.
|
||||
/// API 567.
|
||||
pub(super) fn native_entity_is_invisible(&self, entity: EntityRef) -> Option<bool> {
|
||||
match self.native_entity_target(entity)? {
|
||||
Target::Player => Some(self.potions.effects.get("invisibility").is_some()),
|
||||
@@ -196,7 +196,7 @@ impl Game<'_> {
|
||||
}
|
||||
/// The entity's pose (`Entity.getPose`) as `Pose` names it: `standing`,
|
||||
/// `crouching`, `swimming`, `sleeping`, a warden's `roaring`... Kinds
|
||||
/// with no pose stand. API @API:entity_state@.
|
||||
/// with no pose stand. API 567.
|
||||
pub(super) fn native_entity_pose(&self, entity: EntityRef) -> Option<&'static str> {
|
||||
Some(match self.native_entity_body(entity)? {
|
||||
Body::Player(p) => player_pose(p.pose),
|
||||
|
||||
@@ -18,7 +18,7 @@ impl Game<'_> {
|
||||
/// The actual animated block sprite is sampled with mipmaps. Faces are sorted, alpha blended,
|
||||
/// back culled and write ordinary color/depth, with sky light retained and block luminosity
|
||||
/// raised to the fluid's (lava 15). No model diffuse shade, geometry inset or alpha cutoff.
|
||||
/// API @API:fluid_render@.
|
||||
/// API 561.
|
||||
pub(super) fn native_draw_fluid_box(
|
||||
&self,
|
||||
draw: &mut BlockEntityDraw,
|
||||
|
||||
@@ -6,6 +6,323 @@
|
||||
//! Horizon's own HUD extras do, and keep a mod's settings where the
|
||||
//! WebAssembly mod of the same id kept them.
|
||||
//!
|
||||
//! API 569 adds reading and setting HUD visibility independently of first-person hands (`native_hud_mode`, `native_set_hud_mode`).
|
||||
//!
|
||||
//! API 568 adds moving and turning an entity through an `EntityRef`: teleport, rotation, head yaw, facing, size and pushes.
|
||||
//!
|
||||
//! API 567 adds an entity's state flags through an `EntityRef`: sneaking, sprinting, water and lava, fire, air, silence, invisibility and pose.
|
||||
//!
|
||||
//! API 566 adds sounds and particles in a level through a `LevelRef`, sent to every player in range.
|
||||
//!
|
||||
//! API 565 adds a level's world settings through a `LevelRef`: the seed, the difficulty, game rules and weather.
|
||||
//!
|
||||
//! API 564 adds notify native mods when a chat suggestion is applied.
|
||||
//!
|
||||
//! API 563 adds Wind burst block filtering (`native_wind_burst`).
|
||||
//!
|
||||
//! API 562 adds explicit terrain-sheet native model materials, shading and UV shifts.
|
||||
//!
|
||||
//! API 561 adds still-fluid boxes under a native draw pose, using sorted depth-writing translucency and the animated mipmapped block sprites (`native_draw_fluid_box`).
|
||||
//!
|
||||
//! API 560 adds the current focused text field, before each character is inserted, with an editable value and caret.
|
||||
//!
|
||||
//! API 559 adds what a client HUD reads of its session: `native_client_state`'s `screen`, `debug_screen`, `world`
|
||||
//! (`NativeWorldId`) and `sleeping_pos`, the biome at a block (`native_biome`) and a mod's own folder (`native_data_dir`).
|
||||
//!
|
||||
//! API 558 adds the local player's own combat on the client (`native_client_attack`, `native_client_hurt`).
|
||||
//!
|
||||
//! API 557 adds a client mod reads and writes the open chat box (`native_chat_input`, `native_set_chat_input`).
|
||||
//!
|
||||
//! API 556 adds what a client mod reads of the entities the client shows (radars, name tags, spectator ESP): `NativeClientEntity`'s type, yaw, baby, spectator and body texture, and `position_at`; the dropped items the client shows (`native_client_items`); a texture's pixels, an entity's or a downloaded skin's (`native_client_texture`, as `TexturePixels`).
|
||||
//!
|
||||
//! API 555 adds a client mod takes a screenshot as F2 does (`native_take_screenshot`).
|
||||
//!
|
||||
//! API 554 adds the world's seed on a server (`native_world_seed`).
|
||||
//!
|
||||
//! API 553 adds a title and subtitle on one player's screen (`native_title`), as Adventure's `showTitle`.
|
||||
//!
|
||||
//! API 552 adds the server's last 100 tick times as vanilla's `getTickTimesNanos` lays them out (`native_tick_times`) and its ticks a second over one, five and fifteen minutes (`native_tps`).
|
||||
//!
|
||||
//! API 551 adds the name over a player's head (`native_set_name_tag`): the profile name of their list entries, a nickname above the head.
|
||||
//!
|
||||
//! API 550 adds a player's styled Tab list name (`native_set_list_name`), as Bukkit's `Player.setPlayerListName`.
|
||||
//!
|
||||
//! API 549 adds a player's styled name in chat (`native_set_display_name`), as Bukkit's `Player.setDisplayName`.
|
||||
//!
|
||||
//! API 548 adds each server tick's wall and CPU time with its spans (`native_server_tick_timed`, `TickSpan`), a shared switch for the spans (`native_spans`), and mob costs a mod samples apart from performance reports (`native_mob_cost_sampling`, `native_take_mob_costs`, `NativeMobCost`).
|
||||
//!
|
||||
//! API 547 adds each player's play packets once a tick, by id and body bytes, sent and received (`native_server_packets`), while a mod counts them (`native_count_packets`).
|
||||
//!
|
||||
//! API 546 adds every play packet the server sends a player, decoded, changeable and cancellable (`native_server_packet`), once a mod switched it on (`native_watch_server_packets`).
|
||||
//!
|
||||
//! API 545 adds particles for one player alone (`native_send_particles_to`), as vanilla's `ServerLevel.sendParticles(player, ...)`.
|
||||
//!
|
||||
//! API 544 adds a player's right click on a block with the hand that clicks, cancellable (`native_right_click_block_v2`).
|
||||
//!
|
||||
//! API 543 adds a mod's own resource packs for one player, offered and taken away by id (`native_send_resource_pack`, `native_pop_resource_pack`).
|
||||
//!
|
||||
//! API 542 adds a player's answer to a resource pack with the pack's id, the configuration's answers included (`native_resource_pack_status_v2`), leaving `native_resource_pack_status` as it was.
|
||||
//!
|
||||
//! API 541 adds projectiles and server players' fishing bobbers for `native_remove_entity`.
|
||||
//!
|
||||
//! API 540 adds a player's fishing rod with the hand that holds it, cancellable (`native_player_fish_v2`).
|
||||
//!
|
||||
//! API 539 adds the plugin channels a player's client registers and unregisters, in the configuration and in play (`native_player_register_channels`), and those it has (`native_player_channels`).
|
||||
//!
|
||||
//! API 538 adds a sound for one player alone (`native_play_sound_to`), as Bukkit's `Player.playSound`.
|
||||
//!
|
||||
//! API 537 adds a mob walked with the engine's pathfinding and turned to look, as vanilla's goals drive it (`native_mob_navigate`,
|
||||
//! `native_mob_follow`, `native_mob_stop`, `native_mob_navigating`, `native_mob_look_at`).
|
||||
//!
|
||||
//! API 536 adds a mob's own attack on a mob or a player of its level (`native_mob_attack`, `Mob.doHurtTarget`).
|
||||
//!
|
||||
//! API 535 adds an entity turned without moving it, as `/rotate` does, a mob's head apart (`native_set_entity_rotation`).
|
||||
//!
|
||||
//! API 534 adds an entity found by its UUID in any loaded level (`native_entity_by_uuid`) and `/data merge entity` in
|
||||
//! any loaded level (`native_merge_entity_nbt`).
|
||||
//!
|
||||
//! API 533 adds `native_spawn_mob` and `native_summon` for any loaded level, not only the one in place, so a
|
||||
//! `native_server_tick` hook spawns too (`execute in <dimension> run summon`).
|
||||
//!
|
||||
//! API 532 adds maps a server mod draws, kept by the world: `native_new_map` and `native_paint_map`.
|
||||
//!
|
||||
//! API 531 adds server menus with input slots the player fills as a chest's (`native_open_menu_with_input`), what such a menu holds (`native_menu_contents`), the cursor of a click (`native_menu_cursor`) and the input slots when it closes (`native_menu_input_closed`).
|
||||
//!
|
||||
//! API 530 adds a mod's terrain in the far terrain before its chunks generate (`native_lod_column`).
|
||||
//!
|
||||
//! API 529 adds damage everywhere v1 fires with the victim's and a player attacker's UUID and the causing and direct entity (`native_living_incoming_damage_v3`).
|
||||
//!
|
||||
//! API 528 adds a mob's target changing, cancellable (`native_living_change_target`).
|
||||
//!
|
||||
//! API 527 adds what each open server level holds, for a diagnostics mod: its chunk, forced chunk, block entity and ticking block entity counts and its entities and block entities by type (`native_level_stats`, `NativeLevelStats`), every entity with its id, type and position (`native_level_entities`) and every block entity with its position and type (`native_level_block_entities`).
|
||||
//!
|
||||
//! API 526 adds a player disconnected with a whole text as the reason, as `/kick` does (`native_kick`).
|
||||
//!
|
||||
//! API 525 adds a stable way from SNBT to an item stack: `native_item_from_snbt`, `ItemStack::from_nbt` and `mod_api::parse_snbt`.
|
||||
//!
|
||||
//! API 524 adds another player's inventory in a server menu whose clicks move their items by vanilla's click rules, live or on their file (`native_open_inventory_menu`).
|
||||
//!
|
||||
//! API 523 adds a player's right click on an entity with the hand that clicks, claimable (`native_interact_entity_v2`).
|
||||
//!
|
||||
//! API 522 adds a mod hurting a mob or a player as `LivingEntity.hurtServer` with a mob attack does (`native_hurt_entity`).
|
||||
//!
|
||||
//! API 521 adds an entity hidden from one player's client, or shown again (`native_hide_entity_from`), as Bukkit's `Player.hideEntity`/`showEntity`.
|
||||
//!
|
||||
//! API 520 adds a server player's fishing bobber meeting or lying on a block, each tick (`native_fishing_hook_landed`).
|
||||
//!
|
||||
//! API 519 adds the entity data one player is sent, changeable for that viewer alone (`native_entity_data_to`), once a mod switched it on (`native_watch_entity_data`).
|
||||
//!
|
||||
//! API 518 adds a player's compass target, kept over respawns and level changes (`native_set_compass_target`), as Bukkit's `setCompassTarget`.
|
||||
//!
|
||||
//! API 517 adds entities shown to one player's client alone (`native_client_entity_spawn`, `_set`, `_move`, `_remove`), their data from a compound as `/summon` reads it, and an entity id no server entity takes (`native_reserve_entity_id`).
|
||||
//!
|
||||
//! API 516 adds a chunk's terrain built by a mod before vanilla's noise (`native_chunk_generate`), with vanilla's surface, carvers, structures and features on request.
|
||||
//!
|
||||
//! API 515 adds boss bars for one player (`native_boss_bar`, `NativeBossBar`), as Bukkit's `BossBar.addPlayer`.
|
||||
//!
|
||||
//! API 514 adds a button's, lever's or pressure plate's signal change, which a mod may change or hold (`native_block_redstone`).
|
||||
//!
|
||||
//! API 513 adds a level's world border bounds (`native_world_border`).
|
||||
//!
|
||||
//! API 512 adds a ridden vehicle's move with its id, which a mod may cancel or send elsewhere, mounts included (`native_vehicle_moved_v2`), leaving `native_vehicle_moved` as it was.
|
||||
//!
|
||||
//! API 511 adds an entity about to trample farmland, cancellable (`native_trample`).
|
||||
//!
|
||||
//! API 510 adds a boat, minecart or ridden mob teleported with its riders (`native_teleport_vehicle`), as Bukkit's `Vehicle.teleport`.
|
||||
//!
|
||||
//! API 509 adds a server player teleported from any server hook, the acting player's own included (`native_teleport_player`), as Bukkit's `Player.teleport`.
|
||||
//!
|
||||
//! API 508 adds `NativeCommand` argument kinds whose completions the client asks the server for (`word?`, `text?`, `player_name`), and a guest's completion request with the command split into label and arguments (`native_tab_complete_v2`).
|
||||
//!
|
||||
//! API 507 adds one checked slot of a player's inventory set, and exact stacks taken all or none (`native_set_inventory_slot`, `native_take_stacks`).
|
||||
//!
|
||||
//! API 506 adds a player's whole inventory or ender chest replaced, live or in their file (`native_set_inventory`).
|
||||
//!
|
||||
//! API 505 adds a server player let fly in any game mode and set flying (`native_set_flight`), as Bukkit's `Player.setAllowFlight` and `setFlying`.
|
||||
//!
|
||||
//! API 504 adds more of a player on `NativeServerPlayer`: latency, protocol, experience, ground, abilities, sneaking, eye height, selected slot, nickname and hidden level.
|
||||
//!
|
||||
//! API 503 adds the server's player limit, folder and log file (`native_max_players`, `native_server_dir`, `native_log_file`).
|
||||
//!
|
||||
//! API 502 adds a plugin channel message to one player's client on any channel outside `horizon:` (`native_send_custom_payload_to_player`).
|
||||
//!
|
||||
//! API 501 adds a console command that reaches the mods' registered commands, then vanilla's (`native_run_mod_command`).
|
||||
//!
|
||||
//! API 500 adds a console command run with its result and answer kept (`native_run_command_captured`).
|
||||
//!
|
||||
//! API 499 adds a command run as a player typing it would, at their level, with its result and answer (`native_run_command_as`).
|
||||
//!
|
||||
//! API 498 adds a dead server player respawned without their client's Respawn click (`native_respawn_player`), as Spigot's `player.spigot().respawn()`.
|
||||
//!
|
||||
//! API 497 adds a player's command tree sent again, the mods asked anew (`native_resend_commands`), as Bukkit's `Player.updateCommands`.
|
||||
//!
|
||||
//! API 496 adds a thrown projectile about to cross the world border, which a mod may move, slow or let through (`native_projectile_world_border`).
|
||||
//!
|
||||
//! API 495 adds an online player's profile property set (`native_set_profile_property`) and the player shown again with it (`native_refresh_player`).
|
||||
//!
|
||||
//! API 494 adds a player the server knows, by name (`native_profile_by_name`) or id (`native_profile_by_uuid`), from who is on and the profile cache.
|
||||
//!
|
||||
//! API 493 adds one player's view distance (`native_set_player_view_distance`, `native_player_view_distance`).
|
||||
//!
|
||||
//! API 492 adds an online player's `textures` property (`native_player_textures`) and a head stack of any player (`native_player_head`).
|
||||
//!
|
||||
//! API 491 adds a server player about to be teleported, with the cause, both levels and the position packet's relative flags, which a mod may change or cancel (`native_player_teleport`).
|
||||
//!
|
||||
//! API 490 adds a player's food read (`native_player_food`) and their health, food and experience set (`native_set_player_status`), as Bukkit's `setHealth`, `setFoodLevel`, `setSaturation` and `setExp`; health 0 kills.
|
||||
//!
|
||||
//! API 489 adds where a joining player is about to be placed, which a mod may change (`native_player_spawn_location`).
|
||||
//!
|
||||
//! API 488 adds where a dead player is about to respawn, which a mod may change (`native_player_respawn_position`).
|
||||
//!
|
||||
//! API 487 adds a player's statistics and advancements in vanilla's JSON, read and replaced (`native_player_stats`, `native_player_stat`, `native_set_player_stats`, `native_player_advancements`, `native_set_player_advancements`).
|
||||
//!
|
||||
//! API 486 adds a joining player's profile properties on the connection's thread, before `LoginFinished` (`native_player_profile`).
|
||||
//!
|
||||
//! API 485 adds a player logging in, on the connection's thread before the server's checks, held for the mods' answers or refused (`native_player_pre_login`).
|
||||
//!
|
||||
//! API 484 adds the compound mods keep on a player (`native_player_persistent_data`, `native_set_player_persistent_data`), saved as `NeoForgeData`, as NeoForge's `Entity.getPersistentData` and Bukkit's `PersistentDataContainer`.
|
||||
//!
|
||||
//! API 483 adds a player's permission level, also inside `native_player_login` (`native_player_permission`).
|
||||
//!
|
||||
//! API 482 adds a server player's move before it is applied, which a mod may cancel or send elsewhere (`native_player_move`).
|
||||
//!
|
||||
//! API 481 adds a player leaving while still in their level, before they are saved and removed (`native_player_logging_out`).
|
||||
//!
|
||||
//! API 480 adds a guest about to throw a snowball, egg, ender pearl or mod thrown item, with the whole stack, cancellable (`native_player_launch_projectile_v2`), leaving `native_player_launch_projectile` as it was.
|
||||
//!
|
||||
//! API 479 adds one player hurting another by melee, sweep or a projectile, with both players named, cancellable (`native_player_hurt_by_player`).
|
||||
//!
|
||||
//! API 478 adds any player's main-hand stack and equipment slots from any server hook (`native_held_stack`, `native_player_equipment`).
|
||||
//!
|
||||
//! API 477 adds a player's effects read, one given or taken off, or all replaced (`native_effects`, `native_add_effect`, `native_remove_effect`, `native_set_effects`), as vanilla's `LivingEntity.addEffect` and Bukkit's `addPotionEffect`.
|
||||
//!
|
||||
//! API 476 adds a player's compound as the server would save it now (`native_player_compound`), as vanilla's `ServerPlayer.saveWithoutId`.
|
||||
//!
|
||||
//! API 475 adds the root commands a player's level hides from their command tree, which a mod may put back (`native_player_commands_sent_v2`), leaving `native_player_commands_sent` as it was.
|
||||
//!
|
||||
//! API 474 adds the operator level one typed command of a player runs at, which a mod may raise or lower (`native_player_command_level`).
|
||||
//!
|
||||
//! API 473 adds what a player's client told the server and what it was sent (`native_player_client`): brand, language, view distance, chunks and wire bytes.
|
||||
//!
|
||||
//! API 472 adds a player's attribute read, its base set, or a saved `attributes` list loaded (`native_attribute`, `native_set_attribute_base`, `native_set_attributes`), as Bukkit's `AttributeInstance` and vanilla's `AttributeMap.load`.
|
||||
//!
|
||||
//! API 471 adds permission nodes: a permissions mod's answer (`native_permission_check`) and the question every mod asks (`native_has_permission`), falling back to the operator level.
|
||||
//!
|
||||
//! API 470 adds a server player or mob seated on a vehicle or taken off it, and a vehicle emptied (`native_mount`, `native_dismount`, `native_eject_passengers`), as `/ride` and Bukkit's `addPassenger`/`leaveVehicle`/`eject`.
|
||||
//!
|
||||
//! API 469 adds each message written to the log, on the log's writer thread (`native_log_line`).
|
||||
//!
|
||||
//! API 468 adds a pickup with the whole stack, the item's thrower and position (`native_item_picked_up_v2`), leaving `native_item_picked_up` as it was.
|
||||
//!
|
||||
//! API 467 adds a player's throw with the whole stack, cancellable (`native_item_dropped_v2`), leaving `native_item_dropped` as it was.
|
||||
//!
|
||||
//! API 466 adds a guest's drag in their own inventory or a vanilla menu ending, with the slots it went over, cancellable (`native_inventory_drag`).
|
||||
//!
|
||||
//! API 465 adds a guest's click in their own inventory or a vanilla menu, before it is applied, cancellable (`native_inventory_click`).
|
||||
//!
|
||||
//! API 464 adds a client's handshake on the connection's thread, its host rewritable, refusable (`native_handshake`).
|
||||
//!
|
||||
//! API 463 adds a player's plugin channel message on a channel that isn't Horizon's own (`native_custom_payload_from_client`).
|
||||
//!
|
||||
//! API 462 adds a creative slot set with the whole stack (`native_creative_slot_v2`), leaving `native_creative_slot` as it was.
|
||||
//!
|
||||
//! API 461 adds every line the dedicated server's console or RCON is about to run, cancellable, with replies (`native_console_line`).
|
||||
//!
|
||||
//! API 460 adds a permission node on a mod's command (`NativeCommand::permission`), which the command tree and the server's dispatch ask `native_has_permission` for.
|
||||
//!
|
||||
//! API 459 adds a server command looked up by name, an alias resolved (`native_command_info`).
|
||||
//!
|
||||
//! API 458 adds read-only chunk snapshots (`native_chunk_snapshot`) with block map colours and biome tints (`native_block_map_color`, `native_biome_name`, `native_biome_tint`).
|
||||
//!
|
||||
//! API 457 adds a guest about to place a block item, with the position and state, before anything is set, cancellable (`native_block_place`).
|
||||
//!
|
||||
//! API 456 adds a client mod opens the chat screen with text typed in (`native_open_chat`).
|
||||
//!
|
||||
//! API 455 adds every block state's facts and looks by its id, and the resources' files, for client mods working off the main thread (`native_block_states`, `native_client_resources`).
|
||||
//!
|
||||
//! API 454 adds dropped-item block contact after a clipped vertical move.
|
||||
//!
|
||||
//! API 453 adds client world snapshots (`native_client_chunks`, `native_client_chunks_changed`, `native_client_biomes`, `native_client_biomes_changed`): the client's loaded chunks of an area and its biome table, shared with the world and read on a mod's own threads.
|
||||
//!
|
||||
//! API 452 adds player bots driven by a server mod: one tick of a player's own movement from an input (`native_simulate_player_move`) and the block collision boxes in a box (`native_collision_boxes`).
|
||||
//!
|
||||
//! API 451 adds one local client particle through Host::add_particle, retaining the existing provider and engine limits.
|
||||
//!
|
||||
//! API 450 adds an opt-in provider behind the ordinary block-fluid helpers.
|
||||
//!
|
||||
//! API 449 adds client sound parameter interception before playback and live channel updates (`native_sound_play`).
|
||||
//!
|
||||
//! API 448 adds a right-click on an entity with the point clicked (`native_entity_interact_specific`).
|
||||
//!
|
||||
//! API 447 adds an item fallback after a native mob's ordinary interaction passed.
|
||||
//!
|
||||
//! API 446 adds state-dependent block clone items before Ctrl+Pick data.
|
||||
//!
|
||||
//! API 445 adds the players' command trees rebuilt while the server runs (`native_refresh_commands`), for a mod that changes the commands it registers.
|
||||
//!
|
||||
//! API 444 adds a block's default state by name (`native_default_state`).
|
||||
//!
|
||||
//! API 443 adds an anvil's result, which a mod may change or cancel (`native_anvil_update`).
|
||||
//!
|
||||
//! API 442 adds transparent background rendering behind in-game screens (`native_screen_transparent_background`), menu background blur (`native_apply_screen_blur`, `native_menu_blur_radius`) and tiled menu backgrounds (`native_draw_menu_background`, `native_tiled_sprite`).
|
||||
//!
|
||||
//! API 441 adds the start of a player's server tick (`native_player_tick_pre`).
|
||||
//!
|
||||
//! API 440 adds the window's player logging in to a server (`native_client_player_network_logging_in`).
|
||||
//!
|
||||
//! API 439 adds the window's client tick, before and after its work (`native_client_tick_pre`, `native_client_tick_post`).
|
||||
//!
|
||||
//! API 438 adds a mod's say before a player's landing changes a block (`native_entity_change_block_v2`).
|
||||
//!
|
||||
//! API 437 adds how fast a player digs a block (`native_break_speed`).
|
||||
//!
|
||||
//! API 436 adds item tooltip rendering interception (`native_tooltip_render_pre`), GUI item drawing helpers (`gui_draw_item`, `gui_draw_item_with`), and live keyboard modifier/key state checks (`has_shift_down`, `has_control_down`, `has_alt_down`, `is_key_down`).
|
||||
//!
|
||||
//! API 435 adds the damage a living entity's health takes, before and after (`native_living_damage_pre`, `native_living_damage_post`).
|
||||
//!
|
||||
//! API 434 adds entity model layers built in code (`native_layer_definitions`, NeoForge's `EntityRenderersEvent.RegisterLayerDefinitions`), baked with `native_bake_layer` and drawn with `native_draw_model_part`.
|
||||
//!
|
||||
//! API 433 adds a mod tank's say on which fluids it takes (`native_block_entity_accepts_fluid`).
|
||||
//!
|
||||
//! API 432 adds a new toast about to be queued, cancellable (`native_toast_add`).
|
||||
//!
|
||||
//! API 431 adds a structure template's blocks as `/place template` would place them, without placing them (`native_structure_template`), for builders.
|
||||
//!
|
||||
//! API 430 adds a new mob's goals (`native_register_goals`, `Mob.registerGoals`).
|
||||
//!
|
||||
//! API 429 adds a world-space text/quad canvas (`native_world_submit`, `native_world_quad`, `native_world_text`).
|
||||
//!
|
||||
//! API 428 adds Horizon's health HUD state for a `native_health_hud` mod (`native_health_hud_state`) and this
|
||||
//! client's player's attribute values (`native_local_attribute`).
|
||||
//!
|
||||
//! API 427 adds the drawn-map sender on Host (`send_map`, the existing `native_send_map`).
|
||||
//!
|
||||
//! API 426 adds entity handles on a client (`native_entity` and the `entity_*` and `living_*` reads over the entities the server shows the window, armor stands' custom names and equipment included) and the stacks of a server-opened menu by slot (`native_menu_stacks`).
|
||||
//!
|
||||
//! API 425 adds world primitives (`native_world_primitives`): lines, boxes, beams and text a client mod draws in the world each frame.
|
||||
//!
|
||||
//! API 424 adds the glowing outline a client draws on an entity (`native_entity_outline`).
|
||||
//!
|
||||
//! API 423 adds a mod's own fluids in tanks (`native_fluid_insert` takes any namespaced fluid outside `minecraft`), and the tanks' contents read through `Host` (`native_fluid_tanks`).
|
||||
//!
|
||||
//! API 422 adds the current of a fluid at a position (`native_fluid_flow`, `FluidState.getFlow`).
|
||||
//!
|
||||
//! API 421 adds turning parts of a block entity's kept geometry (`BlockEntityDraw::spin`, `still`): the game turns them each frame from the game time.
|
||||
//!
|
||||
//! API 420 adds a scene of blocks and their mod block entities drawn in a screen from an angle (`native_draw_scene`), as Create's Ponder shows its machines.
|
||||
//!
|
||||
//! API 419 adds text in the world from `native_block_entity_submit` (`native_draw_text`), as a sign draws its lines.
|
||||
//!
|
||||
//! API 418 adds the texture a block state shows on a side, by the name the block entity drawing helpers take (`native_block_face_sprite`), for copycat blocks.
|
||||
//!
|
||||
//! API 417 adds a mod container's say on which items it takes (`native_container_accepts`).
|
||||
//!
|
||||
//! API 416 adds a mod's machine breaks blocks with a tool and keeps their drops (`native_machine_destroy_block`) and shows its crack (`native_set_break_progress`).
|
||||
//!
|
||||
//! API 415 adds a mod's fake player uses an item on a block, in the air or on an entity (`native_use_as_player`), as a deployer does.
|
||||
//!
|
||||
//! API 414 adds trait mods reach helpers `dyn Host` couldn't carry: `draw_model`, `mod_block_entity` and `change_mod_block_entity` (a neighbour's mod block entity), `item_entities`, `level_random`, `play_sound` and `send_particles` outside level hooks, `block_name_in_tag`, `server_item_in_tag`, item components, `trigger_criterion`, and the player's `equipment` and `sneaking`.
|
||||
//!
|
||||
//! API 413 adds chunk tickets in a level nobody is in (`native_force_chunk_in`).
|
||||
//!
|
||||
//! API 412 adds chunks a mod keeps loaded and ticking (`native_force_chunk`, `native_forced_chunks`).
|
||||
@@ -1171,7 +1488,7 @@ pub(super) use horizon_world::level::flags;
|
||||
|
||||
/// The hook points' API version. The launcher reads this line from the
|
||||
/// source it builds; keep its form.
|
||||
pub(crate) const NATIVE_HOOKS_API: u32 = 413;
|
||||
pub(crate) const NATIVE_HOOKS_API: u32 = 569;
|
||||
|
||||
impl GameLevel<'_> {
|
||||
/// A hopper at `pos` is about to pick up `count` of `item`. Set `cancel` to leave the dropped stack in the world. Server-side. 232.
|
||||
@@ -1254,7 +1571,7 @@ impl GameLevel<'_> {
|
||||
/// checked again, a lever stays; no sound), and an on-or-off component is on for anything
|
||||
/// above 0. Not heard: redstone wire, torches, repeaters, comparators, observers, detector
|
||||
/// rails, tripwire hooks, daylight detectors and the other signal sources. Server-side.
|
||||
/// @API:block_redstone@.
|
||||
/// 514.
|
||||
#[inline(always)]
|
||||
pub(super) fn native_block_redstone(
|
||||
&self,
|
||||
@@ -2214,7 +2531,7 @@ impl Game<'_> {
|
||||
/// stack and supplies the block from `Entity.getOnPosLegacy`.
|
||||
/// `client` identifies prediction. `discard` consumes the current entity
|
||||
/// without loot or pickup. A stack reduced to zero also consumes it.
|
||||
/// @API:item_after_vertical_collision@
|
||||
/// 454
|
||||
pub(super) fn native_item_after_vertical_collision(
|
||||
&mut self,
|
||||
dimension: &str,
|
||||
@@ -2260,7 +2577,7 @@ impl Game<'_> {
|
||||
/// the player with the server's first position, so `native_player` is
|
||||
/// None here. A mod may send the server its own packets
|
||||
/// (`native_send_packet`). Client only.
|
||||
/// API @API:client_player_network_logging_in@.
|
||||
/// API 440.
|
||||
pub(super) fn native_client_player_network_logging_in(&mut self) {
|
||||
mod_api::dispatch_client_player_network_logging_in(self, mod_api::mods());
|
||||
}
|
||||
@@ -2276,7 +2593,7 @@ impl Game<'_> {
|
||||
/// behind an in-game screen (inventory, container, creative, book, sign, editor).
|
||||
/// Set `canceled` (or return `Flow::Cancel`) to suppress the vanilla dark gradient,
|
||||
/// allowing a mod to draw its own background or apply menu background blur
|
||||
/// via `Host::apply_screen_blur`. API @API:screen_transparent_background@.
|
||||
/// via `Host::apply_screen_blur`. API 442.
|
||||
pub(super) fn native_screen_transparent_background(
|
||||
&self,
|
||||
screen: &str,
|
||||
@@ -2593,7 +2910,7 @@ impl Game<'_> {
|
||||
/// server, a vanilla one or single player's own thread: a client mod
|
||||
/// hears its player's attacks where the server's `native_attack_entity`
|
||||
/// doesn't run. Whether the hit lands is the server's to say. Client only.
|
||||
/// API @API:client_combat@.
|
||||
/// API 558.
|
||||
pub(super) fn native_client_attack(&mut self, target: u32, player: bool) {
|
||||
mod_api::dispatch_client_attack(self, mod_api::mods(), target, player);
|
||||
}
|
||||
@@ -2601,7 +2918,7 @@ impl Game<'_> {
|
||||
/// (`ClientboundDamageEventPacket`, the packet that tilts the camera):
|
||||
/// `attacker` is the entity that caused it when the server names one (the
|
||||
/// shooter of an arrow, not the arrow), `player` whether that is another
|
||||
/// player. Client only. API @API:client_combat@.
|
||||
/// player. Client only. API 558.
|
||||
pub(super) fn native_client_hurt(&mut self, attacker: Option<u32>, player: bool) {
|
||||
mod_api::dispatch_client_hurt(self, mod_api::mods(), attacker, player);
|
||||
}
|
||||
@@ -2610,13 +2927,13 @@ impl Game<'_> {
|
||||
/// ticks 20 times a second on the title screen, while paused and in a
|
||||
/// world alike, and runs the ticks a slow frame owes back to back. Never
|
||||
/// on a server, single player's own included: it ticks on its own thread.
|
||||
/// Client only. API @API:client_tick@.
|
||||
/// Client only. API 439.
|
||||
pub(super) fn native_client_tick_pre(&mut self) {
|
||||
mod_api::dispatch_client_tick_pre(self, mod_api::mods());
|
||||
}
|
||||
/// The same client tick ends (`ClientTickEvent.Post`): the world's tick,
|
||||
/// the chat queue, music and sounds are done. A tick that errors ends
|
||||
/// before it. Client only. API @API:client_tick@.
|
||||
/// before it. Client only. API 439.
|
||||
pub(super) fn native_client_tick_post(&mut self) {
|
||||
mod_api::dispatch_client_tick_post(self, mod_api::mods());
|
||||
}
|
||||
@@ -2684,7 +3001,7 @@ impl Game<'_> {
|
||||
/// `interactLivingEntity`. Set `claimed` to take the click: the hand
|
||||
/// swings and none of those runs. Asked once per hand, as vanilla tries
|
||||
/// the main hand then the off hand. Server-side, for every player of the
|
||||
/// world (the helpers read the acting one). API @API:entity_interact_specific@.
|
||||
/// world (the helpers read the acting one). API 448.
|
||||
pub(super) fn native_entity_interact_specific(
|
||||
&mut self,
|
||||
entity: i32,
|
||||
@@ -2727,7 +3044,7 @@ impl Game<'_> {
|
||||
/// Server-side for every acting player. This covers native Mob entries,
|
||||
/// not armor stands, other real players or dragon-part interaction tables.
|
||||
/// `ItemStack.interactLivingEntity` in `Player.interactOn`.
|
||||
/// API @API:item_interact_mob@.
|
||||
/// API 447.
|
||||
pub(super) fn native_item_interact_mob(
|
||||
&mut self,
|
||||
entity: i32,
|
||||
@@ -2768,7 +3085,7 @@ impl Game<'_> {
|
||||
/// host's for each guest (the helpers read that player), and a remote
|
||||
/// client's own prediction, so a mod changes the speed alike on both sides
|
||||
/// to keep the crack in step with the server. It is asked every tick of a
|
||||
/// dig, on each side, so it should only compute. API @API:break_speed@.
|
||||
/// dig, on each side, so it should only compute. API 437.
|
||||
pub(super) fn native_break_speed(
|
||||
&self,
|
||||
pos: [i32; 3],
|
||||
@@ -2783,7 +3100,7 @@ impl Game<'_> {
|
||||
/// world, before their digging, item use and cooldowns, and before the
|
||||
/// `native_player_tick` that ends the same tick. The helpers read that
|
||||
/// player. Players still tick under `/tick freeze`; a dead player
|
||||
/// doesn't. API @API:player_tick_pre@.
|
||||
/// doesn't. API 441.
|
||||
pub(super) fn native_player_tick_pre(&mut self) {
|
||||
mod_api::dispatch_player_tick_pre(self, mod_api::mods());
|
||||
}
|
||||
@@ -2982,7 +3299,7 @@ impl Game<'_> {
|
||||
/// facing the camera, in world coordinates, to `primitives`, each depth tested or seen
|
||||
/// through walls (`horizon_client::world_primitives`). Horizon draws them with its own
|
||||
/// pipelines after the entities and before the first-person hand, at the world's
|
||||
/// resolution, depth and TAA. Not on the title screen. API @API:world_primitives@.
|
||||
/// resolution, depth and TAA. Not on the title screen. API 425.
|
||||
pub(super) fn native_world_primitives(
|
||||
&self,
|
||||
partial: f32,
|
||||
@@ -3019,7 +3336,7 @@ impl Game<'_> {
|
||||
/// only what this client draws: the entity's `Glowing` flag, what the
|
||||
/// server and other players see, stays. Asked each frame for every mob,
|
||||
/// player (yourself in third person), dropped item and projectile drawn.
|
||||
/// API @API:entity_outline@.
|
||||
/// API 424.
|
||||
pub(super) fn native_entity_outline(
|
||||
&self,
|
||||
entity_id: u32,
|
||||
@@ -3242,7 +3559,7 @@ impl Game<'_> {
|
||||
/// `createBodyLayer()` builds it. `native_bake_layer` bakes one into the
|
||||
/// `ModelPart` tree `native_draw_model_part` draws. Asked once at start,
|
||||
/// on every side. An id in vanilla's namespace, not of that form, or
|
||||
/// registered already is logged and left out. API @API:model_layers@.
|
||||
/// registered already is logged and left out. API 434.
|
||||
pub(super) fn native_layer_definitions(layers: &mut Vec<(String, LayerDefinition)>) {
|
||||
mod_api::dispatch_layer_definitions(mod_api::mods(), layers);
|
||||
}
|
||||
@@ -3356,7 +3673,7 @@ impl Game<'_> {
|
||||
/// the fluid there; the fill tries the next tank. Every tank accepts
|
||||
/// every fluid unless a mod says otherwise; a cauldron, which holds only
|
||||
/// water and lava, and a drain never ask it. Bundles need "hooks":
|
||||
/// @API:block_entity_accepts_fluid@.
|
||||
/// 433.
|
||||
pub(super) fn native_block_entity_accepts_fluid(
|
||||
&self,
|
||||
block: &str,
|
||||
@@ -3377,7 +3694,7 @@ impl Game<'_> {
|
||||
/// when the block fluid helpers resolve their target. True takes precedence over API 54's
|
||||
/// `fluids` storage, even when a runtime callback supplies no response.
|
||||
/// Set custom to true for your block; never clear an earlier declaration.
|
||||
/// @API:custom_block_fluids@
|
||||
/// 450
|
||||
pub(super) fn native_custom_block_fluids(&self, block: &str, custom: &mut bool) {
|
||||
mod_api::dispatch_custom_block_fluids(self, mod_api::mods(), block, custom);
|
||||
}
|
||||
@@ -3539,7 +3856,7 @@ impl Game<'_> {
|
||||
/// the block's `ModContainer` lets that slot be filled through that face
|
||||
/// (its `inputs` and `faces`). Set `cancel` to refuse the item there; the
|
||||
/// mover tries the next slot. Not asked for a player's clicks in a menu
|
||||
/// (`native_menu_slot_rules`). Bundles need "hooks": @API:container_accepts@.
|
||||
/// (`native_menu_slot_rules`). Bundles need "hooks": 417.
|
||||
pub(super) fn native_container_accepts(
|
||||
&self,
|
||||
pos: [i32; 3],
|
||||
@@ -3619,7 +3936,7 @@ impl Game<'_> {
|
||||
/// before the hand/HUD. The pose starts camera-relative; use
|
||||
/// `draw.translate_world` for a world position. Called independently of
|
||||
/// block entities and chunks, so transient overlays may outlive their
|
||||
/// source block. API @API:world_canvas@.
|
||||
/// source block. API 429.
|
||||
pub(super) fn native_world_submit(&self, draw: &mut NativeWorldDraw) {
|
||||
mod_api::dispatch_world_submit(self, mod_api::mods(), draw);
|
||||
}
|
||||
@@ -4869,7 +5186,7 @@ impl Game<'_> {
|
||||
/// The first supplied stack replaces the block's normal clone item;
|
||||
/// no response keeps vanilla behavior. Empty or unregistered replacements
|
||||
/// produce no picked item, including for a block without a primary item.
|
||||
/// @API:block_clone_item@
|
||||
/// 446
|
||||
pub(super) fn native_block_clone_item(
|
||||
&self,
|
||||
block: &str,
|
||||
@@ -6067,7 +6384,7 @@ impl Game<'_> {
|
||||
/// keep the window in step with the server. The window works its result
|
||||
/// out again after each click in the menu, so it may ask about the same
|
||||
/// inputs again: a mod should answer from what it is told. On the host,
|
||||
/// `native_prepare_anvil` comes after it. API @API:anvil_update@.
|
||||
/// `native_prepare_anvil` comes after it. API 443.
|
||||
pub(super) fn native_anvil_update(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -6490,7 +6807,7 @@ impl Game<'_> {
|
||||
/// input even when cycling. `suggestion` is the selected replacement;
|
||||
/// `input` is the resulting field value after its length limit. Client-only,
|
||||
/// read-only; previews, navigation and command-block editors do not fire it.
|
||||
/// API @API:chat_suggestion_applied@.
|
||||
/// API 564.
|
||||
pub(super) fn native_chat_suggestion_applied(
|
||||
&self,
|
||||
original: &str,
|
||||
@@ -6519,7 +6836,7 @@ impl Game<'_> {
|
||||
/// `chunk_load_failure`, `chunk_save_failure`), or empty for
|
||||
/// `now_playing`. An update to a toast already queued or shown is not an
|
||||
/// add. Set `cancel` and it isn't queued, shown or sounded. Title-screen
|
||||
/// toasts are not told. Client-side. API @API:toast_add@.
|
||||
/// toasts are not told. Client-side. API 432.
|
||||
pub(super) fn native_toast_add(&mut self, kind: &str, id: &str, cancel: &mut bool) {
|
||||
mod_api::dispatch_toast_add(self, mod_api::mods(), kind, id, cancel);
|
||||
}
|
||||
@@ -6672,7 +6989,7 @@ impl Game<'_> {
|
||||
/// was, `entity` and `kind` the mob for a mob's landing (`None` and the
|
||||
/// player's type here). `from` and `to` are the block names. Set `cancel`
|
||||
/// and the block stays as it was and nothing the change would have caused
|
||||
/// happens, as Bukkit's `EntityChangeBlockEvent` (@API:entity_change_block_v2@).
|
||||
/// happens, as Bukkit's `EntityChangeBlockEvent` (438).
|
||||
pub(super) fn native_entity_change_block_v2(
|
||||
&mut self,
|
||||
player: Option<u128>,
|
||||
@@ -6947,7 +7264,7 @@ impl Game<'_> {
|
||||
/// given, a leading slash included. Set `cancel` and it does not run. Each
|
||||
/// line in `replies` answers the source as the console's feedback does: in
|
||||
/// the log, and in the RCON or `horizon-server` reply. There is no player:
|
||||
/// the source is the console at level 4. Server-side. API @API:console_line@.
|
||||
/// the source is the console at level 4. Server-side. API 461.
|
||||
pub(super) fn native_console_line(
|
||||
&mut self,
|
||||
source: &str,
|
||||
@@ -6967,7 +7284,7 @@ impl Game<'_> {
|
||||
/// works; `native_send_custom_payload_to_player` answers on a channel of
|
||||
/// any name. Heard from a dead player too. Server-side, for every guest
|
||||
/// (a single player world's own player sends none). The client side is
|
||||
/// #6774. API @API:custom_payload_from_client@.
|
||||
/// #6774. API 463.
|
||||
pub(super) fn native_custom_payload_from_client(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -6985,7 +7302,7 @@ impl Game<'_> {
|
||||
/// drops and experience, `native_player_died`; they are then saved dead. Once for each placed
|
||||
/// player who leaves, before `native_player_logged_out`, on a server. Not heard when the
|
||||
/// server stops, where `native_player_logged_out` tells with them still listed.
|
||||
/// @API:player_logging_out@.
|
||||
/// 481.
|
||||
pub(super) fn native_player_logging_out(&mut self, player: u128, name: &str) {
|
||||
mod_api::dispatch_player_logging_out(self, mod_api::mods(), player, name);
|
||||
}
|
||||
@@ -7005,7 +7322,7 @@ impl Game<'_> {
|
||||
/// Channeling's lightning, fire, the effects of a potion or a tipped arrow, and thrown
|
||||
/// tridents, which hurt no players yet. Like `native_living_incoming_damage` there is no
|
||||
/// `self`: the game is in the middle of the hit. It runs on the server thread.
|
||||
/// @API:player_hurt_by_player@.
|
||||
/// 479.
|
||||
pub(super) fn native_player_hurt_by_player(
|
||||
attacker: u128,
|
||||
attacker_entity: i32,
|
||||
@@ -7036,7 +7353,7 @@ impl Game<'_> {
|
||||
/// teleport follows. A dimension the server does not have, or a value that is not finite,
|
||||
/// leaves that part as it was. Once for each join, after `native_player_login` let them in
|
||||
/// and before `native_player_logged_in`; no player's state is swapped in (they are in no
|
||||
/// level yet). Server-side. @API:player_spawn_location@.
|
||||
/// level yet). Server-side. 489.
|
||||
pub(super) fn native_player_spawn_location(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7060,7 +7377,7 @@ impl Game<'_> {
|
||||
/// that threw or dropped it; none for a block's or a mob's drop) and its `position`. Heard
|
||||
/// just before `native_item_picked_up`, which hears nothing of a pickup canceled here. Set
|
||||
/// `canceled` to leave the stack on the ground: it isn't offered again for 10 ticks.
|
||||
/// Server-side. @API:item_picked_up_v2@.
|
||||
/// Server-side. 468.
|
||||
pub(super) fn native_item_picked_up_v2(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7085,7 +7402,7 @@ impl Game<'_> {
|
||||
/// thrown: the stack goes back into the player's inventory (`Inventory.add`: the held slot
|
||||
/// first), and only what doesn't fit there is thrown, unheard; v1 hears nothing of it. The
|
||||
/// drop statistics and the arm swing still happen, as in NeoForge. Server-side.
|
||||
/// @API:item_dropped_v2@.
|
||||
/// 467.
|
||||
pub(super) fn native_item_dropped_v2(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7098,7 +7415,7 @@ impl Game<'_> {
|
||||
/// a custom name, unbreakable, attribute modifiers, a container's contents...), none for an
|
||||
/// emptied slot. Heard just before `native_creative_slot`, which hears nothing of a packet
|
||||
/// canceled here. Set `cancel` and the packet is ignored. The player's state is swapped in,
|
||||
/// as for v1. Server-side. @API:creative_slot_v2@.
|
||||
/// as for v1. Server-side. 462.
|
||||
pub(super) fn native_creative_slot_v2(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7129,7 +7446,7 @@ impl Game<'_> {
|
||||
/// nothing. `player` may be on the server, joining, or unknown to it; it
|
||||
/// is often asked with the hub out of reach, so answer from the mod's own
|
||||
/// data. Calling `native_has_permission` from inside it asks again.
|
||||
/// Server-side. API @API:permission_check@.
|
||||
/// Server-side. API 471.
|
||||
pub(super) fn native_permission_check(
|
||||
&self,
|
||||
player: u128,
|
||||
@@ -7157,7 +7474,7 @@ impl Game<'_> {
|
||||
/// of `names` and it is hidden, as with v1. This changes only the tree
|
||||
/// the client gets: running a granted vanilla command still needs its
|
||||
/// level (`native_player_command_level`). Mods are asked in order and
|
||||
/// share both lists. API @API:player_commands_sent_v2@.
|
||||
/// share both lists. API 475.
|
||||
pub(super) fn native_player_commands_sent_v2(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7190,7 +7507,7 @@ impl Game<'_> {
|
||||
/// for a mod's quiet commands; a LAN world without Allow Commands still
|
||||
/// refuses its guests' vanilla commands. The hub is out of reach here and
|
||||
/// no player's state is swapped in: answer from the mod's own data.
|
||||
/// Server-side. API @API:player_command_level@.
|
||||
/// Server-side. API 474.
|
||||
pub(super) fn native_player_command_level(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7211,7 +7528,7 @@ impl Game<'_> {
|
||||
/// already holds the online players' names matching it. Push yours over
|
||||
/// `range`. No player's state is swapped in and the server's players are
|
||||
/// out of reach (`native_server_players` gives none). Server-side.
|
||||
/// API @API:tab_complete_v2@.
|
||||
/// API 508.
|
||||
pub(super) fn native_tab_complete_v2(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7242,7 +7559,7 @@ impl Game<'_> {
|
||||
/// moves it), a sleeper, moves before the client loaded the level or while a teleport waits
|
||||
/// for its answer, and teleports. It runs inside the server's handling of the packet, once
|
||||
/// a move, so it should be cheap; there is no `self` and no player's state is swapped in.
|
||||
/// Server-side. @API:player_move@.
|
||||
/// Server-side. 482.
|
||||
pub(super) fn native_player_move(
|
||||
player: u128,
|
||||
name: &str,
|
||||
@@ -7281,7 +7598,7 @@ impl Game<'_> {
|
||||
/// `native_player_teleport_end_gateway`), respawns (`native_player_respawn_position`), a
|
||||
/// rider carried by its vehicle, waking from a bed, a moved player sent back by the server's
|
||||
/// checks, and a spectator's camera. There is no `self` and no player's state is swapped in:
|
||||
/// the game is in the middle of the teleport. Server-side. @API:player_teleport@.
|
||||
/// the game is in the middle of the teleport. Server-side. 491.
|
||||
pub(super) fn native_player_teleport(
|
||||
player: u128,
|
||||
name: &str,
|
||||
@@ -7317,7 +7634,7 @@ impl Game<'_> {
|
||||
/// does not have, or a position that is not finite, leaves that part as it was. On a LAN
|
||||
/// host's world (not a dedicated server) the level is the Overworld whatever is set. No
|
||||
/// player's state is swapped in, and the hub is out of `self.lan`, so `native_tell` reaches
|
||||
/// nobody here. Server-side. @API:player_respawn_position@.
|
||||
/// nobody here. Server-side. 488.
|
||||
pub(super) fn native_player_respawn_position(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7346,7 +7663,7 @@ impl Game<'_> {
|
||||
/// the chance from the fall, a living entity big enough, `mob_griefing` for a mob). Set
|
||||
/// `cancel` and the farmland stays, the crop on it too; the fall damage is taken either
|
||||
/// way. There is no `self`: the game is in the middle of the entity's move. Server-side.
|
||||
/// @API:trample@.
|
||||
/// 511.
|
||||
pub(super) fn native_trample(
|
||||
dimension: &str,
|
||||
entity: i32,
|
||||
@@ -7374,7 +7691,7 @@ impl Game<'_> {
|
||||
/// 26.3. Heard once a tick for each projectile inside the border whose next step would
|
||||
/// end outside it (a step that drag then keeps inside is heard too); arrows and tridents,
|
||||
/// which Horizon does not stop at the border, are not. No `self`: the projectiles are being
|
||||
/// ticked. Server-side. @API:projectile_world_border@.
|
||||
/// ticked. Server-side. 496.
|
||||
pub(super) fn native_projectile_world_border(
|
||||
dimension: &str,
|
||||
entity: u32,
|
||||
@@ -7401,7 +7718,7 @@ impl Game<'_> {
|
||||
/// client, which took the item at once, gets its inventory back. The
|
||||
/// guest's state is swapped in. Not heard: bows, crossbows, tridents,
|
||||
/// splash potions, experience bottles, wind charges and fireworks.
|
||||
/// Server-side, guests only. @API:player_launch_projectile_v2@.
|
||||
/// Server-side, guests only. 480.
|
||||
pub(super) fn native_player_launch_projectile_v2(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7427,7 +7744,7 @@ impl Game<'_> {
|
||||
/// nothing moves: the click is handled as one that does nothing, so the
|
||||
/// client's predicted slots and cursor are answered with the server's.
|
||||
/// No state is swapped in; the helpers that take a UUID reach the player.
|
||||
/// Server-side. @API:inventory_click@.
|
||||
/// Server-side. 465.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(super) fn native_inventory_click(
|
||||
&mut self,
|
||||
@@ -7458,7 +7775,7 @@ impl Game<'_> {
|
||||
/// client dragged over, in order. Set `cancel` and nothing moves: the
|
||||
/// drag ends empty and the client's predicted slots and cursor are
|
||||
/// answered with the server's. No state is swapped in. Server-side.
|
||||
/// @API:inventory_drag@.
|
||||
/// 466.
|
||||
pub(super) fn native_inventory_drag(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7489,7 +7806,7 @@ impl Game<'_> {
|
||||
/// is swapped in. `state` is `getStateForPlacement`'s, before the stack's
|
||||
/// `block_state` component; finding it asks `native_state_for_placement`
|
||||
/// and `native_can_survive` once more. Server-side, guests only.
|
||||
/// @API:block_place@.
|
||||
/// 457.
|
||||
pub(super) fn native_block_place(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7520,7 +7837,7 @@ impl Game<'_> {
|
||||
/// instead (not checked against the blocks; a value that is not finite is
|
||||
/// ignored). Either way its riders' clients are told, and the next move
|
||||
/// is heard from there. Mods are asked in order and share `to` and
|
||||
/// `cancel`. Server-side. API @API:vehicle_moved_v2@.
|
||||
/// `cancel`. Server-side. API 512.
|
||||
pub(super) fn native_vehicle_moved_v2(
|
||||
&mut self,
|
||||
player: Option<u128>,
|
||||
@@ -7554,7 +7871,7 @@ impl Game<'_> {
|
||||
/// and a player who isn't a guest (single player's own). It runs where the packet is sent, on
|
||||
/// whichever server thread sends it, once a packet and player, so it should be cheap;
|
||||
/// there is no `self` and no player's state is swapped in. Server-side.
|
||||
/// @API:server_packet@.
|
||||
/// 546.
|
||||
pub(super) fn native_server_packet(
|
||||
player: u128,
|
||||
packet: &mut ClientboundPlayPacket,
|
||||
@@ -7577,7 +7894,7 @@ impl Game<'_> {
|
||||
/// (`getNonDefaultValues`), so there is nothing to change until one changes. Not heard: a player
|
||||
/// who isn't a guest (single player's own). It runs where the packet is sent, on whichever
|
||||
/// server thread sends it, with no `self` and no player's state swapped in. Server-side.
|
||||
/// @API:entity_data_to@.
|
||||
/// 519.
|
||||
pub(super) fn native_entity_data_to(
|
||||
viewer: u128,
|
||||
entity: i32,
|
||||
@@ -7595,7 +7912,7 @@ impl Game<'_> {
|
||||
/// handled, from a dead player too, with the player's state swapped in, so `native_tell`
|
||||
/// answers them. A name already registered, not registered, past 128 kept or not printable
|
||||
/// ASCII with a `:` changes nothing and is not heard; `native_player_channels` lists them
|
||||
/// all. It only hears. Server-side, for every guest. @API:player_channels@.
|
||||
/// all. It only hears. Server-side, for every guest. 539.
|
||||
pub(super) fn native_player_register_channels(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7622,7 +7939,7 @@ impl Game<'_> {
|
||||
/// order, right after `native_player_logged_in`, with the hub in place and no player's state
|
||||
/// swapped in (a player disconnected for declining a required pack never logs in and is not
|
||||
/// heard). It only hears: a declined required pack is handled as before. Server-side.
|
||||
/// @API:resource_pack_status_v2@.
|
||||
/// 542.
|
||||
pub(super) fn native_resource_pack_status_v2(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7652,7 +7969,7 @@ impl Game<'_> {
|
||||
/// target that is neither a player nor a mob is not heard. Like
|
||||
/// `native_living_incoming_damage` there is no `self`: the mobs are out
|
||||
/// of the game while they tick. Server-side, on the thread that ticks the
|
||||
/// world. API @API:living_change_target@.
|
||||
/// world. API 528.
|
||||
pub(super) fn native_living_change_target(
|
||||
dimension: &str,
|
||||
entity: u32,
|
||||
@@ -7679,7 +7996,7 @@ impl Game<'_> {
|
||||
/// nothing, so a mod that claims the main hand's click hears one event per click. Set
|
||||
/// `cancel` to take the click: the hand swings and neither the entity's own `interact` nor
|
||||
/// the item's `interactLivingEntity` runs. A click v1 claimed is not asked here. Server-side,
|
||||
/// for every player of the world (the helpers read the acting one). @API:interact_entity_v2@.
|
||||
/// for every player of the world (the helpers read the acting one). 523.
|
||||
pub(super) fn native_interact_entity_v2(
|
||||
&mut self,
|
||||
entity: i32,
|
||||
@@ -7706,7 +8023,7 @@ impl Game<'_> {
|
||||
/// neither the block nor the item acts, the hand doesn't swing, and a guest sees the block as
|
||||
/// it is; that hand's turn ends the click, as a v1 cancel does. A click v1 canceled is not
|
||||
/// asked here. Server-side, for every player of the world (`native_acting_player` says who).
|
||||
/// @API:right_click_block_v2@.
|
||||
/// 544.
|
||||
pub(super) fn native_right_click_block_v2(
|
||||
&mut self,
|
||||
pos: [i32; 3],
|
||||
@@ -7722,7 +8039,7 @@ impl Game<'_> {
|
||||
/// has none of its own and names the hand holding the rod, the main hand first, as
|
||||
/// `FishingHook.shouldStopFishing` looks. Asked right after the unchanged v1 hook with the
|
||||
/// same `cancel`, which does what v1's does; one v1 set is not asked here. The player's state
|
||||
/// is swapped in. @API:player_fish_v2@.
|
||||
/// is swapped in. 540.
|
||||
pub(super) fn native_player_fish_v2(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7742,7 +8059,7 @@ impl Game<'_> {
|
||||
/// takes it from here. Not heard for a bobber in water, one hooked to an entity, nor the host
|
||||
/// of a LAN world's. It only hears; the bobber moves as it would. The player's state is
|
||||
/// swapped in, but the server's other players are out of reach (`native_tell` reaches nobody
|
||||
/// here). @API:fishing_hook_landed@.
|
||||
/// here). 520.
|
||||
pub(super) fn native_fishing_hook_landed(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7773,7 +8090,7 @@ impl Game<'_> {
|
||||
/// right after it with the amount v1 left: change `amount` or set `cancel`, which does what a
|
||||
/// v1 cancel does; a hit v1 canceled is not asked here. A player is named once they acted on
|
||||
/// the server (their first turn). No `self`, like v1: the game is in the middle of the hit.
|
||||
/// It runs on the server thread. @API:living_incoming_damage_v3@.
|
||||
/// It runs on the server thread. 529.
|
||||
pub(super) fn native_living_incoming_damage_v3(
|
||||
victim: u32,
|
||||
victim_uuid: Option<u128>,
|
||||
@@ -7808,7 +8125,7 @@ impl Game<'_> {
|
||||
/// `native_menu_closed` for the same window. The hub may be out of the
|
||||
/// game's hands and a player's state swapped in (it runs where the menu
|
||||
/// closed), so answer through `slots`; the helpers that take a UUID may
|
||||
/// see nothing. Server-side. API @API:menu_input@.
|
||||
/// see nothing. Server-side. API 531.
|
||||
pub(super) fn native_menu_input_closed(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -7827,7 +8144,7 @@ impl Game<'_> {
|
||||
/// encryption, as PacketEvents counts them. Called at most twice a tick
|
||||
/// per player, only with packets; a stalled tick keeps at most 65536 each
|
||||
/// way. PacketEvents' send and receive events, batched. API
|
||||
/// @API:server_packets@.
|
||||
/// 547.
|
||||
pub(super) fn native_server_packets(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -7846,7 +8163,7 @@ impl Game<'_> {
|
||||
/// what a profiler such as spark samples, by step instead of stack. The
|
||||
/// tick's own clock (`native_tick_times`) also counts the work after the
|
||||
/// pass (the idle kick, the next tick's wait). API
|
||||
/// @API:server_tick_timed@.
|
||||
/// 548.
|
||||
pub(super) fn native_server_tick_timed(
|
||||
&mut self,
|
||||
wall_ms: f32,
|
||||
@@ -8283,7 +8600,7 @@ impl Game<'_> {
|
||||
/// A wind burst is about to interact with its shuffled block positions.
|
||||
/// Remove positions to protect their blocks. Knockback and the vanilla
|
||||
/// shuffle have already run; this does not change either. Server-side.
|
||||
/// Pending API @API:wind_burst@.
|
||||
/// Pending API 563.
|
||||
pub(super) fn native_wind_burst(
|
||||
&mut self,
|
||||
dimension: &str,
|
||||
@@ -9237,7 +9554,7 @@ impl Game<'_> {
|
||||
/// Players, mobs and the ender dragon. It runs on the thread that ticks
|
||||
/// the world (the server thread): state shared with render thread hooks
|
||||
/// needs synchronising. No `self`: the game is in the middle of the hit.
|
||||
/// API @API:living_damage@.
|
||||
/// API 435.
|
||||
pub(super) fn native_living_damage_pre(
|
||||
entity: i32,
|
||||
kind: &str,
|
||||
@@ -9261,7 +9578,7 @@ impl Game<'_> {
|
||||
/// 0 when nothing did (absorption took it all, or a mod made it 0), after
|
||||
/// the combat tracker. The arguments are
|
||||
/// `native_living_damage_pre`'s. It only hears, on the server thread, with
|
||||
/// no `self`. API @API:living_damage@.
|
||||
/// no `self`. API 435.
|
||||
pub(super) fn native_living_damage_post(
|
||||
entity: i32,
|
||||
kind: &str,
|
||||
@@ -10054,7 +10371,7 @@ impl Game<'_> {
|
||||
/// client, for a bad name, category, position, volume or pitch, and for
|
||||
/// a player who isn't on (inside another player's hook, where the
|
||||
/// players are out of reach, such a player just gets nothing). API
|
||||
/// @API:play_sound_to@.
|
||||
/// 538.
|
||||
pub(super) fn native_play_sound_to(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -10103,7 +10420,7 @@ impl Game<'_> {
|
||||
/// leaves at the tick's end, so it works from any server hook; true
|
||||
/// means queued. False on a client, for options or numbers that can't
|
||||
/// be sent, and for a player who isn't on (inside another player's
|
||||
/// hook, such a player just gets nothing). API @API:send_particles_to@.
|
||||
/// hook, such a player just gets nothing). API 545.
|
||||
pub(super) fn native_send_particles_to(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -10170,7 +10487,7 @@ impl Game<'_> {
|
||||
/// player, whose packets go after the hook. False on a client, for a
|
||||
/// negative time, and for a player who isn't on or can't be reached
|
||||
/// from here (another player inside a player's hook), as `native_tell`.
|
||||
/// API @API:title@.
|
||||
/// API 553.
|
||||
pub(super) fn native_title(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -10209,7 +10526,7 @@ impl Game<'_> {
|
||||
/// see it when they come back), until a mod takes it away or the server
|
||||
/// stops. Works from any server hook. False on a client, and for a
|
||||
/// progress outside 0 to 1 or a colour or overlay `BossEvent` hasn't.
|
||||
/// API @API:boss_bar@.
|
||||
/// API 515.
|
||||
pub(super) fn native_boss_bar(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -10257,7 +10574,7 @@ impl Game<'_> {
|
||||
/// False on a client, for a dimension that isn't a namespaced id or a
|
||||
/// position a block position can't carry, and for a player who isn't
|
||||
/// on (inside another player's hook, such a player just gets nothing).
|
||||
/// API @API:compass_target@.
|
||||
/// API 518.
|
||||
pub(super) fn native_set_compass_target(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -10287,7 +10604,7 @@ impl Game<'_> {
|
||||
/// {"minecraft:damage":5}}`): vanilla's `TagParser`, then
|
||||
/// `ItemStack.CODEC`. None when the text is not one compound (whitespace
|
||||
/// around it aside), for air, and for an item this world does not have.
|
||||
/// Works on a client and a server alike. API @API:item_from_snbt@.
|
||||
/// Works on a client and a server alike. API 525.
|
||||
#[allow(dead_code)]
|
||||
pub(super) fn native_item_from_snbt(&self, snbt: &str) -> Option<ItemStack> {
|
||||
let (tag, read) = horizon_world::nbt::parse_snbt(snbt).ok()?;
|
||||
@@ -10312,7 +10629,7 @@ impl Game<'_> {
|
||||
/// saved with the world's maps and goes, like any map, to whoever carries
|
||||
/// it or sees it framed, players who join later included. A
|
||||
/// `minecraft:filled_map` with this `minecraft:map_id` shows it. None on
|
||||
/// a client of a server and with no world open. API @API:new_map@.
|
||||
/// a client of a server and with no world open. API 532.
|
||||
#[allow(dead_code)]
|
||||
pub(super) fn native_new_map(&mut self, dimension: &str, colors: &[u8; 16384]) -> Option<i32> {
|
||||
if self.remote.is_some() || self.world_root.as_os_str().is_empty() {
|
||||
@@ -10330,7 +10647,7 @@ impl Game<'_> {
|
||||
/// carrying it or seeing it framed. An unlocked map is still drawn over
|
||||
/// where its holders explore, as vanilla's are. False for a map this
|
||||
/// world never made or saved, and on a client of a server.
|
||||
/// API @API:new_map@.
|
||||
/// API 532.
|
||||
#[allow(dead_code)]
|
||||
pub(super) fn native_paint_map(&mut self, map_id: i32, colors: &[u8; 16384]) -> bool {
|
||||
if self.remote.is_some() {
|
||||
@@ -10342,7 +10659,7 @@ impl Game<'_> {
|
||||
map.paint(colors);
|
||||
true
|
||||
}
|
||||
/// Effective HUD mode. Pending API @API:hud_mode@.
|
||||
/// Effective HUD mode. Pending API 569.
|
||||
pub(super) fn native_hud_mode(&self) -> HudMode {
|
||||
self.ui.hud_mode()
|
||||
}
|
||||
@@ -10501,7 +10818,7 @@ impl Game<'_> {
|
||||
/// The default state of the block named `block`, `minecraft:air` or
|
||||
/// `mymod:cable` (`Block.defaultBlockState`), what `native_set_block` takes:
|
||||
/// a machine clearing or placing a block by name. None for an unknown
|
||||
/// block. API @API:default_state@.
|
||||
/// block. API 444.
|
||||
pub(super) fn native_default_state(&self, block: &str) -> Option<BlockStateId> {
|
||||
self.pack.assets.registry.default_state(block)
|
||||
}
|
||||
@@ -10840,7 +11157,7 @@ impl Game<'_> {
|
||||
/// Requests vanilla's menu background blur for this frame, with a per-frame guard
|
||||
/// so blur is applied at most once per frame. Returns true if blur was newly
|
||||
/// requested this frame, or false if it was already applied/requested this frame.
|
||||
/// API @API:screen_transparent_background@.
|
||||
/// API 442.
|
||||
pub(super) fn native_apply_screen_blur(&self) -> bool {
|
||||
if self.screen_blur_requested.get() {
|
||||
return false;
|
||||
@@ -10849,14 +11166,14 @@ impl Game<'_> {
|
||||
true
|
||||
}
|
||||
/// The user's configured menu background blur radius (`menuBackgroundBlurriness` in options.txt,
|
||||
/// usually 0.0 to 10.0; default 5.0). 0.0 means blur is turned off. API @API:screen_transparent_background@.
|
||||
/// usually 0.0 to 10.0; default 5.0). 0.0 means blur is turned off. API 442.
|
||||
pub(super) fn native_menu_blur_radius(&self) -> f32 {
|
||||
self.settings.menu_blur as f32
|
||||
}
|
||||
/// `Screen.renderMenuBackground`: draws the tiled menu background (32x32) across `rect`
|
||||
/// (`[x, y, w, h]` in GUI pixels). If `in_world` is true, uses the dark translucent
|
||||
/// texture (`gui/inworld_menu_background`); otherwise uses the opaque dirt-like
|
||||
/// texture (`gui/menu_background`). API @API:screen_transparent_background@.
|
||||
/// texture (`gui/menu_background`). API 442.
|
||||
pub(super) fn native_draw_menu_background(
|
||||
&self,
|
||||
batch: &mut HudBatch,
|
||||
@@ -10868,7 +11185,7 @@ impl Game<'_> {
|
||||
}
|
||||
/// Repeats sprite `sprite` across `rect` (`[x, y, w, h]` in GUI pixels) with each tile
|
||||
/// sized `size` GUI pixels square, tinted by `argb`. False when the sprite is not in the HUD atlas.
|
||||
/// API @API:screen_transparent_background@.
|
||||
/// API 442.
|
||||
pub(super) fn native_tiled_sprite(
|
||||
&self,
|
||||
batch: &mut HudBatch,
|
||||
@@ -11039,14 +11356,14 @@ impl Game<'_> {
|
||||
/// `native_health_hud`. `layout` draws Horizon's rows and advances their
|
||||
/// frame state (the hearts' blink, the bubble pop sound), so call it at
|
||||
/// most once a frame, and only when you keep some of its rows.
|
||||
/// API @API:health_hud_state@.
|
||||
/// API 428.
|
||||
pub(super) fn native_health_hud_state(&mut self) -> &mut HealthHud {
|
||||
&mut self.health_hud
|
||||
}
|
||||
/// The current value, base plus modifiers, of this client's player's
|
||||
/// attribute `name` (`minecraft:armor_toughness`), as vanilla's
|
||||
/// `LivingEntity.getAttributeValue`. None with no player, or for an id
|
||||
/// the player has no attribute for. API @API:health_hud_state@.
|
||||
/// the player has no attribute for. API 428.
|
||||
pub(super) fn native_local_attribute(&mut self, name: &str) -> Option<f64> {
|
||||
self.player.as_mut()?.attribute(name).ok()
|
||||
}
|
||||
@@ -11069,7 +11386,7 @@ impl Game<'_> {
|
||||
/// The biome at `pos` (`minecraft:plains`, a data pack's own), as
|
||||
/// `Level.getBiome` picks it through `BiomeManager`'s zoom: on a client,
|
||||
/// from the chunks the server sent. None where that chunk isn't loaded.
|
||||
/// API @API:session_state@.
|
||||
/// API 559.
|
||||
pub(super) fn native_biome(&self, pos: [i32; 3]) -> Option<String> {
|
||||
let at = BlockPos::new(pos[0], pos[1], pos[2]);
|
||||
let [x, y, z] = self.streaming.biome_zoom.quart_at_block(at);
|
||||
@@ -11222,7 +11539,7 @@ impl Game<'_> {
|
||||
/// where the WebAssembly mod of the same id kept its storage, so a
|
||||
/// player's settings carry over. Every world shares it: keep a world's
|
||||
/// files under a folder named from `NativeClientState.world`. Not
|
||||
/// created here. API @API:session_state@.
|
||||
/// created here. API 559.
|
||||
pub(super) fn native_data_dir(&self, mod_id: &str) -> PathBuf {
|
||||
let mods = Self::game_dir().join(mod_list::DIR);
|
||||
mods.join(".horizon-mod-data").join(mod_id)
|
||||
|
||||
@@ -22,7 +22,7 @@ impl Game<'_> {
|
||||
/// (`native_block_entity_update_tag`, merged into `nbt`), with no item
|
||||
/// slots. None for another kind of block entity, a block with none, and
|
||||
/// on a server for the one ticking now, which is out of the world (as
|
||||
/// for `native_with_mod_block_entity`). API @API:host_bridge@.
|
||||
/// for `native_with_mod_block_entity`). API 414.
|
||||
pub(super) fn native_mod_block_entity(&self, pos: [i32; 3]) -> Option<ModBlockEntity> {
|
||||
match self.world.block_entities.get(&(pos[0], pos[1], pos[2])) {
|
||||
Some(BlockEntity::Mod(m)) if !m.id.is_empty() => Some(ModBlockEntity::clone(m)),
|
||||
@@ -36,7 +36,7 @@ impl Game<'_> {
|
||||
/// comparators read it again when its items changed. False, with
|
||||
/// `change` not run, where `native_with_mod_block_entity` finds none.
|
||||
/// Call `native_block_entity_sync` too when what clients draw changed.
|
||||
/// API @API:host_bridge@.
|
||||
/// API 414.
|
||||
pub(super) fn native_change_mod_block_entity(
|
||||
&mut self,
|
||||
pos: [i32; 3],
|
||||
@@ -51,7 +51,7 @@ impl Game<'_> {
|
||||
/// (`Level.playSound` with no player): a machine's hum from its block
|
||||
/// entity's tick. `source` is the `SoundSource` ordinal (4 for
|
||||
/// `BLOCKS`). True when queued, not heard; false off a server and where
|
||||
/// the level host's `play_sound` refuses. API @API:host_bridge@.
|
||||
/// the level host's `play_sound` refuses. API 414.
|
||||
pub(super) fn native_play_sound_in_place(
|
||||
&mut self,
|
||||
sound: &str,
|
||||
@@ -71,7 +71,7 @@ impl Game<'_> {
|
||||
/// see `count` particles spread by `spread` (a zero count sends one
|
||||
/// moving `speed` along `spread`). `state` is the block of block
|
||||
/// particles. True when accepted; false off a server and where the level
|
||||
/// host's `send_particles` refuses. API @API:host_bridge@.
|
||||
/// host's `send_particles` refuses. API 414.
|
||||
pub(super) fn native_send_particles_in_place(
|
||||
&mut self,
|
||||
options: &ParticleOptions,
|
||||
@@ -93,7 +93,7 @@ impl Game<'_> {
|
||||
/// (`LivingEntity.getItemBySlot`): on a client the player's own, as
|
||||
/// goggles worn or a tank on the back show their overlay; on a server the
|
||||
/// acting player's. None for an empty slot, and for `Body` and `Saddle`,
|
||||
/// which a player has none of. API @API:host_bridge@.
|
||||
/// which a player has none of. API 414.
|
||||
pub(super) fn native_equipment(&self, slot: EquipmentSlot) -> Option<ItemStack> {
|
||||
match slot {
|
||||
// The selected slot, not `held`: that is the acting hand, the off hand's stack during
|
||||
@@ -114,7 +114,7 @@ impl Game<'_> {
|
||||
/// wrench that picks a block up rather than turning it, a crank turned
|
||||
/// backwards. On a server the acting guest's, as their use runs
|
||||
/// (`as_guest` holds sneak for them); on a client the player's own key.
|
||||
/// API @API:host_bridge@.
|
||||
/// API 414.
|
||||
pub(super) fn native_sneaking(&self) -> bool {
|
||||
self.keys.held(Action::Sneak)
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ impl Game<'_> {
|
||||
/// inventory loaded from elsewhere. Live or their file, as
|
||||
/// `native_inventory`; a player on the server is sent their whole
|
||||
/// inventory at once. Err as `native_inventory`, or for a wrong number
|
||||
/// of slots or a `selected` past the hotbar. @API:set_inventory@.
|
||||
/// of slots or a `selected` past the hotbar. 506.
|
||||
pub(super) fn native_set_inventory(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -332,7 +332,7 @@ impl Game<'_> {
|
||||
/// there (Bukkit's `setItem`, checked like `native_move_stack`). Live or
|
||||
/// their file; a player's screen follows with the tick's sync. Err as
|
||||
/// `native_inventory`, for no such slot, or when the slot changed.
|
||||
/// @API:set_inventory_slot@.
|
||||
/// 507.
|
||||
pub(super) fn native_set_inventory_slot(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -356,7 +356,7 @@ impl Game<'_> {
|
||||
/// or none, and returns them in order. Live or their file; a player's
|
||||
/// screen follows with the tick's sync. Err as `native_inventory`, for a
|
||||
/// slot named twice, or when one changed (nothing is taken then).
|
||||
/// @API:set_inventory_slot@.
|
||||
/// 507.
|
||||
pub(super) fn native_take_stacks(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -450,7 +450,7 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Another player's inventory in a menu, for server mods. API @API:inventory_menu@.
|
||||
/// Another player's inventory in a menu, for server mods. API 524.
|
||||
#[allow(dead_code)]
|
||||
impl Game<'_> {
|
||||
/// Opens a chest menu of `rows` rows titled `title` for the player
|
||||
@@ -472,7 +472,7 @@ impl Game<'_> {
|
||||
/// never seen here, a layout longer than the rows' slots, a slot number
|
||||
/// past the inventory or one shown twice, and inside a player's turn
|
||||
/// (call it from `native_menu_clicked` or `native_server_tick`).
|
||||
/// API @API:inventory_menu@.
|
||||
/// API 524.
|
||||
pub(super) fn native_open_inventory_menu(
|
||||
&mut self,
|
||||
viewer: u128,
|
||||
|
||||
@@ -22,7 +22,7 @@ impl Game<'_> {
|
||||
/// `ServerLevel.playSound(null, ...)` does: `source` indexes
|
||||
/// `SoundSource` (`master` 0, `blocks` 4...). A `minecraft:` event must be
|
||||
/// registered; a mod's goes by name and is heard where its resources
|
||||
/// define it. True means queued, not heard. API @API:level_effects@.
|
||||
/// define it. True means queued, not heard. API 566.
|
||||
pub(super) fn native_level_play_sound(
|
||||
&mut self,
|
||||
level: LevelRef,
|
||||
@@ -53,7 +53,7 @@ impl Game<'_> {
|
||||
/// a Gaussian times `spread`, and `speed` scales their motion (a zero
|
||||
/// count sends one particle moving along `spread`). Block particle types
|
||||
/// need `state`; item, trail and vibration particles aren't supported.
|
||||
/// True means queued, not drawn. API @API:level_effects@.
|
||||
/// True means queued, not drawn. API 566.
|
||||
pub(super) fn native_level_send_particles(
|
||||
&mut self,
|
||||
level: LevelRef,
|
||||
|
||||
@@ -13,19 +13,19 @@ fn weather_flags((rain, thunder): (f32, f32)) -> (bool, bool) {
|
||||
|
||||
impl Game<'_> {
|
||||
/// The world's seed (`WorldOptions.seed`), as `/seed` shows it. API
|
||||
/// @API:level_world@.
|
||||
/// 565.
|
||||
pub(super) fn native_level_seed(&self, level: LevelRef) -> Option<i64> {
|
||||
self.native_level_world(level)?;
|
||||
Some(self.level.seed)
|
||||
}
|
||||
/// The difficulty (`Level.getDifficulty`): `peaceful`, `easy`, `normal`
|
||||
/// or `hard`, as `/difficulty` names it. API @API:level_world@.
|
||||
/// or `hard`, as `/difficulty` names it. API 565.
|
||||
pub(super) fn native_level_difficulty(&self, level: LevelRef) -> Option<&'static str> {
|
||||
self.native_level_world(level)?;
|
||||
DIFFICULTIES.get(usize::from(self.ui.difficulty)).copied()
|
||||
}
|
||||
/// Game rule `rule` (`minecraft:keep_inventory` or `keep_inventory`), as
|
||||
/// `/gamerule` queries it: None for an unknown rule. API @API:level_world@.
|
||||
/// `/gamerule` queries it: None for an unknown rule. API 565.
|
||||
pub(super) fn native_level_game_rule(
|
||||
&self,
|
||||
level: LevelRef,
|
||||
@@ -37,7 +37,7 @@ impl Game<'_> {
|
||||
}
|
||||
/// The rain and thunder levels, each 0.0 to 1.0 (`Level.getRainLevel`,
|
||||
/// `getThunderLevel`): both 0 in a level with no weather, as the Nether
|
||||
/// and the End. API @API:level_world@.
|
||||
/// and the End. API 565.
|
||||
pub(super) fn native_level_weather(&self, level: LevelRef) -> Option<(f32, f32)> {
|
||||
let world = self.native_level_world(level)?;
|
||||
if level.dimension() != super::Dim::Overworld.id() {
|
||||
@@ -46,12 +46,12 @@ impl Game<'_> {
|
||||
Some(world.weather.levels(1.0))
|
||||
}
|
||||
/// Whether it rains (`Level.isRaining`: a rain level above 0.2). API
|
||||
/// @API:level_world@.
|
||||
/// 565.
|
||||
pub(super) fn native_level_is_raining(&self, level: LevelRef) -> Option<bool> {
|
||||
Some(weather_flags(self.native_level_weather(level)?).0)
|
||||
}
|
||||
/// Whether it thunders (`Level.isThundering`: a thunder level above 0.9).
|
||||
/// API @API:level_world@.
|
||||
/// API 565.
|
||||
pub(super) fn native_level_is_thundering(&self, level: LevelRef) -> Option<bool> {
|
||||
Some(weather_flags(self.native_level_weather(level)?).1)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Living entities for native server mods, through a `LivingRef`
|
||||
//! (docs/native-mods.md, "Entity and level handles", #7387): the equipment
|
||||
//! of mobs, players and armor stands. Reads return `None`, writes false, for
|
||||
//! a stale handle. On a client (API @API:client_entity_refs@) reads give the
|
||||
//! a stale handle. On a client (API 426) reads give the
|
||||
//! equipment the server synced (`ClientboundSetEquipmentPacket`, and this
|
||||
//! window's own inventory), and writes are refused.
|
||||
use super::Game;
|
||||
|
||||
@@ -32,7 +32,7 @@ impl Game<'_> {
|
||||
/// (a harvester storing them); without, they pop as item entities and the
|
||||
/// list is empty. Nothing drops where `doTileDrops` is off. None, with
|
||||
/// nothing broken, for air, an unloaded block and off a server.
|
||||
/// API @API:machine_breaking@.
|
||||
/// API 416.
|
||||
pub(super) fn native_machine_destroy_block(
|
||||
&mut self,
|
||||
pos: [i32; 3],
|
||||
@@ -72,7 +72,7 @@ impl Game<'_> {
|
||||
/// crack away. A machine passes an id of its own that no entity has (a
|
||||
/// negative one), the same each time, so a new stage replaces its old one;
|
||||
/// a crack not renewed for 400 ticks fades. Off a server nothing happens.
|
||||
/// API @API:machine_breaking@.
|
||||
/// API 416.
|
||||
pub(super) fn native_set_break_progress(&mut self, breaker: i32, pos: [i32; 3], progress: i32) {
|
||||
if !self.native_authoritative() {
|
||||
return;
|
||||
@@ -98,7 +98,7 @@ impl Game<'_> {
|
||||
/// None, with nothing used, off a server and while a player's action is
|
||||
/// being run (from inside a player's hook: run it from a block entity's
|
||||
/// tick).
|
||||
/// API @API:fake_player@.
|
||||
/// API 415.
|
||||
pub(super) fn native_use_as_player(
|
||||
&mut self,
|
||||
stack: ItemStack,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! The stacks of a server-opened menu for native client mods
|
||||
//! (docs/native-mods.md, "Entity and level handles", API
|
||||
//! @API:client_entity_refs@): what the window shows in each slot, as the
|
||||
//! 426): what the window shows in each slot, as the
|
||||
//! server last synced it, where `NativeScreenView` only counts the slots.
|
||||
use super::Game;
|
||||
use horizon_client::items::ItemStack;
|
||||
@@ -12,7 +12,7 @@ impl Game<'_> {
|
||||
/// own slots, then the player's inventory and hotbar below it. An empty
|
||||
/// slot is None. None on a server, while no server-opened menu is up (the
|
||||
/// window's own inventory, creative), and for a menu whose slots the
|
||||
/// client doesn't lay out (a lectern). API @API:client_entity_refs@.
|
||||
/// client doesn't lay out (a lectern). API 426.
|
||||
pub(super) fn native_menu_stacks(&mut self) -> Option<Vec<Option<ItemStack>>> {
|
||||
let (_, menu) = self.remote.as_ref()?.menu.clone()?;
|
||||
let slots: Vec<usize> = (0..).map_while(|s| Self::menu_slot(&menu, s)).collect();
|
||||
|
||||
@@ -163,7 +163,7 @@ impl Game<'_> {
|
||||
/// reason, the input slots go to `native_menu_input_closed` and what the
|
||||
/// mods leave there goes back to the player (`clearContainer`). None
|
||||
/// for a player not here, or `input` empty or past the rows' slots.
|
||||
/// API @API:menu_input@.
|
||||
/// API 531.
|
||||
pub(super) fn native_open_menu_with_input(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -185,7 +185,7 @@ impl Game<'_> {
|
||||
}
|
||||
/// What the player's open native menu holds, by slot: the items the mod
|
||||
/// shows and what the player put in its input slots. None while no menu
|
||||
/// a mod opened is open. API @API:menu_input@.
|
||||
/// a mod opened is open. API 531.
|
||||
pub(super) fn native_menu_contents(&self, uuid: u128) -> Option<Vec<Option<ItemStack>>> {
|
||||
let host = self.lan.as_ref()?;
|
||||
let g = host
|
||||
@@ -199,7 +199,7 @@ impl Game<'_> {
|
||||
/// The stack on the player's cursor: inside `native_menu_clicked`, the
|
||||
/// one they held as they made that click (a click on the mod's own slots
|
||||
/// moves nothing, so it is still there); else the one they hold now.
|
||||
/// None for an empty cursor or a player not here. API @API:menu_input@.
|
||||
/// None for an empty cursor or a player not here. API 531.
|
||||
pub(super) fn native_menu_cursor(&self, uuid: u128) -> Option<ItemStack> {
|
||||
if let Some((player, cursor)) = &self.native_click_cursor
|
||||
&& *player == uuid
|
||||
|
||||
@@ -160,7 +160,7 @@ impl Game<'_> {
|
||||
/// chunk unloads: its id. None for a kind the game doesn't know, a
|
||||
/// position outside `/summon`'s bounds or in a chunk that isn't
|
||||
/// loaded (it would never tick or be saved), or a monster on peaceful (it
|
||||
/// would despawn at once). API 37. Since API @API:npc_any_level@,
|
||||
/// would despawn at once). API 37. Since API 533,
|
||||
/// `dimension` may be any level the server has loaded, which is put in
|
||||
/// place for the spawn (`execute in <dimension> run summon`), so a
|
||||
/// `native_server_tick` hook spawns too; a level not loaded is refused.
|
||||
|
||||
@@ -197,7 +197,7 @@ impl Game<'_> {
|
||||
/// hook (Bukkit's `Player.sendPluginMessage`). Ok means queued: a player
|
||||
/// who isn't on by then gets nothing. Nothing counts these; the bytes
|
||||
/// are the mod's to get right. An error on a client, and for a bad
|
||||
/// channel or size. API @API:send_custom_payload_to_player@.
|
||||
/// channel or size. API 502.
|
||||
pub(super) fn native_send_custom_payload_to_player(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -286,7 +286,7 @@ impl Game<'_> {
|
||||
/// macro can fill in `/tp ` for the player to finish. Nothing is sent; the
|
||||
/// player edits and sends it, or presses Escape. The box keeps its limit
|
||||
/// (256 characters) and its character filter. An error with no player in a
|
||||
/// world, or while another screen is open. API @API:open_chat@.
|
||||
/// world, or while another screen is open. API 456.
|
||||
pub(super) fn native_open_chat(&mut self, text: &str) -> Result<(), String> {
|
||||
if self.player.is_none() {
|
||||
return Err("no player in a world".into());
|
||||
|
||||
@@ -19,7 +19,7 @@ impl Game<'_> {
|
||||
/// A server's player is found too (`minecraft:player`, in its level). None
|
||||
/// on a client, for no such entity, and for a player while a guest's
|
||||
/// packet is handled (the hub is taken out then): call it from a tick or
|
||||
/// console hook. API @API:npc_entity_by_uuid@.
|
||||
/// console hook. API 534.
|
||||
pub(super) fn native_entity_by_uuid(&mut self, uuid: u128) -> Option<(String, u32, String)> {
|
||||
if self.remote.is_some() || self.options.execution_role.is_client() {
|
||||
return None;
|
||||
@@ -66,7 +66,7 @@ impl Game<'_> {
|
||||
/// level (with `native_entity_by_uuid`, an entity found by its UUID).
|
||||
/// False on a client, for a level not loaded, no such entity, or what
|
||||
/// `native_entity_merge_nbt` refuses (a player, a kind Horizon can't
|
||||
/// reload yet, data that changes nothing). API @API:npc_entity_by_uuid@.
|
||||
/// reload yet, data that changes nothing). API 534.
|
||||
pub(super) fn native_merge_entity_nbt(
|
||||
&mut self,
|
||||
dimension: &str,
|
||||
@@ -90,7 +90,7 @@ impl Game<'_> {
|
||||
/// with `native_mob_look_at` instead, or spawn it with `no_ai`. False on
|
||||
/// a client, for a level not loaded, no such entity (a player is turned
|
||||
/// by teleporting them), another kind, or an angle that isn't finite.
|
||||
/// API @API:npc_entity_rotation@.
|
||||
/// API 535.
|
||||
pub(super) fn native_set_entity_rotation(
|
||||
&mut self,
|
||||
dimension: &str,
|
||||
@@ -141,7 +141,7 @@ impl Game<'_> {
|
||||
/// over, as they do from vanilla's callers: call it again (an NPC
|
||||
/// library's navigator does so each tick) or give the mob goals of its
|
||||
/// own (`native_register_goals`). A mob with `no_ai` keeps the path but
|
||||
/// doesn't walk it. API @API:npc_mob_navigation@.
|
||||
/// doesn't walk it. API 537.
|
||||
pub(super) fn native_mob_navigate(
|
||||
&mut self,
|
||||
dimension: &str,
|
||||
@@ -166,7 +166,7 @@ impl Game<'_> {
|
||||
/// path to where it is now: to follow it, call it again as it moves
|
||||
/// (vanilla's follow and attack goals ask every few ticks). False as
|
||||
/// `native_mob_navigate`, or for no such target in that level. API
|
||||
/// @API:npc_mob_navigation@.
|
||||
/// 537.
|
||||
pub(super) fn native_mob_follow(
|
||||
&mut self,
|
||||
dimension: &str,
|
||||
@@ -187,14 +187,14 @@ impl Game<'_> {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
/// Stops mob `mob`'s walk (`PathNavigation.stop`): false for a level not
|
||||
/// loaded or no such living mob. API @API:npc_mob_navigation@.
|
||||
/// loaded or no such living mob. API 537.
|
||||
pub(super) fn native_mob_stop(&mut self, dimension: &str, mob: u32) -> bool {
|
||||
self.npc_drive(dimension, mob, |m, _| m.nav_stop())
|
||||
.is_some()
|
||||
}
|
||||
/// Whether mob `mob` is walking a path (`PathNavigation.isInProgress`):
|
||||
/// false once it arrived, got stuck or was stopped, and for a level not
|
||||
/// loaded or no such living mob. API @API:npc_mob_navigation@.
|
||||
/// loaded or no such living mob. API 537.
|
||||
pub(super) fn native_mob_navigating(&mut self, dimension: &str, mob: u32) -> bool {
|
||||
self.npc_in_level(dimension, |g| {
|
||||
g.mobs
|
||||
@@ -209,7 +209,7 @@ impl Game<'_> {
|
||||
/// holds for that tick only, so call it each tick to keep looking; a mob
|
||||
/// with `no_ai` doesn't turn (`native_set_entity_rotation` turns it).
|
||||
/// False for a level not loaded, no such living mob or a point that isn't
|
||||
/// finite. API @API:npc_mob_navigation@.
|
||||
/// finite. API 537.
|
||||
pub(super) fn native_mob_look_at(&mut self, dimension: &str, mob: u32, at: [f64; 3]) -> bool {
|
||||
if !at.into_iter().all(f64::is_finite) {
|
||||
return false;
|
||||
@@ -227,7 +227,7 @@ impl Game<'_> {
|
||||
/// when the blow was dealt (whether it hurt is the damage hooks' to
|
||||
/// tell); false for a level not loaded, no such living mob or target, the
|
||||
/// mob itself, or a player while a guest's packet is handled (the hub is
|
||||
/// taken out then). API @API:npc_mob_attack@.
|
||||
/// taken out then). API 536.
|
||||
pub(super) fn native_mob_attack(&mut self, dimension: &str, mob: u32, target: u32) -> bool {
|
||||
if mob == target {
|
||||
return false;
|
||||
|
||||
@@ -94,7 +94,7 @@ impl Game<'_> {
|
||||
/// `native_server_packet`, decoded, until the server stops; there is no
|
||||
/// switching it off, so one mod can't silence another's. Until a mod calls
|
||||
/// this, nothing is decoded or copied. Any thread, any time, a client
|
||||
/// included (where nothing is sent). @API:server_packet@.
|
||||
/// included (where nothing is sent). 546.
|
||||
pub(super) fn native_watch_server_packets(&self) {
|
||||
horizon_client::lan::conn::WATCHED
|
||||
.fetch_or(horizon_client::lan::conn::WATCH_ALL, Ordering::Relaxed);
|
||||
@@ -103,7 +103,7 @@ impl Game<'_> {
|
||||
/// (`ClientboundSetEntityDataPacket`) reaches `native_entity_data_to`,
|
||||
/// until the server stops; only that packet is decoded for it. As
|
||||
/// `native_watch_server_packets`, it cannot be switched off and works
|
||||
/// from any thread. @API:entity_data_to@.
|
||||
/// from any thread. 519.
|
||||
pub(super) fn native_watch_entity_data(&self) {
|
||||
horizon_client::lan::conn::WATCHED.fetch_or(
|
||||
horizon_client::lan::conn::WATCH_ENTITY_DATA,
|
||||
@@ -115,7 +115,7 @@ impl Game<'_> {
|
||||
/// registered them: what Bukkit's `Player.getListeningPluginChannels` gives. Horizon keeps
|
||||
/// at most 128 names of at most 256 bytes, printable ASCII with a `:`. Empty for a player
|
||||
/// who isn't on, on a client, and inside a player's own hook, the hub being out then
|
||||
/// (`native_player_register_channels` names what changed). @API:player_channels@.
|
||||
/// (`native_player_register_channels` names what changed). 539.
|
||||
pub(super) fn native_player_channels(&self, player: u128) -> Vec<String> {
|
||||
let Some(host) = &self.lan else {
|
||||
return Vec::new();
|
||||
@@ -139,7 +139,7 @@ impl Game<'_> {
|
||||
/// the answer. False when the player isn't on, on a client, for an empty
|
||||
/// URL, one past 32767 characters or a hash past 40. Works from
|
||||
/// `native_server_tick` and the player's own hooks, as `native_send`.
|
||||
/// @API:resource_packs@.
|
||||
/// 543.
|
||||
pub(super) fn native_send_resource_pack(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -165,7 +165,7 @@ impl Game<'_> {
|
||||
/// has for None (`ClientboundResourcePackPopPacket`, Bukkit's
|
||||
/// `Player.removeResourcePack` and `removeResourcePacks`); the client
|
||||
/// reloads without it. False when the player isn't on or on a client, as
|
||||
/// `native_send`. @API:resource_packs@.
|
||||
/// `native_send`. 543.
|
||||
pub(super) fn native_pop_resource_pack(&mut self, player: u128, id: Option<u128>) -> bool {
|
||||
self.native_send(player, C::ResourcePackPop(ResourcePackPop { id }))
|
||||
}
|
||||
@@ -175,7 +175,7 @@ impl Game<'_> {
|
||||
/// end, from any server hook, the kicked player's own included. True when it is queued:
|
||||
/// false on a client, in a world nobody else can join, and for a player who isn't on when
|
||||
/// the hub can tell (a player gone by the tick's end is not kicked either).
|
||||
/// @API:kick@.
|
||||
/// 526.
|
||||
pub(super) fn native_kick(&mut self, player: u128, reason: &Text) -> bool {
|
||||
if self.remote.is_some() || (self.serving.is_none() && self.options.dedicated.is_none()) {
|
||||
return false;
|
||||
|
||||
@@ -14,7 +14,7 @@ impl Game<'_> {
|
||||
/// level; 0 is everyone). The level is the one the server holds for a
|
||||
/// player who is on or joining; inside a player's hook, with the hub out
|
||||
/// of reach, the acting player's. Anyone else, and every player on a
|
||||
/// client, counts as level 0. API @API:permission_check@.
|
||||
/// client, counts as level 0. API 471.
|
||||
pub(super) fn native_has_permission(
|
||||
&self,
|
||||
player: u128,
|
||||
@@ -30,7 +30,7 @@ impl Game<'_> {
|
||||
/// tick, so it works from any server hook, the player's own included
|
||||
/// (from the commands-sent hooks themselves it would send it every tick).
|
||||
/// True when the player is on (or is the acting player); false for
|
||||
/// anyone else and on a client. API @API:resend_commands@.
|
||||
/// anyone else and on a client. API 497.
|
||||
pub(super) fn native_resend_commands(&mut self, player: u128) -> bool {
|
||||
let on = self.lan_acting_uuid == Some(player)
|
||||
|| self
|
||||
|
||||
@@ -16,7 +16,7 @@ impl Game<'_> {
|
||||
/// What the player's client told the server (brand, `ClientInformation`) and what the server
|
||||
/// sent it, as Paper's `getClientBrandName`, `locale` and `getClientViewDistance` read it.
|
||||
/// None for a player who is not on, while the hub is out of reach, and on a client.
|
||||
/// API @API:player_client@.
|
||||
/// API 473.
|
||||
pub(super) fn native_player_client(&self, uuid: u128) -> Option<NativeClientInfo> {
|
||||
let (_, g) = self.hub_guest(uuid)?;
|
||||
Some(NativeClientInfo {
|
||||
@@ -34,7 +34,7 @@ impl Game<'_> {
|
||||
/// The player's statistics as vanilla saves them (`players/stats/<uuid>.json`:
|
||||
/// `{"stats": {"minecraft:custom": {"minecraft:jump": 3}}, "DataVersion": ..}`), as
|
||||
/// Bukkit's `getStatistic` reads them. None for a player who is not on and on a client.
|
||||
/// API @API:player_records@.
|
||||
/// API 487.
|
||||
pub(super) fn native_player_stats(&self, uuid: u128) -> Option<serde_json::Value> {
|
||||
if self.acting(uuid) {
|
||||
return Some(self.stats.to_json());
|
||||
@@ -45,7 +45,7 @@ impl Game<'_> {
|
||||
|
||||
/// One statistic of the player: its type and key (`minecraft:custom`,
|
||||
/// `minecraft:jump`; `custom`, `jump` mean the same), 0 when never counted. None for a
|
||||
/// player who is not on and on a client. API @API:player_records@.
|
||||
/// player who is not on and on a client. API 487.
|
||||
pub(super) fn native_player_stat(&self, uuid: u128, stat_type: &str, key: &str) -> Option<i32> {
|
||||
let stats = if self.acting(uuid) {
|
||||
&self.stats
|
||||
@@ -71,7 +71,7 @@ impl Game<'_> {
|
||||
/// `native_player_stats` gives (HuskSync's restore of a saved player). They are saved
|
||||
/// with the player and all go to the client at its next request, as after a join;
|
||||
/// scoreboard objectives that count a statistic are not told. False for a player who is
|
||||
/// not on and on a client. API @API:player_records@.
|
||||
/// not on and on a client. API 487.
|
||||
pub(super) fn native_set_player_stats(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -106,7 +106,7 @@ impl Game<'_> {
|
||||
/// The player's advancement progress as vanilla saves it (`players/advancements/<uuid>
|
||||
/// .json`: each advancement's obtained criteria with their dates and `done`), as Bukkit's
|
||||
/// `getAdvancementProgress` reads it. None for a player who is not on and on a client.
|
||||
/// API @API:player_records@.
|
||||
/// API 487.
|
||||
pub(super) fn native_player_advancements(&self, uuid: u128) -> Option<serde_json::Value> {
|
||||
let progress = if self.acting(uuid) {
|
||||
&self.adv.progress
|
||||
@@ -121,7 +121,7 @@ impl Game<'_> {
|
||||
/// when the file loads (`PlayerAdvancements.applyFrom`). The client is sent every
|
||||
/// advancement's progress again with the player's next tick; one newly done shows its toast,
|
||||
/// as a grant would, but gives no rewards. False for a player who is not on and on a client.
|
||||
/// API @API:player_records@.
|
||||
/// API 487.
|
||||
pub(super) fn native_set_player_advancements(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -153,35 +153,35 @@ impl Game<'_> {
|
||||
|
||||
/// The server's player limit (`max-players`, as `/list` shows it), as Bukkit's
|
||||
/// `Server.getMaxPlayers`. None while the hub is out of reach and on a client.
|
||||
/// API @API:server_files@.
|
||||
/// API 503.
|
||||
pub(super) fn native_max_players(&self) -> Option<u32> {
|
||||
let host = self.lan.as_ref()?;
|
||||
Some(host.hub.lan.shared.max_players().min(u32::MAX as usize) as u32)
|
||||
}
|
||||
|
||||
/// The dedicated server's folder (where `server.properties` is), absolute. None
|
||||
/// elsewhere. API @API:server_files@.
|
||||
/// elsewhere. API 503.
|
||||
pub(super) fn native_server_dir(&self) -> Option<PathBuf> {
|
||||
self.options.dedicated.as_ref()?;
|
||||
std::env::current_dir().ok()
|
||||
}
|
||||
|
||||
/// The log file this run writes (`logs/latest.log` of the server's or the game's folder),
|
||||
/// absolute; None when it logs to the terminal only. API @API:server_files@.
|
||||
/// absolute; None when it logs to the terminal only. API 503.
|
||||
pub(super) fn native_log_file(&self) -> Option<PathBuf> {
|
||||
horizon_client::logging::latest_path()
|
||||
}
|
||||
|
||||
/// The stack in the player's main hand, components and all (Bukkit's
|
||||
/// `getEquipment().getItemInMainHand()`). None for an empty hand, a player who is not on
|
||||
/// and on a client. API @API:player_equipment@.
|
||||
/// and on a client. API 478.
|
||||
pub(super) fn native_held_stack(&self, uuid: u128) -> Option<ItemStack> {
|
||||
self.native_player_equipment(uuid, EquipmentSlot::MainHand)
|
||||
}
|
||||
|
||||
/// The stack in one of the player's equipment slots (`LivingEntity.getItemBySlot`), from
|
||||
/// any server hook, the acting player's or another's. None for an empty slot, for `Body`
|
||||
/// and `Saddle`, for a player who is not on and on a client. API @API:player_equipment@.
|
||||
/// and `Saddle`, for a player who is not on and on a client. API 478.
|
||||
pub(super) fn native_player_equipment(
|
||||
&self,
|
||||
uuid: u128,
|
||||
|
||||
@@ -127,7 +127,7 @@ impl Game<'_> {
|
||||
/// give the player back elsewhere. None inside a player's turn (their
|
||||
/// live state is swapped out of their record: call from
|
||||
/// `native_server_tick`), and for a player not on. API
|
||||
/// @API:player_compound@.
|
||||
/// 476.
|
||||
pub(super) fn native_player_compound(&self, uuid: u128) -> Option<Tag> {
|
||||
match self.native_place(uuid)? {
|
||||
Place::Acting => None,
|
||||
@@ -159,7 +159,7 @@ impl Game<'_> {
|
||||
|
||||
/// The player `uuid`'s food level (0 to 20), saturation and exhaustion,
|
||||
/// as vanilla's `FoodData` holds them. None for a player not reached.
|
||||
/// API @API:player_status@.
|
||||
/// API 490.
|
||||
pub(super) fn native_player_food(&self, uuid: u128) -> Option<(i32, f32, f32)> {
|
||||
match self.native_place(uuid)? {
|
||||
Place::Acting => {
|
||||
@@ -191,7 +191,7 @@ impl Game<'_> {
|
||||
/// own turn, where it counts with what the turn did. False, and nothing
|
||||
/// set, for a player not reached, a dead one, a value that is not a
|
||||
/// number, or a progress outside 0 to 1 or a negative level or total.
|
||||
/// API @API:player_status@.
|
||||
/// API 490.
|
||||
pub(super) fn native_set_player_status(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -248,7 +248,7 @@ impl Game<'_> {
|
||||
}
|
||||
|
||||
/// The player `uuid`'s effects, as `/effect` and potions gave them. None
|
||||
/// for a player not reached. API @API:player_effects@.
|
||||
/// for a player not reached. API 477.
|
||||
pub(super) fn native_effects(&self, uuid: u128) -> Option<Vec<NativeEffect>> {
|
||||
let list = match self.native_place(uuid)? {
|
||||
Place::Acting => &self.potions.effects.list,
|
||||
@@ -263,7 +263,7 @@ impl Game<'_> {
|
||||
/// `UpdateMobEffect` with the ambient and particle flags. Whether
|
||||
/// anything changed; false also for an unknown effect, a duration of 0
|
||||
/// or below -1, a player not reached, and a dead one. API
|
||||
/// @API:player_effects@.
|
||||
/// 477.
|
||||
pub(super) fn native_add_effect(&mut self, uuid: u128, effect: &NativeEffect) -> bool {
|
||||
let Some(e) = instance(effect) else {
|
||||
return false;
|
||||
@@ -273,7 +273,7 @@ impl Game<'_> {
|
||||
}
|
||||
|
||||
/// Takes the effect `id` off the player `uuid`, as `/effect clear`:
|
||||
/// whether they had it. API @API:player_effects@.
|
||||
/// whether they had it. API 477.
|
||||
pub(super) fn native_remove_effect(&mut self, uuid: u128, id: &str) -> bool {
|
||||
let Some(def) = brewing::effect(id) else {
|
||||
return false;
|
||||
@@ -291,7 +291,7 @@ impl Game<'_> {
|
||||
/// given as `native_add_effect` gives it: what a mod restoring a saved
|
||||
/// player does (HuskSync's potion effects). False, and nothing changed,
|
||||
/// when one of them would be refused, and for a player not reached or
|
||||
/// dead. API @API:player_effects@.
|
||||
/// dead. API 477.
|
||||
pub(super) fn native_set_effects(&mut self, uuid: u128, effects: &[NativeEffect]) -> bool {
|
||||
let Some(list) = effects.iter().map(instance).collect::<Option<Vec<_>>>() else {
|
||||
return false;
|
||||
@@ -311,7 +311,7 @@ impl Game<'_> {
|
||||
/// effects, `/attribute`), as Bukkit's `AttributeInstance.getBaseValue`
|
||||
/// and `getValue`. None for an attribute players don't have, and for a
|
||||
/// player not reached or between bodies (just respawned, not yet
|
||||
/// ticked). API @API:player_attributes@.
|
||||
/// ticked). API 472.
|
||||
pub(super) fn native_attribute(&mut self, uuid: u128, attribute: &str) -> Option<(f64, f64)> {
|
||||
let id = namespaced(attribute);
|
||||
let motion = match self.native_place(uuid)? {
|
||||
@@ -330,7 +330,7 @@ impl Game<'_> {
|
||||
/// health. Their client gets `UpdateAttributes` with the tick's sync, and
|
||||
/// the base is saved. False for an attribute players don't have, a value
|
||||
/// that is not a number, and a player not reached or dead. API
|
||||
/// @API:player_attributes@.
|
||||
/// 472.
|
||||
pub(super) fn native_set_attribute_base(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -363,7 +363,7 @@ impl Game<'_> {
|
||||
/// attribute takes its base and permanent modifiers, unknown ones are
|
||||
/// skipped, the others stay. A lower `max_health` caps their health.
|
||||
/// False for anything but a list, and for a player not reached or dead.
|
||||
/// API @API:player_attributes@.
|
||||
/// API 472.
|
||||
pub(super) fn native_set_attributes(&mut self, uuid: u128, saved: &Tag) -> bool {
|
||||
if !matches!(saved, Tag::List(_)) {
|
||||
return false;
|
||||
@@ -382,7 +382,7 @@ impl Game<'_> {
|
||||
/// `Entity.getPersistentData()`, Bukkit's `PersistentDataContainer`):
|
||||
/// saved in their file as `NeoForgeData`, beside the keys Horizon keeps
|
||||
/// without modelling them; an empty compound when there is none. None
|
||||
/// for a player not reached. API @API:player_persistent_data@.
|
||||
/// for a player not reached. API 484.
|
||||
pub(super) fn native_player_persistent_data(&self, uuid: u128) -> Option<Tag> {
|
||||
let saved = match self.native_place(uuid)? {
|
||||
Place::Acting => self.level.player_extra.as_ref(),
|
||||
@@ -394,7 +394,7 @@ impl Game<'_> {
|
||||
/// Replaces the compound mods keep on the player `uuid` with `data`; an
|
||||
/// empty compound takes it away. It is saved with the player. False for
|
||||
/// anything but a compound and for a player not reached. API
|
||||
/// @API:player_persistent_data@.
|
||||
/// 484.
|
||||
pub(super) fn native_set_player_persistent_data(&mut self, uuid: u128, data: Tag) -> bool {
|
||||
let saved = match self.native_place(uuid) {
|
||||
Some(Place::Acting) => &mut self.level.player_extra,
|
||||
|
||||
@@ -44,7 +44,7 @@ impl Game<'_> {
|
||||
/// `native_refresh_player` shows the change. Works from any server hook; where the hub is out of
|
||||
/// reach (inside a player's own hook) it applies at the tick's end. False on a client and for a
|
||||
/// name past 64 characters, a value past 32767 or a signature past 1024 (`GameProfile`'s
|
||||
/// limits); true does not mean the player was found. API @API:profile_refresh@.
|
||||
/// limits); true does not mean the player was found. API 495.
|
||||
pub(super) fn native_set_profile_property(
|
||||
&mut self,
|
||||
player: u128,
|
||||
@@ -82,7 +82,7 @@ impl Game<'_> {
|
||||
/// are in (all their state kept), so their own client draws a new skin too. Queued for the end
|
||||
/// of their level's pass, so it works from any server hook; once a tick at most. A dead player
|
||||
/// is only shown again to the others (their respawn shows them the rest). False on a client;
|
||||
/// true does not mean the player was found. API @API:profile_refresh@.
|
||||
/// true does not mean the player was found. API 495.
|
||||
pub(super) fn native_refresh_player(&mut self, player: u128) -> bool {
|
||||
if self.remote.is_some() {
|
||||
return false;
|
||||
@@ -141,7 +141,7 @@ impl Game<'_> {
|
||||
/// value (base64 JSON naming the skin and cape) and signature (None unsigned), as their player
|
||||
/// list entry carries it, `native_set_profile_property`'s edits included. None for a player who
|
||||
/// isn't on or has none (offline mode without a skin mod), on a client, and where the hub is
|
||||
/// out of reach (inside a player's own hook). API @API:player_textures@.
|
||||
/// out of reach (inside a player's own hook). API 492.
|
||||
pub(super) fn native_player_textures(&self, uuid: u128) -> Option<(String, Option<String>)> {
|
||||
let (_, properties) = self.online_profile(uuid)?;
|
||||
properties
|
||||
@@ -153,7 +153,7 @@ impl Game<'_> {
|
||||
/// A player head of the player `uuid` (Bukkit's `SkullMeta.setOwningPlayer`): its
|
||||
/// `minecraft:profile` holds their id, and their name and properties (the skin) when they are
|
||||
/// on and the hub is in reach, so it shows their skin at once (else their name from the profile
|
||||
/// cache, if there); a profile without properties the client resolves itself. API @API:player_textures@.
|
||||
/// cache, if there); a profile without properties the client resolves itself. API 492.
|
||||
pub(super) fn native_player_head(&self, uuid: u128) -> ItemStack {
|
||||
let (name, properties) = self.online_profile(uuid).map_or(
|
||||
(self.native_profile_by_uuid(uuid), Vec::new()),
|
||||
@@ -180,7 +180,7 @@ impl Game<'_> {
|
||||
/// network lookup, vanilla's `GameProfileCache.get`): one who is on, else one in a dedicated
|
||||
/// server's profile cache (`usercache.json`: who joined in the last month, and names its
|
||||
/// commands looked up). Their id and their name as written. Asks no profile service and makes
|
||||
/// up no offline player; None when nobody is found. API @API:profile_cache@.
|
||||
/// up no offline player; None when nobody is found. API 494.
|
||||
pub(super) fn native_profile_by_name(&self, name: &str) -> Option<(u128, String)> {
|
||||
let online = self.lan.as_ref().and_then(|host| {
|
||||
host.hub
|
||||
@@ -195,7 +195,7 @@ impl Game<'_> {
|
||||
}
|
||||
|
||||
/// The name of the player `uuid`: one who is on, else one in a dedicated server's profile
|
||||
/// cache, as `native_profile_by_name`. API @API:profile_cache@.
|
||||
/// cache, as `native_profile_by_name`. API 494.
|
||||
pub(super) fn native_profile_by_uuid(&self, uuid: u128) -> Option<String> {
|
||||
self.online_profile(uuid)
|
||||
.map(|(name, _)| name)
|
||||
|
||||
@@ -74,7 +74,7 @@ impl Game<'_> {
|
||||
/// it never covers the screen's other drawing or is covered by it but in
|
||||
/// the order drawn. Draw it from a screen's drawing hook
|
||||
/// (`native_screen_draw`). A client's call; nothing is drawn on a server.
|
||||
/// API @API:scenes_in_screens@.
|
||||
/// API 420.
|
||||
pub(super) fn native_draw_scene(
|
||||
&self,
|
||||
batch: &mut HudBatch,
|
||||
|
||||
@@ -494,7 +494,7 @@ impl Game<'_> {
|
||||
/// another id (hide them again from `native_player_logged_in`). Only
|
||||
/// where no player's state is swapped in, as `native_run_command`; false
|
||||
/// there, when `viewer` isn't on and for their own entity. API
|
||||
/// @API:hide_entity_from@.
|
||||
/// 521.
|
||||
pub(super) fn native_hide_entity_from(
|
||||
&mut self,
|
||||
viewer: u128,
|
||||
@@ -533,7 +533,7 @@ impl Game<'_> {
|
||||
/// later (they join, a vanish ends), so it is kept until a mod sets it
|
||||
/// again or the server stops, also if they leave and come back. Only
|
||||
/// where no player's state is swapped in, as `native_run_command`; false
|
||||
/// there and when they aren't on. API @API:set_list_name@.
|
||||
/// there and when they aren't on. API 550.
|
||||
pub(super) fn native_set_list_name(&mut self, uuid: u128, name: Option<&Text>) -> bool {
|
||||
let Some(host) = &mut self.lan else {
|
||||
return false;
|
||||
@@ -555,7 +555,7 @@ impl Game<'_> {
|
||||
/// or the nickname. Kept until a mod sets it again or the server stops,
|
||||
/// also if they leave and come back. Only where no player's state is
|
||||
/// swapped in, as `native_run_command`; false there and when they aren't
|
||||
/// on. API @API:set_display_name@.
|
||||
/// on. API 549.
|
||||
pub(super) fn native_set_display_name(&mut self, uuid: u128, name: Option<&Text>) -> bool {
|
||||
let Some(host) = &mut self.lan else {
|
||||
return false;
|
||||
@@ -582,7 +582,7 @@ impl Game<'_> {
|
||||
/// mod sets it again or the server stops, also if they leave and come
|
||||
/// back. Only where no player's state is swapped in, as
|
||||
/// `native_run_command`; false there, when they aren't on and for a tag
|
||||
/// that isn't one. API @API:set_name_tag@.
|
||||
/// that isn't one. API 551.
|
||||
pub(super) fn native_set_name_tag(&mut self, uuid: u128, tag: Option<&str>) -> bool {
|
||||
if tag.is_some_and(|t| {
|
||||
t.is_empty() || t.len() > 16 || !t.bytes().all(|b| b.is_ascii_graphic())
|
||||
@@ -705,7 +705,7 @@ impl Game<'_> {
|
||||
/// player it hears, whose level is set by then: a login gate needs no
|
||||
/// `ops.json` of its own. Inside a player's hook, with the hub out of
|
||||
/// reach, only that player is found. None for a player who isn't on, and
|
||||
/// on a client. API @API:player_permission@.
|
||||
/// on a client. API 483.
|
||||
pub(super) fn native_player_permission(&self, player: u128) -> Option<u8> {
|
||||
if let Some((uuid, level)) = self.native_login_permission
|
||||
&& uuid == player
|
||||
@@ -762,7 +762,7 @@ impl Game<'_> {
|
||||
/// anything else to vanilla's. The lines it answers with come back in
|
||||
/// `output` and reach no one else, operators included. Only where
|
||||
/// `native_run_command` runs: inside a player's hook nothing runs. API
|
||||
/// @API:run_command_captured@.
|
||||
/// 500.
|
||||
pub(super) fn native_run_command_captured(&mut self, line: &str) -> NativeCommandResult {
|
||||
let mut out = NativeCommandResult::default();
|
||||
if self.lan_acting.is_some() || self.lan.is_none() {
|
||||
@@ -801,14 +801,14 @@ impl Game<'_> {
|
||||
/// `Bukkit.dispatchCommand` from the console): a command a mod registered
|
||||
/// goes to the mods (`native_perform_console_command`), anything else to
|
||||
/// vanilla's. Whether it ran: a mod took it, or vanilla's ran without
|
||||
/// failing. No output, as `native_run_command`. API @API:run_mod_command@.
|
||||
/// failing. No output, as `native_run_command`. API 501.
|
||||
pub(super) fn native_run_mod_command(&mut self, line: &str) -> bool {
|
||||
self.native_run_command_captured(line).ran
|
||||
}
|
||||
/// The server's command `label` names (Bukkit's `CommandMap.getCommand`):
|
||||
/// one a mod registered (`native_register_commands`), else vanilla's, an
|
||||
/// alias resolved (`tp` gives `teleport`). None when there is none.
|
||||
/// API @API:command_info@.
|
||||
/// API 459.
|
||||
pub(super) fn native_command_info(&self, label: &str) -> Option<NativeCommandInfo> {
|
||||
let label = label.strip_prefix('/').unwrap_or(label);
|
||||
if let Some(host) = &self.lan
|
||||
@@ -838,7 +838,7 @@ impl Game<'_> {
|
||||
/// `output`. `native_player_command` doesn't hear it. Where
|
||||
/// `native_run_command` runs, or inside that player's own hook (then the
|
||||
/// lines join the hook's feedback); elsewhere, or for a player not on the
|
||||
/// server, nothing runs. API @API:run_command_as@.
|
||||
/// server, nothing runs. API 499.
|
||||
pub(super) fn native_run_command_as(&mut self, uuid: u128, line: &str) -> NativeCommandResult {
|
||||
let mut out = NativeCommandResult::default();
|
||||
let line = line.strip_prefix('/').unwrap_or(line).to_owned();
|
||||
@@ -1377,7 +1377,7 @@ impl Game<'_> {
|
||||
/// commands players may run are rebuilt, and every player on the server is
|
||||
/// sent their tree again, after `native_player_commands_sent`. Nothing
|
||||
/// happens where no world is open to players, and nothing for a server
|
||||
/// whose mods never call it. API @API:refresh_commands@.
|
||||
/// whose mods never call it. API 445.
|
||||
pub(super) fn native_refresh_commands(&mut self) {
|
||||
self.native_commands_refresh = true;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ impl Game<'_> {
|
||||
/// `/place template` picks at `at`; no processor runs, and the template's
|
||||
/// entities are left out. None for an id that doesn't parse or has a `.`
|
||||
/// or `..` part, a template the game doesn't have, and on a client.
|
||||
/// API @API:structure_template@.
|
||||
/// API 431.
|
||||
pub(super) fn native_structure_template(
|
||||
&mut self,
|
||||
id: &str,
|
||||
|
||||
@@ -11,7 +11,7 @@ impl Game<'_> {
|
||||
/// shading remains independent of light: fullbright shaded models remain shaded.
|
||||
/// UV shifts affect only the exact source sprite; a missing source match fails the
|
||||
/// whole call. Optional shrink is caller-specified, never inferred from an atlas guess.
|
||||
/// API @API:terrain_model@.
|
||||
/// API 562.
|
||||
pub(super) fn native_draw_terrain_model(
|
||||
&self,
|
||||
draw: &mut BlockEntityDraw,
|
||||
|
||||
@@ -51,7 +51,7 @@ impl Game<'_> {
|
||||
/// another level it happens when the tick's level teleports run, as a command's does. True
|
||||
/// when it is done or queued; false for a player not on the server or dead (when that can
|
||||
/// be seen), a dimension other than the three, a position outside `/tp`'s bounds, an angle
|
||||
/// that is not finite, and on a client. API @API:teleport_player@.
|
||||
/// that is not finite, and on a client. API 509.
|
||||
pub(super) fn native_teleport_player(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -108,7 +108,7 @@ impl Game<'_> {
|
||||
/// where nobody's state is swapped in (a tick hook, a vehicle's hook nobody rides; inside
|
||||
/// `native_vehicle_moved_v2` a mod changes `to` instead): false inside a player's hook, for
|
||||
/// no such vehicle here, another dimension, a position outside `/tp`'s bounds, and on a
|
||||
/// client. API @API:teleport_vehicle@.
|
||||
/// client. API 510.
|
||||
pub(super) fn native_teleport_vehicle(
|
||||
&mut self,
|
||||
dimension: &str,
|
||||
@@ -152,7 +152,7 @@ impl Game<'_> {
|
||||
/// `Entity.addPassenger`), with its checks: neither rides already, no loop, a free seat,
|
||||
/// minecarts carry players only, and `native_entity_mount` may refuse. Both in the level in
|
||||
/// place. Inside a player's hook only the acting player and mobs are reached. True when it
|
||||
/// rides now; false otherwise and on a client. API @API:mount@.
|
||||
/// rides now; false otherwise and on a client. API 470.
|
||||
pub(super) fn native_mount(&mut self, entity: u32, vehicle: u32) -> bool {
|
||||
if !self.native_serves() {
|
||||
return false;
|
||||
@@ -175,7 +175,7 @@ impl Game<'_> {
|
||||
/// <entity> dismount` does (Bukkit's `Entity.leaveVehicle`): it lands beside the vehicle,
|
||||
/// and `native_entity_mount` may refuse. In the level in place; inside a player's hook only
|
||||
/// the acting player and mobs are reached. True when it got off; false when it rode
|
||||
/// nothing, was not reached, and on a client. API @API:mount@.
|
||||
/// nothing, was not reached, and on a client. API 470.
|
||||
pub(super) fn native_dismount(&mut self, entity: u32) -> bool {
|
||||
if !self.native_serves() {
|
||||
return false;
|
||||
@@ -205,7 +205,7 @@ impl Game<'_> {
|
||||
/// Takes every rider off the vehicle `vehicle` (a boat, a minecart or a mob), as
|
||||
/// `native_dismount` does each (Bukkit's `Entity.eject`): the server players and mobs on it.
|
||||
/// In the level in place; inside a player's hook only the acting player and mobs are
|
||||
/// reached. True when one got off; false otherwise and on a client. API @API:mount@.
|
||||
/// reached. True when one got off; false otherwise and on a client. API 470.
|
||||
pub(super) fn native_eject_passengers(&mut self, vehicle: u32) -> bool {
|
||||
if !self.native_serves() || self.native_vehicle_target(vehicle).is_none() {
|
||||
return false;
|
||||
@@ -265,7 +265,7 @@ impl Game<'_> {
|
||||
/// sets it for the mode then); not saved. Where nobody's state is swapped in it is done at
|
||||
/// once, else after the players' packets of the server tick. True when done or queued;
|
||||
/// false for a player not on the server (when that can be seen) and on a client. API
|
||||
/// @API:set_flight@.
|
||||
/// 505.
|
||||
pub(super) fn native_set_flight(&mut self, uuid: u128, allow: bool, flying: bool) -> bool {
|
||||
if !self.native_serves() {
|
||||
return false;
|
||||
@@ -302,7 +302,7 @@ impl Game<'_> {
|
||||
/// packet's hook or the tick's start, else the next). True when queued; false for a player
|
||||
/// seen not on the server or alive (inside a player's hook nobody else can be seen: it is
|
||||
/// queued, and does nothing for a living player), and on a client. API
|
||||
/// @API:respawn_player@.
|
||||
/// 498.
|
||||
pub(super) fn native_respawn_player(&mut self, uuid: u128) -> bool {
|
||||
if !self.native_serves() {
|
||||
return false;
|
||||
|
||||
@@ -16,7 +16,7 @@ impl Game<'_> {
|
||||
/// leaves; a later server change (`view-distance`) keeps it. False off a
|
||||
/// server, for a player not online, and inside a guest's packet hook,
|
||||
/// where the hub is taken out (call it from a tick hook). API
|
||||
/// @API:player_view_distance@.
|
||||
/// 493.
|
||||
pub(super) fn native_set_player_view_distance(
|
||||
&mut self,
|
||||
uuid: u128,
|
||||
@@ -33,7 +33,7 @@ impl Game<'_> {
|
||||
/// The view distance the player `uuid` has now: the radius of chunks it
|
||||
/// is sent (`native_set_player_view_distance`). None off a server, for a
|
||||
/// player not online, and inside a guest's packet hook. API
|
||||
/// @API:player_view_distance@.
|
||||
/// 493.
|
||||
pub(super) fn native_player_view_distance(&self, uuid: u128) -> Option<i32> {
|
||||
if !self.native_authoritative() {
|
||||
return None;
|
||||
|
||||
@@ -13,7 +13,7 @@ impl Game<'_> {
|
||||
/// every level today, so the three levels answer the same bounds, and
|
||||
/// this follows when that changes. None off a server and for a dimension
|
||||
/// other than the Overworld, the Nether and the End. API
|
||||
/// @API:world_border@.
|
||||
/// 513.
|
||||
pub(super) fn native_world_border(&self, dimension: &str) -> Option<[f64; 4]> {
|
||||
let known = matches!(
|
||||
dimension,
|
||||
|
||||
@@ -13,7 +13,7 @@ use std::ops::{Deref, DerefMut};
|
||||
/// One world frame, independently of block entities or source blocks. Its pose
|
||||
/// starts camera-relative and shares `BlockEntityDraw`'s push/pop, translate,
|
||||
/// rotate and scale operations, partial tick, game time and packed light.
|
||||
/// `keep` does not cache a world canvas. API @API:world_canvas@.
|
||||
/// `keep` does not cache a world canvas. API 429.
|
||||
pub struct NativeWorldDraw {
|
||||
pub camera: [f64; 3],
|
||||
draw: BlockEntityDraw,
|
||||
@@ -143,7 +143,7 @@ impl Game<'_> {
|
||||
/// Normal, depth-tested atlas quad under the current pose. UVs use 16
|
||||
/// texels per sprite side; color is [red, green, blue, alpha]. No model
|
||||
/// diffuse lighting is applied; `draw.light` still selects lightmap light.
|
||||
/// False for an unknown sprite or non-finite geometry. API @API:world_canvas@.
|
||||
/// False for an unknown sprite or non-finite geometry. API 429.
|
||||
pub(super) fn native_world_quad(
|
||||
&self,
|
||||
draw: &mut NativeWorldDraw,
|
||||
@@ -161,7 +161,7 @@ impl Game<'_> {
|
||||
}
|
||||
/// Actual styled world font at (0,0), with ARGB default color and optional
|
||||
/// eight-offset ARGB outline. Returns the text advance in font pixels.
|
||||
/// The front of outlined text uses POLYGON_OFFSET. API @API:world_canvas@.
|
||||
/// The front of outlined text uses POLYGON_OFFSET. API 429.
|
||||
pub(super) fn native_world_text(
|
||||
&self,
|
||||
draw: &mut NativeWorldDraw,
|
||||
|
||||
@@ -91,7 +91,7 @@ impl Game<'_> {
|
||||
/// one) is in block tag `tag` (`minecraft:logs`, or a mod's
|
||||
/// `create:fan_transparent`) of the server's merged tags, as
|
||||
/// `BlockState.is(TagKey)`: what `native_server_block_in_tag` answers for
|
||||
/// a state of that block, from any server hook. API @API:host_bridge@.
|
||||
/// a state of that block, from any server hook. API 414.
|
||||
pub(super) fn native_block_name_in_tag(
|
||||
&self,
|
||||
block: &str,
|
||||
@@ -133,7 +133,7 @@ impl Game<'_> {
|
||||
/// is no fluid or it doesn't move; none where the chunk isn't loaded or
|
||||
/// the dimension isn't available (a client has only the level it is in,
|
||||
/// a server also its parked ones), so a caller can keep its last answer.
|
||||
/// API @API:fluid_flow@.
|
||||
/// API 422.
|
||||
pub(super) fn native_fluid_flow(&self, dimension: &str, pos: [i32; 3]) -> Option<[f64; 3]> {
|
||||
let dim = match dimension {
|
||||
"minecraft:overworld" => Dim::Overworld,
|
||||
|
||||
@@ -9,7 +9,7 @@ impl Game<'_> {
|
||||
/// The world's seed, as `/seed` prints it (`WorldOptions.seed`, Bukkit's
|
||||
/// `World.getSeed`): every level of the world generates from it, and
|
||||
/// `native_chunk_generate` gets the same value. None off a server: a
|
||||
/// client only knows a hash of its server's seed. API @API:world_seed@.
|
||||
/// client only knows a hash of its server's seed. API 554.
|
||||
pub(super) fn native_world_seed(&self) -> Option<i64> {
|
||||
self.native_authoritative().then_some(self.level.seed)
|
||||
}
|
||||
|
||||
@@ -577,7 +577,7 @@ pub fn serve_local(
|
||||
/// "Disconnected" if it is left unset), a status ping is closed unanswered. Once for each network connection, the
|
||||
/// legacy server list ping (`0xFE`) and an integrated server's own player excepted. There is no `Game` on this
|
||||
/// thread: no helper works, and the hook must not block for long (the connection waits for it). API
|
||||
/// @API:handshake@.
|
||||
/// 464.
|
||||
#[inline(never)]
|
||||
pub fn native_handshake(
|
||||
address: std::net::SocketAddr,
|
||||
@@ -859,7 +859,7 @@ fn authenticate(
|
||||
/// then, or whose sender is dropped, refuses them with a plain "Disconnected". Mods answer without waiting on
|
||||
/// each other, so loads run side by side. Once for each player who logs in over the network, the integrated
|
||||
/// server's own player excepted. There is no `Game` on this thread: no helper works. API
|
||||
/// @API:player_pre_login@.
|
||||
/// 485.
|
||||
#[inline(never)]
|
||||
pub fn native_player_pre_login(
|
||||
player: u128,
|
||||
@@ -897,7 +897,7 @@ fn pre_login_refusal(
|
||||
/// characters, a signature of up to 1024): the player's own client and every player list then get the new
|
||||
/// ones. Once for each player who logs in over the network, the integrated server's own player excepted.
|
||||
/// There is no `Game` on this thread: no helper works. The hook may block for a lookup (a database's); the
|
||||
/// login waits for it, but a vanilla client gives up after 30 s of silence. API @API:player_profile@.
|
||||
/// login waits for it, but a vanilla client gives up after 30 s of silence. API 486.
|
||||
#[inline(never)]
|
||||
pub fn native_player_profile(
|
||||
player: u128,
|
||||
|
||||
@@ -456,7 +456,7 @@ pub fn register(m: &mut Mob) {
|
||||
/// every mob Horizon makes, a client's copies of a server's mobs included,
|
||||
/// before its saved data is read; goals tick only where the mob's AI runs.
|
||||
/// `goals::Float` keeps the navigation floating, as FloatGoal's
|
||||
/// constructor does. API @API:register_goals@.
|
||||
/// constructor does. API 430.
|
||||
#[inline(never)]
|
||||
pub fn native_register_goals(mob: &mut Mob) {
|
||||
crate::native_client_hooks::register_goals(mob);
|
||||
|
||||
@@ -83,7 +83,7 @@ pub use horizon_protocol::packets::play::Clientbound as ClientboundPlayPacket;
|
||||
pub use horizon_protocol::packets::play::Serverbound as ServerboundPlayPacket;
|
||||
pub use horizon_world::consumable::UseAnimation;
|
||||
/// Vanilla's `TagParser`: the tag an SNBT text holds and the bytes it read
|
||||
/// (`ItemStack::from_nbt` reads an item from it). API @API:item_from_snbt@.
|
||||
/// (`ItemStack::from_nbt` reads an item from it). API 525.
|
||||
pub use horizon_world::nbt::parse_snbt;
|
||||
pub use horizon_world::player_inventory::EquipmentSlot;
|
||||
pub use horizon_world::{
|
||||
@@ -103,7 +103,7 @@ pub use horizon_world::{
|
||||
pub use serde_json;
|
||||
use serde_json::{Map, Value};
|
||||
/// The slot range a menu's input slots take (`native_open_menu_with_input`).
|
||||
/// API @API:menu_input@.
|
||||
/// API 531.
|
||||
pub use std::ops::Range;
|
||||
use std::time::Duration;
|
||||
/// The window events `input_key` hands over (`winit::event::KeyEvent`) and their key types.
|
||||
@@ -474,7 +474,7 @@ pub struct NativeZoom {
|
||||
}
|
||||
|
||||
/// A boss bar a server mod shows one player (`native_boss_bar`), as Bukkit's
|
||||
/// `BossBar` holds it. API @API:boss_bar@.
|
||||
/// `BossBar` holds it. API 515.
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
pub struct NativeBossBar {
|
||||
pub name: Text,
|
||||
@@ -494,7 +494,7 @@ pub struct NativeBossBar {
|
||||
|
||||
/// One open level of a server, counted for a diagnostics mod (`native_level_stats`): Bukkit's
|
||||
/// `World.getLoadedChunks`, `getForceLoadedChunks`, `getEntities` and `Chunk.getTileEntities`
|
||||
/// in numbers. API @API:level_stats@.
|
||||
/// in numbers. API 527.
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
#[non_exhaustive]
|
||||
pub struct NativeLevelStats {
|
||||
@@ -514,7 +514,7 @@ pub struct NativeLevelStats {
|
||||
}
|
||||
|
||||
/// What one mob type cost one level's ticks while a mod sampled them
|
||||
/// (`native_take_mob_costs`). API @API:server_tick_timed@.
|
||||
/// (`native_take_mob_costs`). API 548.
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
#[non_exhaustive]
|
||||
pub struct NativeMobCost {
|
||||
@@ -557,7 +557,7 @@ pub struct NativeServerPlayer {
|
||||
pub address: String,
|
||||
/// The connection's round-trip time in milliseconds, as the keep-alive measured it and the
|
||||
/// player list shows it (`ServerCommonPacketListenerImpl.latency`). The fields below are API
|
||||
/// @API:server_player_state@; 0, false or None where the server does not hold them.
|
||||
/// 504; 0, false or None where the server does not hold them.
|
||||
pub latency: i32,
|
||||
/// The protocol version the client connected with (the server's own: others are refused).
|
||||
pub protocol: i32,
|
||||
@@ -588,7 +588,7 @@ pub struct NativeServerPlayer {
|
||||
}
|
||||
|
||||
/// What a player's client told the server about itself, and what the server sent it
|
||||
/// (`native_player_client`). API @API:player_client@.
|
||||
/// (`native_player_client`). API 473.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[non_exhaustive]
|
||||
pub struct NativeClientInfo {
|
||||
@@ -625,7 +625,7 @@ pub struct NativeCommand {
|
||||
/// The operator level a player needs to see and run it (0: everyone).
|
||||
pub level: u8,
|
||||
/// The permission node that decides instead, when set
|
||||
/// ([`NativeCommand::permission`]). API @API:command_permission@.
|
||||
/// ([`NativeCommand::permission`]). API 460.
|
||||
pub permission: Option<String>,
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ impl NativeCommand {
|
||||
/// the command, so a permissions mod grants or refuses it whatever the
|
||||
/// player's level, and without one the level decides as before. A
|
||||
/// command's node is the first one its usages give.
|
||||
/// API @API:command_permission@.
|
||||
/// API 460.
|
||||
pub fn permission(mut self, node: &str) -> Self {
|
||||
self.permission = Some(node.to_owned());
|
||||
self
|
||||
|
||||
@@ -172,7 +172,7 @@ pub(crate) fn ingredient_test(
|
||||
/// message's further lines after newlines. Every message the file gets, from the client or a
|
||||
/// dedicated server, from the first lines on; lines the flood limit leaves out are not heard.
|
||||
/// There is no `Game`: keep what you need and act on it in another hook. A mod that panics
|
||||
/// here is not called again. API @API:log_line@.
|
||||
/// here is not called again. API 469.
|
||||
#[inline(never)]
|
||||
pub fn native_log_line(level: &str, thread: &str, message: &str, line: &str) {
|
||||
log_line(level, thread, message, line);
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::sound_engine::SoundPlayback;
|
||||
/// Changed values must be finite, volume nonnegative and pitch positive;
|
||||
/// invalid edits cancel that operation (an update stops the sound). No Host,
|
||||
/// world borrow or reverb/DSP surface is supplied. Runs on the game thread.
|
||||
/// API @API:sound_play@.
|
||||
/// API 449.
|
||||
#[inline(never)]
|
||||
pub fn native_sound_play(
|
||||
sound: &SoundPlayback<'_>,
|
||||
|
||||
@@ -281,7 +281,7 @@ impl ItemStack {
|
||||
/// The stack `ItemStack.CODEC` reads from `tag` (`id`, `count`,
|
||||
/// `components`), as `item_nbt::item_from_nbt` does; None for air or an
|
||||
/// id that is no valid identifier. The id is not looked up in a registry.
|
||||
/// API @API:item_from_snbt@.
|
||||
/// API 525.
|
||||
pub fn from_nbt(tag: &horizon_world::nbt::Compound) -> Option<Self> {
|
||||
crate::item_nbt::item_from_nbt(&Tag::Compound(tag.clone()))
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ impl NativeProtoChunk<'_> {
|
||||
/// here. A chunk can be asked again (a proto chunk saved unfinished, the
|
||||
/// neighbours of a finished chunk, the far terrain's decoration), so answer
|
||||
/// the same each time. Server-side, and wherever chunks generate (single
|
||||
/// player, far terrain). @API:chunk_generate@.
|
||||
/// player, far terrain). 516.
|
||||
#[inline(never)]
|
||||
pub fn native_chunk_generate(
|
||||
dimension: &str,
|
||||
@@ -174,7 +174,7 @@ impl NativeLodColumn<'_> {
|
||||
/// many per tile, on the far terrain's workers, several at once and never
|
||||
/// on the server thread: answer from the terrain function alone, quickly,
|
||||
/// without building the chunk. Wherever far terrain is sampled (a client's
|
||||
/// own far terrain, single player). @API:lod_column@.
|
||||
/// own far terrain, single player). 530.
|
||||
#[inline(never)]
|
||||
pub fn native_lod_column(
|
||||
dimension: &str,
|
||||
|
||||
+432
-111
File diff suppressed because it is too large.
Load diff
+1626
File diff suppressed because it is too large.
Load diff
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "anvil_update",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_anvil_update",
|
||||
"neoforge": "AnvilUpdateEvent",
|
||||
"side": "both",
|
||||
"cancellable": true,
|
||||
"mod_api": {
|
||||
"contract": "cancel",
|
||||
"out": "canceled"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "an anvil's result, which a mod may change or cancel (`native_anvil_update`).",
|
||||
"doc_summary": "An anvil's result: `native_anvil_update(player, name, left, right, item_name, vanilla_output, vanilla_xp_cost, vanilla_material_cost, output, xp_cost, material_cost, canceled)` is NeoForge's `AnvilUpdateEvent`, where `AnvilMenu.createResult` ends, on both sides. A mod may change the output, the level cost and the material cost (how many of the right input the take uses), which start as vanilla's, or cancel, which leaves no result. Bundles need \"hooks\": @API:anvil_update@."
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "block_states", "target": "horizon_client::game::native_block_sprites::Game<'_>::native_block_states"},
|
||||
{"name": "client_resources", "target": "horizon_client::game::native_block_sprites::Game<'_>::native_client_resources"}
|
||||
],
|
||||
"rust_summary": "every block state's facts and looks by its id, and the resources' files, for client mods working off the main thread (`native_block_states`, `native_client_resources`).",
|
||||
"doc_summary": "[block states and resource files](#block-states-and-resource-files) for client mods, to keep and use on any thread: `native_block_states()` gives every block state by its id with its facts (name, air, fluid, light, outline, map colour, waterlogged, whether it collides), what its model draws on each side and the texture behind each sprite; `native_client_resources()` reads the resources' files, resource packs' over vanilla's, as bytes or a texture's decoded pixels. Bundles need \"hooks\": @API:block_appearance@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_block_sprites.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "block_clone_item",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_block_clone_item",
|
||||
"mod_api": {"contract": "replace", "out": "stack"}
|
||||
}
|
||||
],
|
||||
"rust_summary": "state-dependent block clone items before Ctrl+Pick data.",
|
||||
"doc_summary": "`native_block_clone_item` supplies a block's clone stack from its actual state before ordinary Ctrl+Pick block-entity component copying. First response owns the result; no response retains vanilla. An empty or unregistered response suppresses picking. Bundles need \"hooks\": @API:block_clone_item@."
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "block_entity_accepts_fluid",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_block_entity_accepts_fluid",
|
||||
"neoforge": "IFluidHandler.isFluidValid",
|
||||
"side": "server",
|
||||
"cancellable": true,
|
||||
"mod_api": {
|
||||
"contract": "cancel",
|
||||
"out": "cancel"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "a mod tank's say on which fluids it takes (`native_block_entity_accepts_fluid`).",
|
||||
"doc_summary": "`native_block_entity_accepts_fluid(block, tank, fluid, cancel)` is asked before `native_fluid_insert` fills a fillable tank of a mod block's `ModFluidTanks`, in both passes, and before `native_move_fluids` counts that tank's room; set `cancel` to refuse the fluid there, so a water tank takes no `create:chocolate` and a removed mod leaves no id it cannot use behind. Every tank accepts every fluid unless a mod says otherwise; a cauldron and a drain never ask it. Bundles need \"hooks\": @API:block_entity_accepts_fluid@."
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "block_face_sprite", "target": "horizon_client::game::native_block_sprites::Game<'_>::native_block_face_sprite"}
|
||||
],
|
||||
"rust_summary": "the texture a block state shows on a side, by the name the block entity drawing helpers take (`native_block_face_sprite`), for copycat blocks.",
|
||||
"doc_summary": "`native_block_face_sprite(state, side)` names the texture a block state's model shows on a side and its tint index, as `native_draw_cube` takes it: a copycat block draws its material's textures on its own shape. Bundles need \"hooks\": @API:block_face_sprite@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_block_sprites.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "block_place",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_block_place",
|
||||
"neoforge": "BlockEvent.EntityPlaceEvent (Bukkit's BlockPlaceEvent)",
|
||||
"side": "server",
|
||||
"cancellable": true,
|
||||
"mod_api": {
|
||||
"contract": "cancel",
|
||||
"out": "cancel"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "a guest about to place a block item, with the position and state, before anything is set, cancellable (`native_block_place`).",
|
||||
"doc_summary": "`native_block_place(player, name, stack, pos, state, cancel)`: a guest is about to place `stack` as `state` at `pos`, heard where `BlockItem.place` has found the position and state and checked survival, before anything is set (Bukkit's `BlockPlaceEvent`, NeoForge's `BlockEvent.EntityPlaceEvent`). Set `cancel` and nothing is placed or used; the client sees the blocks and its inventory as they are and `native_place_block` hears nothing. Bundles that use it need `\"hooks\": @API:block_place@`."
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "block_redstone",
|
||||
"target": "horizon_client::game::native_hooks::GameLevel<'_>::native_block_redstone",
|
||||
"neoforge": "none (NeoForge has no such event; Bukkit's BlockRedstoneEvent)",
|
||||
"side": "server",
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "a button's, lever's or pressure plate's signal change, which a mod may change or hold (`native_block_redstone`).",
|
||||
"doc_summary": "`native_block_redstone(dimension, pos, old, new)`: a button, lever or pressure plate about to change its signal from `old` to `new` (0 to 15), as Bukkit's `BlockRedstoneEvent`; change `new` and the component takes it, one equal to `old` keeps it as it is (a held button or plate is asked again). Bundles need \"hooks\": @API:block_redstone@."
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{
|
||||
"name": "boss_bar",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_boss_bar"
|
||||
}
|
||||
],
|
||||
"rust_summary": "boss bars for one player (`native_boss_bar`, `NativeBossBar`), as Bukkit's `BossBar.addPlayer`.",
|
||||
"doc_summary": "`native_boss_bar(uuid, id, bar)` (`host.boss_bar`) shows one player a `NativeBossBar` (name, progress, colour, overlay, flags) under a mod's id, changes it, or takes it away (None), as Bukkit's `BossBar.addPlayer`/`removePlayer`; kept by UUID while they are off. Bundles need \"hooks\": @API:boss_bar@."
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "break_speed",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_break_speed",
|
||||
"neoforge": "PlayerEvent.BreakSpeed",
|
||||
"side": "both",
|
||||
"cancellable": false,
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "how fast a player digs a block (`native_break_speed`).",
|
||||
"doc_summary": "how fast a player digs a block: `native_break_speed` may change the speed that `Player.getDestroySpeed` gives, as NeoForge's `PlayerEvent.BreakSpeed` does, on both sides ([How fast a player digs](#how-fast-a-player-digs)). Bundles need \"hooks\": @API:break_speed@."
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "chat_input", "target": "horizon_client::game::chat::Game<'_>::native_chat_input"},
|
||||
{"name": "set_chat_input", "target": "horizon_client::game::chat::Game<'_>::native_set_chat_input"}
|
||||
],
|
||||
"rust_summary": "a client mod reads and writes the open chat box (`native_chat_input`, `native_set_chat_input`).",
|
||||
"doc_summary": "`native_chat_input()` gives the open chat box's text and cursor, `native_set_chat_input(text, cursor)` replaces them as an edit (completions refresh); an error while the chat is closed. Bundles need \"hooks\": @API:chat_input@.",
|
||||
"comments": ["crates/horizon-client/src/game/chat.rs"]
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "chat_suggestion_applied",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_chat_suggestion_applied",
|
||||
"side": "client",
|
||||
"cancellable": false,
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "notify native mods when a chat suggestion is applied.",
|
||||
"doc_summary": "`native_chat_suggestion_applied(original, start, end, suggestion, input)` reports a chat completion after Tab or a click. The range is in UTF-16 units of the list's original input, including when cycling; input is the resulting length-limited field value. Client-only, read-only. Bundles need \"hooks\": @API:chat_suggestion_applied@."
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "chunk_generate",
|
||||
"target": "horizon_world::worldgen::native_generate::native_chunk_generate",
|
||||
"neoforge": "none (NeoForge has no such event, a mod registers its own ChunkGenerator; Bukkit's ChunkGenerator.generateNoise)",
|
||||
"side": "server",
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "a chunk's terrain built by a mod before vanilla's noise (`native_chunk_generate`), with vanilla's surface, carvers, structures and features on request.",
|
||||
"doc_summary": "`native_chunk_generate(dimension, chunk, seed, flat, chunk_out, generate)` is asked for every chunk a level generates, after its biomes and structure starts and before the noise (Bukkit's `ChunkGenerator.generateNoise`): a mod sets the blocks with `chunk_out.set_block` and answers `NativeGenerate::Replaced { surface, carvers, structures, decorations }`, and vanilla adds only what the flags ask for; `set_biomes` and `clear_structures` work with either answer. It runs on the generation workers, several chunks at once. Bundles need \"hooks\": @API:chunk_generate@.",
|
||||
"comments": [
|
||||
"crates/horizon-world/src/worldgen/native_generate.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "chunk_snapshot", "target": "horizon_client::game::native_chunk_snapshot::Game<'_>::native_chunk_snapshot"},
|
||||
{"name": "block_map_color", "target": "horizon_client::game::native_chunk_snapshot::Game<'_>::native_block_map_color"},
|
||||
{"name": "biome_name", "target": "horizon_client::game::native_chunk_snapshot::Game<'_>::native_biome_name"},
|
||||
{"name": "biome_tint", "target": "horizon_client::game::native_chunk_snapshot::Game<'_>::native_biome_tint"}
|
||||
],
|
||||
"rust_summary": "read-only chunk snapshots (`native_chunk_snapshot`) with block map colours and biome tints (`native_block_map_color`, `native_biome_name`, `native_biome_tint`).",
|
||||
"doc_summary": "`native_chunk_snapshot(dimension, chunk)`, a read-only `NativeChunkSnapshot` of a loaded chunk (block states, surface heights, biomes) that can be read on another thread, with `native_block_map_color(state)`, `native_biome_name(biome)` and `native_biome_tint(biome, x, z)` to draw it. Bundles need \"hooks\": @API:chunk_snapshot@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_chunk_snapshot.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "client_attack",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_client_attack",
|
||||
"neoforge": "AttackEntityEvent",
|
||||
"side": "client",
|
||||
"cancellable": false,
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "client_hurt",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_client_hurt",
|
||||
"side": "client",
|
||||
"cancellable": false,
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "the local player's own combat on the client (`native_client_attack`, `native_client_hurt`).",
|
||||
"doc_summary": "the local player's combat as the window sees it, on any server: `native_client_attack(target, player)` when it attacks an entity, `native_client_hurt(attacker, player)` when the server says it was hurt; `player` says whether the other side is a player. Client only, no answer. Bundles need \"hooks\": @API:client_combat@."
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "reserve_entity_id", "target": "horizon_client::game::native_client_entities::Game<'_>::native_reserve_entity_id"},
|
||||
{"name": "client_entity_spawn", "target": "horizon_client::game::native_client_entities::Game<'_>::native_client_entity_spawn"},
|
||||
{"name": "client_entity_set", "target": "horizon_client::game::native_client_entities::Game<'_>::native_client_entity_set"},
|
||||
{"name": "client_entity_move", "target": "horizon_client::game::native_client_entities::Game<'_>::native_client_entity_move"},
|
||||
{"name": "client_entity_remove", "target": "horizon_client::game::native_client_entities::Game<'_>::native_client_entity_remove"}
|
||||
],
|
||||
"rust_summary": "entities shown to one player's client alone (`native_client_entity_spawn`, `_set`, `_move`, `_remove`), their data from a compound as `/summon` reads it, and an entity id no server entity takes (`native_reserve_entity_id`).",
|
||||
"doc_summary": "`native_client_entity_spawn(viewer, kind, pos, yaw, nbt)` shows an entity (a text, item or block display, or any type with its custom name, invisibility, glow) to one player's client alone, with its synched data encoded from `nbt` as `/summon` reads it; `native_client_entity_set(viewer, id, nbt)`, `native_client_entity_move(viewer, id, pos, yaw)` and `native_client_entity_remove(viewer, ids)` change, move and take it away. Never simulated, saved or seen by others. `native_reserve_entity_id()` gives an id no server entity takes. Bundles need \"hooks\": @API:client_entities@.",
|
||||
"comments": ["crates/horizon-client/src/game/native_client_entities.rs"]
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "client_items", "target": "horizon_client::game::native_client_services::Game<'_>::native_client_items"},
|
||||
{"name": "client_texture", "target": "horizon_client::game::native_client_services::Game<'_>::native_client_texture"}
|
||||
],
|
||||
"rust_summary": "what a client mod reads of the entities the client shows (radars, name tags, spectator ESP): `NativeClientEntity`'s type, yaw, baby, spectator and body texture, and `position_at`; the dropped items the client shows (`native_client_items`); a texture's pixels, an entity's or a downloaded skin's (`native_client_texture`, as `TexturePixels`).",
|
||||
"doc_summary": "lists of the entities and dropped items a client shows, for client mods such as radars, name tags and spectator ESP ([Entities a client sees](#entities-a-client-sees)): `native_client_entities()` also gives each entity's type, yaw, baby, spectator and the texture its body draws with, and `position_at(partial_tick)` where the frame draws it; `native_client_items()` lists the dropped items the client shows; `native_client_texture(name)` gives the pixels of an entity texture or a player's skin, downloaded ones included. Bundles need \"hooks\": @API:client_entity_list@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_client_services.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{
|
||||
"name": "menu_stacks",
|
||||
"target": "horizon_client::game::native_menu_stacks::Game<'_>::native_menu_stacks"
|
||||
}
|
||||
],
|
||||
"rust_summary": "entity handles on a client (`native_entity` and the `entity_*` and `living_*` reads over the entities the server shows the window, armor stands' custom names and equipment included) and the stacks of a server-opened menu by slot (`native_menu_stacks`).",
|
||||
"doc_summary": "on a client, `host.entity(id)` and the `entity_*` and `living_*` reads work against the entities the server shows the window (what a client knows: position, rotation, type, UUID, custom name, equipment; no saved data or tags; writes refused), and `host.menu_stacks()` gives the open server-opened menu's stacks, with their components, by slot. Bundles need \"hooks\": @API:client_entity_refs@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_entity_refs.rs",
|
||||
"crates/horizon-client/src/game/native_entity_data.rs",
|
||||
"crates/horizon-client/src/game/native_entity_motion.rs",
|
||||
"crates/horizon-client/src/game/native_living_refs.rs",
|
||||
"crates/horizon-client/src/game/native_menu_stacks.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{
|
||||
"name": "add_particle",
|
||||
"target": "horizon_client::game::native_client_particles::Game<'_>::native_add_particle"
|
||||
}
|
||||
],
|
||||
"rust_summary": "one local client particle through Host::add_particle, retaining the existing provider and engine limits.",
|
||||
"doc_summary": "`Host::add_particle(&ParticleOptions, position, velocity) -> bool` submits one particle to this client's loaded world. It preserves all option and velocity slots, including encoded color/size arguments, and uses the existing built-in and named-sprite providers with normal camera-distance, Particles-setting and population limits. True means submitted, not necessarily visible; missing providers/sprite sets draw nothing. It returns false on servers, without a client player/level, or for non-finite numeric input. Custom provider registration and new trigger hooks remain separate. Bundles need \"hooks\": @API:client_particles@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_client_particles.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "client_player_network_logging_in",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_client_player_network_logging_in",
|
||||
"neoforge": "ClientPlayerNetworkEvent.LoggingIn",
|
||||
"side": "client",
|
||||
"cancellable": false,
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "the window's player logging in to a server (`native_client_player_network_logging_in`).",
|
||||
"doc_summary": "the window's player logging in to a server, single player's own included: `native_client_player_network_logging_in()`, NeoForge's `ClientPlayerNetworkEvent.LoggingIn`, once per login packet after the new client level, not on respawns or dimension changes. Its counterpart for logging out is `native_client_disconnecting` ([Logging in and out](#logging-in-and-out)). Bundles need \"hooks\": @API:client_player_network_logging_in@."
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "client_tick_pre",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_client_tick_pre",
|
||||
"neoforge": "ClientTickEvent.Pre",
|
||||
"side": "client",
|
||||
"cancellable": false,
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "client_tick_post",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_client_tick_post",
|
||||
"neoforge": "ClientTickEvent.Post",
|
||||
"side": "client",
|
||||
"cancellable": false,
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "the window's client tick, before and after its work (`native_client_tick_pre`, `native_client_tick_post`).",
|
||||
"doc_summary": "the window's client tick for client mods: `native_client_tick_pre()` and `native_client_tick_post()` bracket each one, as NeoForge's `ClientTickEvent.Pre` and `.Post` do, 20 times a second on the title screen, while paused and in a world alike, never on a server ([The client's tick](#the-clients-tick)). Bundles need \"hooks\": @API:client_tick@."
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "client_chunks", "target": "horizon_client::game::native_client_world::Game<'_>::native_client_chunks"},
|
||||
{"name": "client_chunks_changed", "target": "horizon_client::game::native_client_world::Game<'_>::native_client_chunks_changed"},
|
||||
{"name": "client_biomes", "target": "horizon_client::game::native_client_world::Game<'_>::native_client_biomes"},
|
||||
{"name": "client_biomes_changed", "target": "horizon_client::game::native_client_world::Game<'_>::native_client_biomes_changed"}
|
||||
],
|
||||
"rust_summary": "client world snapshots (`native_client_chunks`, `native_client_chunks_changed`, `native_client_biomes`, `native_client_biomes_changed`): the client's loaded chunks of an area and its biome table, shared with the world and read on a mod's own threads.",
|
||||
"doc_summary": "client world snapshots: `native_client_chunks(from, to)` shares the client world's loaded chunks of an area with a mod's worker threads (`NativeClientChunks`: block states, biome ids, which columns are loaded, each column's top non-empty section, the world's height), `native_client_chunks_changed(&snapshot)` names the chunks that differ from the snapshot now, `native_client_biomes()` gives the biome table that names and tints the ids (`NativeClientBiomes`) and `native_client_biomes_changed(&biomes)` says when the terrain is drawn with another ([Client world snapshots](#client-world-snapshots)). Bundles need `\"hooks\": @API:client_world_snapshots@`.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_client_world.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "command_info", "target": "horizon_client::game::native_server::Game<'_>::native_command_info"}
|
||||
],
|
||||
"rust_summary": "a server command looked up by name, an alias resolved (`native_command_info`).",
|
||||
"doc_summary": "`native_command_info(label)` looks up the server's command `label` names, a mod's registered one or vanilla's with its alias resolved (Bukkit's `CommandMap.getCommand`), as a `NativeCommandInfo`: name, aliases, usages, operator level, whether vanilla has it. Bundles need \"hooks\": @API:command_info@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_server.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"rust_summary": "a permission node on a mod's command (`NativeCommand::permission`), which the command tree and the server's dispatch ask `native_has_permission` for.",
|
||||
"doc_summary": "`NativeCommand::permission(node)`: a mod's command that a permission node decides, not the level alone; the server asks `native_has_permission(player, node, level)` before it puts the command in a player's tree and before it runs it, so a permissions mod grants or refuses it (Bukkit's `plugin.yml` `permission:`). Bundles need \"hooks\": @API:command_permission@."
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{
|
||||
"name": "set_compass_target",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_set_compass_target"
|
||||
}
|
||||
],
|
||||
"rust_summary": "a player's compass target, kept over respawns and level changes (`native_set_compass_target`), as Bukkit's `setCompassTarget`.",
|
||||
"doc_summary": "`native_set_compass_target(uuid, target)` (`host.set_compass_target`) points one player's compass at a dimension and block position, or at the world spawn again (None), as Bukkit's `Player.setCompassTarget`; the target is sent in place of the world spawn until a mod sets it again or they leave, so a respawn or a level change keeps it. Bundles need \"hooks\": @API:compass_target@."
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "console_line",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_console_line",
|
||||
"neoforge": "none (Bukkit's ServerCommandEvent and RemoteServerCommandEvent; NeoForge's CommandEvent hears parsed commands only)",
|
||||
"side": "server",
|
||||
"cancellable": true,
|
||||
"mod_api": {
|
||||
"contract": "cancel",
|
||||
"out": "cancel"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "every line the dedicated server's console or RCON is about to run, cancellable, with replies (`native_console_line`).",
|
||||
"doc_summary": "every console and RCON line before it runs, cancellable, with replies: `native_console_line(source, line, cancel, replies)`, `source` being `console` or `rcon`. Bundles need \"hooks\": @API:console_line@."
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "container_accepts",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_container_accepts",
|
||||
"neoforge": "IItemHandler.isItemValid (Capabilities.Item.BLOCK)",
|
||||
"side": "server",
|
||||
"cancellable": true,
|
||||
"mod_api": {
|
||||
"contract": "cancel",
|
||||
"out": "cancel"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "a mod container's say on which items it takes (`native_container_accepts`).",
|
||||
"doc_summary": "`native_container_accepts(pos, entity, slot, stack, face, cancel)` is asked before a hopper, a dropper or `native_insert_item` puts an item into a slot of a mod's container that its `ModContainer` lets be filled; set `cancel` to refuse it, as `IItemHandler.isItemValid` returning false. Bundles need \"hooks\": @API:container_accepts@."
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "creative_slot_v2",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_creative_slot_v2",
|
||||
"side": "server",
|
||||
"cancellable": true,
|
||||
"mod_api": {
|
||||
"contract": "cancel",
|
||||
"out": "cancel"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "a creative slot set with the whole stack (`native_creative_slot_v2`), leaving `native_creative_slot` as it was.",
|
||||
"doc_summary": "`native_creative_slot_v2(player, name, slot, stack, cancel)`: an additive version of `native_creative_slot` with the whole stack put in the slot (none for an emptied one), its components included (enchantments, unbreakable, attribute modifiers, contents). Heard just before v1, which hears nothing of a packet canceled here; v1 keeps its signature and firing point. Bundles that use it need `\"hooks\": @API:creative_slot_v2@`."
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "custom_block_fluids",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_custom_block_fluids",
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "custom_fluid_tanks",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_custom_fluid_tanks",
|
||||
"mod_api": {
|
||||
"contract": "replace",
|
||||
"out": "out"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "custom_fluid_fill",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_custom_fluid_fill",
|
||||
"mod_api": {
|
||||
"contract": "replace",
|
||||
"out": "out"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "custom_fluid_drain",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_custom_fluid_drain",
|
||||
"mod_api": {
|
||||
"contract": "replace",
|
||||
"out": "out"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "an opt-in provider behind the ordinary block-fluid helpers.",
|
||||
"doc_summary": "`native_custom_block_fluids` opts into native-owned tank storage used by the existing sided block-fluid queries, insert and extract helpers. Providers retain their own data and tank rules. Ordinary transfers skip these endpoints until a rollback contract exists. Bundles need \"hooks\": @API:custom_block_fluids@."
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "custom_payload_from_client",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_custom_payload_from_client",
|
||||
"neoforge": "none (NeoForge registers payload handlers per type; Bukkit's PluginMessageListener)",
|
||||
"side": "server",
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "a player's plugin channel message on a channel that isn't Horizon's own (`native_custom_payload_from_client`).",
|
||||
"doc_summary": "`native_custom_payload_from_client(player, channel, data)` hears a player's `ServerboundCustomPayloadPacket` in play on any channel that isn't Horizon's own, which vanilla drops: in the tick after it arrives, with no player's state swapped in, from a dead player too. Bundles need \"hooks\": @API:custom_payload_from_client@."
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{
|
||||
"name": "default_state",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_default_state"
|
||||
}
|
||||
],
|
||||
"rust_summary": "a block's default state by name (`native_default_state`).",
|
||||
"doc_summary": "`native_default_state(block)`, the default state of a block by name (`Block.defaultBlockState`), what `native_set_block` takes, so a machine can clear or place a block without reaching into the registry. Bundles that use it need \"hooks\": @API:default_state@.",
|
||||
"comments": []
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "draw_text", "target": "horizon_client::game::native_block_entity_draw::Game<'_>::native_draw_text"}
|
||||
],
|
||||
"rust_summary": "text in the world from `native_block_entity_submit` (`native_draw_text`), as a sign draws its lines.",
|
||||
"doc_summary": "`native_draw_text(draw, text, at, color, glowing, outline)` draws a `Text` under a block entity's pose as a sign draws its lines (`Font.drawInBatch`): one unit a font pixel, each span in its colour, glowing text full bright, an optional outline; it returns the width. Bundles need \"hooks\": @API:draw_text@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_block_entity_draw.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "entity_change_block_v2",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_entity_change_block_v2",
|
||||
"neoforge": "none (NeoForge has no such event; Bukkit's EntityChangeBlockEvent is cancellable)",
|
||||
"side": "server",
|
||||
"cancellable": true,
|
||||
"mod_api": {
|
||||
"contract": "cancel",
|
||||
"out": "cancel"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "a mod's say before a player's landing changes a block (`native_entity_change_block_v2`).",
|
||||
"doc_summary": "`native_entity_change_block_v2(player, entity, kind, pos, from, to, cancel)` is asked before a landing's block change takes effect: farmland trampled into dirt and a turtle egg broken by a player walking over it. `player` is the player whose landing it was, `entity` and `kind` the mob for a mob's landing, `from` and `to` the block names. Set `cancel` and the block stays as it was, and nothing the change would have caused happens - the crop above untouched farmland stays. Bukkit's `EntityChangeBlockEvent`. Bundles need \"hooks\": @API:entity_change_block_v2@.",
|
||||
"comments": []
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "entity_data_to",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_entity_data_to",
|
||||
"neoforge": "none (NeoForge has no per-viewer entity data event; ProtocolLib's ENTITY_METADATA listener)",
|
||||
"side": "server",
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
}
|
||||
],
|
||||
"helpers": [
|
||||
{
|
||||
"name": "watch_entity_data",
|
||||
"target": "horizon_client::game::native_packets::Game<'_>::native_watch_entity_data"
|
||||
}
|
||||
],
|
||||
"rust_summary": "the entity data one player is sent, changeable for that viewer alone (`native_entity_data_to`), once a mod switched it on (`native_watch_entity_data`).",
|
||||
"doc_summary": "`native_entity_data_to(viewer, entity, values)` hears each `ClientboundSetEntityDataPacket` the server is about to send one player, its `(index, serializer, value)` entries changeable for that viewer alone (a glowing bit, a name only one player sees), just before `native_server_packet` hears the same packet. Nothing is decoded for it until a mod calls `native_watch_entity_data()`, and then only this packet. Bundles need \"hooks\": @API:entity_data_to@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_packets.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "entity_interact_specific",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_entity_interact_specific",
|
||||
"neoforge": "PlayerInteractEvent.EntityInteractSpecific",
|
||||
"side": "server",
|
||||
"cancellable": true,
|
||||
"mod_api": {
|
||||
"contract": "cancel",
|
||||
"out": "claimed"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "a right-click on an entity with the point clicked (`native_entity_interact_specific`).",
|
||||
"doc_summary": "a right-click on an entity with the point clicked: `native_entity_interact_specific` hears the entity, its type, the held stack and the point clicked, measured from the entity's position, before `native_interact_entity`, as NeoForge's `PlayerInteractEvent.EntityInteractSpecific`; a claim swings the hand and ends the click. Server-side. Bundles need \"hooks\": @API:entity_interact_specific@."
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{
|
||||
"name": "entity_teleport_to",
|
||||
"target": "horizon_client::game::native_entity_moves::Game<'_>::native_entity_teleport_to",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_set_rotation",
|
||||
"target": "horizon_client::game::native_entity_moves::Game<'_>::native_entity_set_rotation",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_head_yaw",
|
||||
"target": "horizon_client::game::native_entity_moves::Game<'_>::native_entity_head_yaw",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_set_head_yaw",
|
||||
"target": "horizon_client::game::native_entity_moves::Game<'_>::native_entity_set_head_yaw",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_direction",
|
||||
"target": "horizon_client::game::native_entity_moves::Game<'_>::native_entity_direction",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_dimensions",
|
||||
"target": "horizon_client::game::native_entity_moves::Game<'_>::native_entity_dimensions",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_push",
|
||||
"target": "horizon_client::game::native_entity_moves::Game<'_>::native_entity_push",
|
||||
"receiver": "entity"
|
||||
}
|
||||
],
|
||||
"rust_summary": "moving and turning an entity through an `EntityRef`: teleport, rotation, head yaw, facing, size and pushes.",
|
||||
"doc_summary": "`entity.teleport_to(host, pos, rotation)` and `set_rotation(host, yaw, pitch)` (as `/tp` and `/rotate` move and turn it), `head_yaw`, `set_head_yaw`, `direction` (`north`...), `dimensions` (width, height) and `push(host, delta)`. Bundles need \"hooks\": @API:entity_moves@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_entity_moves.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "entity_outline",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_entity_outline",
|
||||
"side": "client",
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "the glowing outline a client draws on an entity (`native_entity_outline`).",
|
||||
"doc_summary": "the glowing outline a client draws on an entity (`native_entity_outline(entity_id, kind, outline)`): vanilla's\n`isCurrentlyGlowing` and team colour come in as `Some(0xRRGGBB)` or None, and a mod sets `Some` to make any mob,\nplayer, dropped item or projectile glow in its own colour, or None to remove the outline. Drawing only: the entity's\n`Glowing` flag is unchanged. Bundles need \"hooks\": @API:entity_outline@."
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{
|
||||
"name": "entity_is_shift_key_down",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_is_shift_key_down",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_is_crouching",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_is_crouching",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_is_sprinting",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_is_sprinting",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_is_in_water",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_is_in_water",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_is_in_lava",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_is_in_lava",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_fire_immune",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_fire_immune",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_fire_ticks",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_fire_ticks",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_air_supply",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_air_supply",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_max_air_supply",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_max_air_supply",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_is_silent",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_is_silent",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_set_silent",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_set_silent",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_is_invisible",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_is_invisible",
|
||||
"receiver": "entity"
|
||||
},
|
||||
{
|
||||
"name": "entity_pose",
|
||||
"target": "horizon_client::game::native_entity_state::Game<'_>::native_entity_pose",
|
||||
"receiver": "entity"
|
||||
}
|
||||
],
|
||||
"rust_summary": "an entity's state flags through an `EntityRef`: sneaking, sprinting, water and lava, fire, air, silence, invisibility and pose.",
|
||||
"doc_summary": "`entity.is_shift_key_down(host)`, `is_crouching`, `is_sprinting`, `is_in_water`, `is_in_lava`, `fire_immune`, `fire_ticks`, `air_supply`, `max_air_supply`, `is_silent`, `set_silent(host, silent)`, `is_invisible` and `pose` (`standing`, `crouching`...). Players and mobs have them all; other kinds return `None` for what Horizon doesn't keep for them. Bundles need \"hooks\": @API:entity_state@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_entity_state.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "use_as_player", "target": "horizon_client::game::native_machines::Game<'_>::native_use_as_player"}
|
||||
],
|
||||
"rust_summary": "a mod's fake player uses an item on a block, in the air or on an entity (`native_use_as_player`), as a deployer does.",
|
||||
"doc_summary": "`native_use_as_player(stack, eye, yaw, pitch, target, sneaking)` uses `stack` as NeoForge's `FakePlayer` would: `useItemOn` on a block, `useItem` in the air, or `interactOn` with an entity, in survival with nothing else in hand; it returns whether the use did something and what the fake player holds and carries afterwards. Bundles need \"hooks\": @API:fake_player@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_machines.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "fishing_hook_landed",
|
||||
"target": "horizon_client::game::native_hooks::Game<'_>::native_fishing_hook_landed",
|
||||
"neoforge": "none (NeoForge's ProjectileImpactEvent leaves the bobber's block contact out; Bukkit's ProjectileHitEvent for a FishHook)",
|
||||
"side": "server",
|
||||
"mod_api": {
|
||||
"contract": "listen"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "a server player's fishing bobber meeting or lying on a block, each tick (`native_fishing_hook_landed`).",
|
||||
"doc_summary": "`native_fishing_hook_landed(player, hook, dimension, block, face)`: a server player's fishing bobber touching a block, as Bukkit's `ProjectileHitEvent` for a `FishHook`: each tick the flying bobber meets a block or lies on one (then the block under its centre, face `[0, 1, 0]`), with the bobber in place so `native_remove_entity` can take it. Bundles need \"hooks\": @API:fishing_hook_landed@."
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "fluid_flow", "target": "horizon_client::game::native_world_read::Game<'_>::native_fluid_flow"}
|
||||
],
|
||||
"rust_summary": "the current of a fluid at a position (`native_fluid_flow`, `FluidState.getFlow`).",
|
||||
"doc_summary": "`native_fluid_flow(dimension, pos)` is `FluidState.getFlow(level, pos)`: the normalised current an item in the fluid is pushed by, zero for still or no fluid, none where the chunk isn't loaded or the dimension isn't available. Bundles need \"hooks\": @API:fluid_flow@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_world_read.rs"
|
||||
]
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name":"draw_fluid_box", "target":"horizon_client::game::native_fluid_render::Game<'_>::native_draw_fluid_box", "mod_api":{}}
|
||||
],
|
||||
"rust_summary": "still-fluid boxes under a native draw pose, using sorted depth-writing translucency and the animated mipmapped block sprites (`native_draw_fluid_box`).",
|
||||
"doc_summary": "`native_draw_fluid_box(draw,stack,bounds,options)` draws a `NativeFluidStack` in `[xMin,yMin,zMin,xMax,yMax,zMax]` under a block entity/mob draw pose. Supports `minecraft:water` and `minecraft:lava` with an empty component patch; unsupported IDs/patches, nonfinite/reversed bounds and boxes exceeding 65,536 tiled quads return false without partial geometry. Empty accepted amounts return true without validating bounds and emit nothing. `NativeFluidRenderOptions` requires `argb:Option<u32>` (stack tint override, default plain water 0xff3f76e4/lava white), `render_bottom:bool`, and `uv_shrink_ratio:f32` (0..1, source TextureAtlasSprite ratio 4 / the largest stitched atlas dimension; explicit because Horizon uses sprite arrays). Faces tile at integer boundaries with local UV fractions, no geometry inset. The still sprite follows resource packs/animations/mipmap settings; nearest texels use linear mip selection. Luminosity raises block light (lava 15), preserving sky light; vertex colors have no model diffuse shading. A separate material sorts far to near, alpha blends, culls backs and writes ordinary color/depth, with no alpha discard. It draws with block entities before terrain transparency, separately from improved-transparency queues and the world canvas. Bundles need \"hooks\": @API:fluid_render@.",
|
||||
"comments": ["crates/horizon-client/src/game/native_fluid_render.rs"]
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"name": "handshake",
|
||||
"target": "horizon_client_lib::lan::conn::native_handshake",
|
||||
"neoforge": "none (NeoForge has no handshake event; Paper's PlayerHandshakeEvent)",
|
||||
"side": "server",
|
||||
"cancellable": true,
|
||||
"mod_api": {
|
||||
"contract": "cancel",
|
||||
"out": "cancel"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rust_summary": "a client's handshake on the connection's thread, its host rewritable, refusable (`native_handshake`).",
|
||||
"doc_summary": "`native_handshake(address, host, intent, cancel, reason)` hears each network connection's handshake on its own thread, before the server acts on the intent (1 status, 2 login, 3 transfer): rewrite `host` (what a proxy put after it, Floodgate's data, included), or set `cancel` to refuse; a login or transfer is disconnected with `reason`, a status ping closed unanswered. No `Game` and no helper there. Bundles need \"hooks\": @API:handshake@.",
|
||||
"comments": ["crates/horizon-client/src/lan/conn.rs"]
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "health_hud_state", "target": "horizon_client::game::native_hooks::Game<'_>::native_health_hud_state"},
|
||||
{"name": "local_attribute", "target": "horizon_client::game::native_hooks::Game<'_>::native_local_attribute"}
|
||||
],
|
||||
"rust_summary": "Horizon's health HUD state for a `native_health_hud` mod (`native_health_hud_state`) and this\nclient's player's attribute values (`native_local_attribute`).",
|
||||
"doc_summary": "`native_health_hud_state()`, Horizon's health HUD state, for a mod answering `native_health_hud`: its `left_height` and `right_height` place the item name and the action bar, and its `layout` draws Horizon's rows; and `native_local_attribute(name)`, the value of an attribute of this client's player (`minecraft:armor_toughness`). Bundles need \"hooks\": @API:health_hud_state@."
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "hide_entity_from", "target": "horizon_client::game::native_server::Game<'_>::native_hide_entity_from"}
|
||||
],
|
||||
"rust_summary": "an entity hidden from one player's client, or shown again (`native_hide_entity_from`), as Bukkit's `Player.hideEntity`/`showEntity`.",
|
||||
"doc_summary": "`native_hide_entity_from(viewer, entity, hidden)` hides an entity (a mob, a display, another player) from one player's client alone, or shows it again: their client stops tracking it from the next tick, and a hidden player also leaves their Tab list. Kept while the viewer is on, for that entity id. Bundles need \"hooks\": @API:hide_entity_from@.",
|
||||
"comments": ["crates/horizon-client/src/game/native_server.rs"]
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"hooks": [],
|
||||
"helpers": [
|
||||
{"name": "draw_model", "target": "horizon_client::game::native_block_entity_draw::Game<'_>::native_draw_model"},
|
||||
{"name": "mod_block_entity", "target": "horizon_client::game::native_host_bridge::Game<'_>::native_mod_block_entity"},
|
||||
{"name": "change_mod_block_entity", "target": "horizon_client::game::native_host_bridge::Game<'_>::native_change_mod_block_entity"},
|
||||
{"name": "item_entities", "target": "horizon_client::game::native_hooks::Game<'_>::native_item_entities"},
|
||||
{"name": "level_random", "target": "horizon_client::game::native_hooks::Game<'_>::native_level_random"},
|
||||
{"name": "play_sound", "target": "horizon_client::game::native_host_bridge::Game<'_>::native_play_sound_in_place"},
|
||||
{"name": "send_particles", "target": "horizon_client::game::native_host_bridge::Game<'_>::native_send_particles_in_place"},
|
||||
{"name": "block_name_in_tag", "target": "horizon_client::game::native_world_read::Game<'_>::native_block_name_in_tag"},
|
||||
{"name": "server_item_in_tag", "target": "horizon_client::game::native_world_read::Game<'_>::native_server_item_in_tag"},
|
||||
{"name": "component", "target": "horizon_client::game::native_components::Game<'_>::native_component"},
|
||||
{"name": "set_component", "target": "horizon_client::game::native_components::Game<'_>::native_set_component"},
|
||||
{"name": "remove_component", "target": "horizon_client::game::native_components::Game<'_>::native_remove_component"},
|
||||
{"name": "trigger_criterion", "target": "horizon_client::game::native_criteria::Game<'_>::native_trigger_mod_criterion"},
|
||||
{"name": "equipment", "target": "horizon_client::game::native_host_bridge::Game<'_>::native_equipment"},
|
||||
{"name": "sneaking", "target": "horizon_client::game::native_host_bridge::Game<'_>::native_sneaking"}
|
||||
],
|
||||
"rust_summary": "trait mods reach helpers `dyn Host` couldn't carry: `draw_model`, `mod_block_entity` and `change_mod_block_entity` (a neighbour's mod block entity), `item_entities`, `level_random`, `play_sound` and `send_particles` outside level hooks, `block_name_in_tag`, `server_item_in_tag`, item components, `trigger_criterion`, and the player's `equipment` and `sneaking`.",
|
||||
"doc_summary": "`Host` gains `draw_model` (standalone models in `block_entity_submit`), `mod_block_entity(pos)` (a copy; on a client what the server sent) and `change_mod_block_entity(pos, change)`, `item_entities`, `level_random(dimension)`, `play_sound` and `send_particles` for the level in place, `block_name_in_tag` and `server_item_in_tag`, `component`, `set_component` and `remove_component`, `trigger_criterion` with a `&dyn Fn` test, `equipment(slot)` (on a client the player's own) and `sneaking()` (`isSecondaryUseActive` in a use hook). Bundles need \"hooks\": @API:host_bridge@.",
|
||||
"comments": [
|
||||
"crates/horizon-client/src/game/native_host_bridge.rs",
|
||||
"crates/horizon-client/src/game/native_world_read.rs",
|
||||
"crates/horizon-client/src/game/native_criteria.rs"
|
||||
]
|
||||
}
|
||||
Loaded 100 of 211 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user