diff --git a/crates/horizon-client/src/banner.rs b/crates/horizon-client/src/banner.rs index 861294722..aa470a552 100644 --- a/crates/horizon-client/src/banner.rs +++ b/crates/horizon-client/src/banner.rs @@ -2,7 +2,7 @@ //! `banner_patterns` layers carried by banner items, shields and placed //! banners, and the loom rules of `LoomMenu` (selectable patterns, the //! six-layer limit and the result stack). -use crate::{block_entity_render::DYES, item_data, items::ItemStack, items::Items}; +use crate::{block_entity_render::DYES, items::ItemStack, items::Items}; use horizon_world::nbt::Tag; use serde_json::Value; use std::{collections::HashMap, fs, path::Path, sync::Arc}; @@ -261,12 +261,6 @@ pub fn layers_from_nbt(tag: Option<&Tag>) -> Vec { }) .collect() } -/// Keeps `item_data` linked: the `StackData` fields the banner code reads. -pub fn set_layers(stack: &mut ItemStack, layers: Vec) { - let data: &mut item_data::StackData = stack.data_mut(); - data.banner_patterns = layers; - stack.tidy(); -} #[cfg(test)] mod tests { diff --git a/crates/horizon-client/src/block_entities.rs b/crates/horizon-client/src/block_entities.rs index 93abb3711..03fff85ca 100644 --- a/crates/horizon-client/src/block_entities.rs +++ b/crates/horizon-client/src/block_entities.rs @@ -144,9 +144,6 @@ impl BlockEntities { pub fn set_states(&mut self, states: Vec) { self.states = states; } - pub fn take_states(&mut self) -> Vec { - std::mem::take(&mut self.states) - } pub fn ticking(&self, state: u32) -> Ticking { self.states.get(state as usize).copied().unwrap_or_default() } diff --git a/crates/horizon-client/src/block_entity_anim.rs b/crates/horizon-client/src/block_entity_anim.rs index 2a35c9835..d91748e73 100644 --- a/crates/horizon-client/src/block_entity_anim.rs +++ b/crates/horizon-client/src/block_entity_anim.rs @@ -382,10 +382,6 @@ impl Shulker { } out } - /// `getProgress(a)`: `Mth.lerp(a, progressOld, progress)`. - pub fn get_progress(&self, a: f32) -> f32 { - self.progress_old + a * (self.progress - self.progress_old) - } /// `ShulkerBoxBlock.canOpen`: a closed box only opens when its lid has room /// (`level.noCollision` of the half-block lid box, deflated by 1e-6). pub fn lid_box(pos: [i32; 3], facing: u8) -> [f64; 6] { @@ -668,14 +664,6 @@ impl Skull { self.animating = false; } } - /// `getAnimation(a)`. - pub fn get_animation(&self, a: f32) -> f32 { - if self.animating { - self.tick_count as f32 + a - } else { - self.tick_count as f32 - } - } } /// `DecoratedPotBlockEntity.WobbleStyle`. diff --git a/crates/horizon-client/src/block_entity_render.rs b/crates/horizon-client/src/block_entity_render.rs index 21376d698..af4168307 100644 --- a/crates/horizon-client/src/block_entity_render.rs +++ b/crates/horizon-client/src/block_entity_render.rs @@ -875,13 +875,6 @@ impl BlockEntityRenderer { visibility: None, } } - /// The standing banner's pole-and-bar and flag models (`BannerRenderer.submitSpecial`). - pub fn banner_models(&self) -> Option<(&ModelPart, &ModelPart)> { - Some(( - self.models.get("standing_banner")?, - self.models.get("standing_banner_flag")?, - )) - } fn kind(&self, state: u32) -> &Kind { self.kinds.get(state as usize).unwrap_or(&Kind::None) } diff --git a/crates/horizon-client/src/clock.rs b/crates/horizon-client/src/clock.rs index 3240944ba..1aebf644a 100644 --- a/crates/horizon-client/src/clock.rs +++ b/crates/horizon-client/src/clock.rs @@ -169,10 +169,6 @@ impl TickRateManager { self.frozen_ticks_to_run -= 1; } } - /// `isEntityFrozen` for an entity that is not (and does not carry) a player. - pub fn is_entity_frozen(&self, is_player_or_carries_player: bool) -> bool { - !self.runs_normally() && !is_player_or_carries_player - } } /// What `/tick sprint` reports when it ends. diff --git a/crates/horizon-client/src/command/args.rs b/crates/horizon-client/src/command/args.rs index 68d41e14f..ccced67a7 100644 --- a/crates/horizon-client/src/command/args.rs +++ b/crates/horizon-client/src/command/args.rs @@ -812,14 +812,6 @@ pub fn java_parse_int(s: &str) -> Option { } s.parse().ok() } -/// Long.parseLong. -pub fn java_parse_long(s: &str) -> Option { - let digits = s.strip_prefix(['-', '+']).unwrap_or(s); - if digits.is_empty() || !digits.chars().all(|c| c.is_ascii_digit()) { - return None; - } - s.parse().ok() -} /// Double.parseDouble over the characters StringReader reads as a number. pub fn java_parse_double(s: &str) -> Option { let t = s.trim_matches(|c: char| c <= ' '); diff --git a/crates/horizon-client/src/command/component.rs b/crates/horizon-client/src/command/component.rs index 9bc0668d5..15a8fa6a0 100644 --- a/crates/horizon-client/src/command/component.rs +++ b/crates/horizon-client/src/command/component.rs @@ -1,7 +1,7 @@ //! ComponentSerialization.CODEC and Style.Serializer.MAP_CODEC decoding of //! SNBT text components, with the data-fixer-upper error messages //! (ComponentArgument, StyleArgument and component-valued item data). -use super::codec::{get, no_key, not_list, not_map, snbt}; +use super::codec::{get, no_key, not_list, not_map}; use horizon_world::nbt::{Compound, Tag}; /// A DataResult error: its message and whether it carries a partial result. @@ -362,7 +362,3 @@ pub fn decode_style(t: &Tag) -> Result<(), String> { _ => Err(not_map(t)), } } -#[allow(unused)] -fn _keep(t: &Tag) -> String { - snbt(t) -} diff --git a/crates/horizon-client/src/command/item.rs b/crates/horizon-client/src/command/item.rs index 7c8abe84a..f2abc91ef 100644 --- a/crates/horizon-client/src/command/item.rs +++ b/crates/horizon-client/src/command/item.rs @@ -632,10 +632,6 @@ pub fn parse_predicate(reader: &mut Reader, reg: &Registries) -> CmdResult String { - snbt(t) -} #[cfg(test)] mod tests { diff --git a/crates/horizon-client/src/command/mod.rs b/crates/horizon-client/src/command/mod.rs index e9aeaae51..a61c8c08d 100644 --- a/crates/horizon-client/src/command/mod.rs +++ b/crates/horizon-client/src/command/mod.rs @@ -183,9 +183,6 @@ impl<'a> Reader<'a> { pub fn read_int(&mut self) -> CmdResult { self.number("int") } - pub fn read_long(&mut self) -> CmdResult { - self.number("long") - } pub fn read_double(&mut self) -> CmdResult { self.number("double") } @@ -222,21 +219,6 @@ impl<'a> Reader<'a> { } Err(CommandError::tr_at("parsing.quote.expected.end", &[], self)) } - pub fn read_quoted_string(&mut self) -> CmdResult { - if !self.can_read() { - return Ok(String::new()); - } - let next = self.peek(); - if next != '"' && next != '\'' { - return Err(CommandError::tr_at( - "parsing.quote.expected.start", - &[], - self, - )); - } - self.skip(); - self.read_string_until(next) - } pub fn read_string(&mut self) -> CmdResult { if !self.can_read() { return Ok(String::new()); @@ -539,18 +521,6 @@ impl<'a> SuggestionsBuilder<'a> { } } } - /// The same with a tooltip per candidate. - pub fn suggest_matching_tooltip<'b>( - &mut self, - candidates: impl IntoIterator, - ) { - let lower = self.remaining_lower(); - for (c, tip) in candidates { - if args::matches_sub_str(&lower, &c.to_lowercase()) { - self.suggest_tooltip(c, tip); - } - } - } } /// String.compareToIgnoreCase. pub fn compare_ignore_case(a: &str, b: &str) -> std::cmp::Ordering { diff --git a/crates/horizon-client/src/command/snbt.rs b/crates/horizon-client/src/command/snbt.rs index 05fe6d9bc..7472c7ae3 100644 --- a/crates/horizon-client/src/command/snbt.rs +++ b/crates/horizon-client/src/command/snbt.rs @@ -1,8 +1,6 @@ //! SnbtGrammar and TagParser: vanilla's packrat SNBT grammar, with its //! error messages and completion suggestions, producing NBT tags. -use super::packrat::{ - Grammar, Reason, Rule, State, Sugg, Term, Value, alt, ch, chs, look, opt, seq, -}; +use super::packrat::{Grammar, Reason, State, Sugg, Term, Value, alt, ch, chs, look, opt, seq}; use super::{CmdResult, CommandError, Reader, SuggestionsBuilder}; use horizon_world::nbt::{Compound, JavaString, Tag}; use std::rc::Rc; @@ -981,5 +979,3 @@ pub fn rule_in( } } } -#[allow(unused)] -fn _rule_kind(_: Rule) {} diff --git a/crates/horizon-client/src/command/vanilla.rs b/crates/horizon-client/src/command/vanilla.rs index fd23b82cd..cdd4848d7 100644 --- a/crates/horizon-client/src/command/vanilla.rs +++ b/crates/horizon-client/src/command/vanilla.rs @@ -3,7 +3,7 @@ //! mode keywords are read back from the parsed literals. use super::{ Dispatcher, - args::{ArgType, GameMode, Resource, integer}, + args::{ArgType, Resource, integer}, }; use crate::gamerules::{RULES, Value}; @@ -509,10 +509,6 @@ fn clone_mode(d: &mut Dispatcher, node: usize) { d.executes(l, "clone"); } } -/// Game mode names for selector `gamemode=` and the argument. -pub fn game_modes() -> [&'static str; 4] { - GameMode::ALL.map(GameMode::name) -} /// The shared vanilla tree. /// Reorder node children as vanilla registers them (Brigadier keeps /// children in registration order; smart usage lists them that way). @@ -559,5 +555,3 @@ pub fn release_dispatcher() -> &'static Dispatcher { static TREE: std::sync::OnceLock = std::sync::OnceLock::new(); TREE.get_or_init(|| build_with(false)) } -#[allow(unused)] -const _: (u8, u8) = (ALL, GAMEMASTERS); diff --git a/crates/horizon-client/src/containers.rs b/crates/horizon-client/src/containers.rs index 854332815..6ecdf0d93 100644 --- a/crates/horizon-client/src/containers.rs +++ b/crates/horizon-client/src/containers.rs @@ -252,24 +252,6 @@ impl BlockEntity { }; Some(Self::Chest(vec![None; size])) } - /// The vanilla block entity type id of a container block. - pub fn id_for_block(name: &str) -> Option<&'static str> { - Some(match name { - "minecraft:chest" => "minecraft:chest", - n if n.ends_with("copper_chest") => "minecraft:chest", - "minecraft:trapped_chest" => "minecraft:trapped_chest", - "minecraft:barrel" => "minecraft:barrel", - "minecraft:hopper" => "minecraft:hopper", - "minecraft:dispenser" => "minecraft:dispenser", - "minecraft:dropper" => "minecraft:dropper", - "minecraft:furnace" => "minecraft:furnace", - "minecraft:blast_furnace" => "minecraft:blast_furnace", - "minecraft:smoker" => "minecraft:smoker", - n if n.ends_with("shulker_box") => "minecraft:shulker_box", - "minecraft:crafter" => "minecraft:crafter", - _ => return None, - }) - } pub fn id(&self) -> &'static str { match self { Self::Chest(items) => match items.len() { diff --git a/crates/horizon-client/src/debug_chart.rs b/crates/horizon-client/src/debug_chart.rs index 35fd40bd4..3d9cc5556 100644 --- a/crates/horizon-client/src/debug_chart.rs +++ b/crates/horizon-client/src/debug_chart.rs @@ -17,8 +17,6 @@ use std::{ pub const CAPACITY: usize = 240; /// `AbstractDebugChart.CHART_HEIGHT`. pub const CHART_HEIGHT: i32 = 60; -/// `TpsDebugDimensions`: a tick sample's values. -pub const FULL_TICK: usize = 0; pub const TICK_SERVER_METHOD: usize = 1; pub const SCHEDULED_TASKS: usize = 2; pub const IDLE: usize = 3; @@ -252,10 +250,6 @@ impl Chart { pub fn width(max_width: i32) -> i32 { (CAPACITY as i32 + 2).min(max_width) } - /// `getFullHeight`: the box and the min/avg/max line above it. - pub fn full_height() -> i32 { - CHART_HEIGHT + 9 - } /// `AbstractDebugChart.extractRenderState`. pub fn draw( self, diff --git a/crates/horizon-client/src/enchant.rs b/crates/horizon-client/src/enchant.rs index ca2ea6f5c..2fc9ef2fb 100644 --- a/crates/horizon-client/src/enchant.rs +++ b/crates/horizon-client/src/enchant.rs @@ -359,10 +359,6 @@ impl Enchantments { } out } - /// Whether a stack draws the enchantment glint. - pub fn has_glint(&self, stack: &ItemStack) -> bool { - stack.has_any_enchantments() || self.props(&stack.item).is_some_and(|p| p.glint) - } // ---- Enchanting table (EnchantmentHelper) ---- @@ -514,19 +510,6 @@ impl Enchantments { .is_some_and(|e| e.effects.get(component).is_some()) }) } - /// The highest level among enchantments on `stack` that have `component`. - pub fn component_level(&self, stack: &ItemStack, component: &str) -> u32 { - stack - .enchantments() - .iter() - .filter(|(id, _)| { - self.get(id) - .is_some_and(|e| e.effects.get(component).is_some()) - }) - .map(|(_, l)| *l) - .max() - .unwrap_or(0) - } /// `minecraft:attributes` contributions of `stack`: (attribute, id, amount, operation). pub fn attributes(&self, stack: &ItemStack) -> Vec<(String, String, f64, String)> { let mut out = Vec::new(); diff --git a/crates/horizon-client/src/first_person.rs b/crates/horizon-client/src/first_person.rs index 463d51437..02132d942 100644 --- a/crates/horizon-client/src/first_person.rs +++ b/crates/horizon-client/src/first_person.rs @@ -289,15 +289,6 @@ impl Default for HandHeights { } } } -/// What `FirstPersonHandsAndItems.tick` decides about a hand's visible item. -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub struct HandChange { - /// The visible item is not the hand's item after the instant replacement - /// (`mainHandItem != nextMainHand`): the hand lowers. - pub changed: bool, - /// The visible item becomes the hand's item this tick. - pub replace: bool, -} impl HandHeights { /// `FirstPersonHandsAndItems.tick`'s heights. `changed` says per hand /// whether the visible item differs from the held one once diff --git a/crates/horizon-client/src/game/chat.rs b/crates/horizon-client/src/game/chat.rs index 20aeeb7fd..0247896f5 100644 --- a/crates/horizon-client/src/game/chat.rs +++ b/crates/horizon-client/src/game/chat.rs @@ -5,7 +5,7 @@ use horizon_client::{ chat::{Chat, ChatAction, ChatScreen, Commands, SYSTEM_INDICATOR}, command::Registries, gamerules::GameRules, - hud::{HudBatch, rgba}, + hud::HudBatch, screen_draw::Measure, text::{ClickEvent, Style, Text}, }; @@ -883,10 +883,6 @@ impl Game<'_> { .chat .add(&self.gui.atlas, message, None, self.ticks, focused); } - #[allow(dead_code)] - fn chat_debug_fill(&self, batch: &mut HudBatch) { - batch.fill(&self.gui.atlas, 0.0, 0.0, 1.0, 1.0, rgba(0, 0, 0, 0)); - } } /// `yyyy-MM-dd_HH.mm.ss[_n].png` (Util.getFilenameFormattedDateTime, local time /// approximated as UTC). diff --git a/crates/horizon-client/src/game/lan_trading.rs b/crates/horizon-client/src/game/lan_trading.rs index 786399dac..83aafecc2 100644 --- a/crates/horizon-client/src/game/lan_trading.rs +++ b/crates/horizon-client/src/game/lan_trading.rs @@ -129,23 +129,6 @@ impl Game<'_> { } /// The screen title: the custom name, else the profession (the client /// adds the level itself). - #[allow(dead_code)] - fn merchant_title(&self, state: &MerchantState) -> String { - if let Some(name) = &state.name { - return name.clone(); - } - let e = &self.res.stations().enchantments; - let profession = state.session.profession.trim_start_matches("minecraft:"); - if state.session.villager { - e.translate(&format!("entity.minecraft.villager.{profession}")) - .unwrap_or(profession) - .to_owned() - } else { - e.translate("entity.minecraft.wandering_trader") - .unwrap_or("Wandering Trader") - .to_owned() - } - } /// `ServerPlayer.sendMerchantOffers`, when the offers changed. fn lan_send_offers( &mut self, diff --git a/crates/horizon-client/src/gfx.rs b/crates/horizon-client/src/gfx.rs index e379ace7c..e7997fb05 100644 --- a/crates/horizon-client/src/gfx.rs +++ b/crates/horizon-client/src/gfx.rs @@ -2307,10 +2307,6 @@ impl Renderer { view_formats: &config.view_formats, }) } - /// Rendering to a texture instead of the window (`--offscreen`). - pub fn is_offscreen(&self) -> bool { - self.surface.is_none() - } /// Release the window surface before another renderer uses the same window. pub fn release_surface(&mut self) { self.surface = None; diff --git a/crates/horizon-client/src/gfx/lod.rs b/crates/horizon-client/src/gfx/lod.rs index 734110b5c..3ebec378b 100644 --- a/crates/horizon-client/src/gfx/lod.rs +++ b/crates/horizon-client/src/gfx/lod.rs @@ -119,10 +119,6 @@ impl Tile { } impl Renderer { - pub fn resident_lods(&self) -> usize { - self.lods.len() - } - pub fn upload_lod(&mut self, key: TileKey, mesh: &SectionMesh) { self.remove_lod(key); if let Some(bounds) = Bounds::mesh(mesh) diff --git a/crates/horizon-client/src/gossip.rs b/crates/horizon-client/src/gossip.rs index 9a964a3e6..9ea4a668d 100644 --- a/crates/horizon-client/src/gossip.rs +++ b/crates/horizon-client/src/gossip.rs @@ -7,7 +7,6 @@ use std::collections::BTreeMap; /// `ReputationEventType` amounts. pub const REPUTATION_CHANGE_PER_EVENT: i32 = 25; -pub const REPUTATION_CHANGE_PER_EVERLASTING_MEMORY: i32 = 20; pub const REPUTATION_CHANGE_PER_TRADE: i32 = 2; /// `GossipContainer.DISCARD_THRESHOLD`: values below this are forgotten. const DISCARD_THRESHOLD: i32 = 2; diff --git a/crates/horizon-client/src/graphics_ui.rs b/crates/horizon-client/src/graphics_ui.rs index 514e64a88..d7ed82132 100644 --- a/crates/horizon-client/src/graphics_ui.rs +++ b/crates/horizon-client/src/graphics_ui.rs @@ -485,14 +485,6 @@ impl Item { _ => return None, }) } - /// Caption and value text, split from the label ("Caption: Value"). - pub fn caption_value(self, s: &Settings) -> (String, String) { - let label = self.label(s).plain(); - match label.split_once(": ") { - Some((c, v)) => (c.to_owned(), v.to_owned()), - None => (label, String::new()), - } - } pub fn slider(self, s: &Settings) -> Option { match self { Item::Vanilla(o) => o.slider_position(s), diff --git a/crates/horizon-client/src/hud.rs b/crates/horizon-client/src/hud.rs index 82e606947..480cf6ef9 100644 --- a/crates/horizon-client/src/hud.rs +++ b/crates/horizon-client/src/hud.rs @@ -783,24 +783,6 @@ impl HudBatch { }; self.text_styled(atlas, &t, x, y, color, shadow) } - /// `text_styled` under a pose: GUI positions scaled by `scale`, then - /// moved to `origin` (Matrix3x2fStack translate + scale). - pub fn text_posed( - &mut self, - atlas: &HudAtlas, - text: &crate::text::Text, - at: [f32; 2], - color: u32, - scale: f32, - origin: [f32; 2], - ) -> f32 { - let start = self.vertices.len(); - let advance = self.text_styled(atlas, text, at[0], at[1], color, true); - for v in &mut self.vertices[start..] { - v.pos = [origin[0] + v.pos[0] * scale, origin[1] + v.pos[1] * scale]; - } - advance - } /// Font.drawInternal: styled glyphs, shadows first, with bold, italic, /// underline and strikethrough. `color` is the default colour and alpha. pub fn text_styled( diff --git a/crates/horizon-client/src/item_render.rs b/crates/horizon-client/src/item_render.rs index 45531bedd..c2f5c8400 100644 --- a/crates/horizon-client/src/item_render.rs +++ b/crates/horizon-client/src/item_render.rs @@ -124,17 +124,6 @@ impl ItemRenderState { pub fn is_empty(&self) -> bool { self.layers.is_empty() } - /// `pickParticleMaterial`: a random layer's particle sprite. - pub fn pick_particle( - &self, - random: &mut impl horizon_core::random::RandomSource, - ) -> Option { - if self.layers.is_empty() { - return None; - } - let i = random.next_int_bound(self.layers.len() as i32).unwrap_or(0) as usize; - self.layers.get(i).map(|l| l.particle.clone()) - } /// `usesBlockLight` of the first layer (GUI lighting choice). pub fn uses_block_light(&self) -> bool { self.layers.first().is_some_and(|l| l.uses_block_light) diff --git a/crates/horizon-client/src/keybinds.rs b/crates/horizon-client/src/keybinds.rs index 5f8c0876b..a59aa627c 100644 --- a/crates/horizon-client/src/keybinds.rs +++ b/crates/horizon-client/src/keybinds.rs @@ -295,15 +295,6 @@ impl KeyBinds { self.keys.insert(n, key.to_owned()); } } - /// Load `key_` from options.txt; false for unknown mappings. - pub fn set_saved(&mut self, name: &str, key: &str) -> bool { - if MAPPINGS.iter().any(|m| m.0 == name) { - self.set(name, key); - true - } else { - false - } - } pub fn saved(&self) -> Vec<(&'static str, String)> { MAPPINGS .iter() diff --git a/crates/horizon-client/src/keymapping.rs b/crates/horizon-client/src/keymapping.rs index e598fbf71..e438c27ce 100644 --- a/crates/horizon-client/src/keymapping.rs +++ b/crates/horizon-client/src/keymapping.rs @@ -104,8 +104,6 @@ pub const SNEAK: usize = 0; pub const SPRINT: usize = 1; /// Attack (mouse). pub const ATTACK: usize = 2; -/// Use (mouse). -pub const USE: usize = 3; /// The `ToggleKeyMapping`s `Options` builds: sneak and sprint (keyboard, /// restored after a screen), attack (mouse, restored) and use (mouse, not diff --git a/crates/horizon-client/src/lan/guest.rs b/crates/horizon-client/src/lan/guest.rs index 4236280cd..9251107ca 100644 --- a/crates/horizon-client/src/lan/guest.rs +++ b/crates/horizon-client/src/lan/guest.rs @@ -15,7 +15,6 @@ use std::{ /// GameType ids. pub const SURVIVAL: i32 = 0; pub const CREATIVE: i32 = 1; -pub const ADVENTURE: i32 = 2; pub const SPECTATOR: i32 = 3; /// An effect as last sent in ClientboundUpdateMobEffectPacket. @@ -332,11 +331,6 @@ impl Guest { pub fn send(&self, packet: &play::Clientbound) { self.sender.send(packet.encode()); } - pub fn send_all(&self, packets: &[play::Clientbound]) { - for p in packets { - self.send(p); - } - } pub fn chunk(&self) -> (i32, i32) { ( (self.position[0].floor() as i32) >> 4, diff --git a/crates/horizon-client/src/lan/hub.rs b/crates/horizon-client/src/lan/hub.rs index 1330b0ae4..cbe0ecab7 100644 --- a/crates/horizon-client/src/lan/hub.rs +++ b/crates/horizon-client/src/lan/hub.rs @@ -172,13 +172,6 @@ pub struct Hub { fn string(s: &str) -> Tag { Tag::String(JavaString::from(s)) } -pub fn yellow_translation(key: &str, args: &[&str]) -> Tag { - let mut t = translatable(key, args); - if let Tag::Compound(map) = &mut t { - map.insert(JavaString::from("color"), string("yellow")); - } - t -} /// Player.getDisplayName for a player in no team: the name, suggesting /// `/tell NAME `, showing the player on hover and inserting the name. @@ -1360,21 +1353,6 @@ impl Hub { (!batch.is_empty()).then_some(batch) } - /// Resend a chunk to everyone who has it (a block entity changed, relight). - pub fn resend_chunk(&mut self, world: &World, x: i32, z: i32) { - let Some(chunk) = world.chunks.get(&(x, z)) else { - return; - }; - let body = self.encoder.body_in(chunk, world); - for g in self - .guests - .iter() - .filter(|g| g.sent_chunks.contains(&(x, z))) - { - g.sender.send(body.clone()); - } - } - /// `ChunkHolder.broadcastChanges`' light part: the light sections that /// changed in a column go to the players for whom it is on the border of /// what they track (`ChunkMap.isChunkOnTrackedBorder`); the others light diff --git a/crates/horizon-client/src/lan/mod.rs b/crates/horizon-client/src/lan/mod.rs index c2f35bc8e..5e4aedbab 100644 --- a/crates/horizon-client/src/lan/mod.rs +++ b/crates/horizon-client/src/lan/mod.rs @@ -272,9 +272,6 @@ impl Shared { pub fn max_players(&self) -> usize { self.max_players.load(Ordering::Relaxed) } - pub fn set_max_players(&self, n: usize) { - self.max_players.store(n, Ordering::Relaxed); - } pub fn release(&self, uuid: u128) { self.online.lock().unwrap().retain(|(u, _)| *u != uuid); } @@ -513,9 +510,6 @@ impl Lan { pub fn reserve(&self, uuid: u128) { self.shared.reserved.lock().unwrap().insert(uuid); } - pub fn set_motd(&self, motd: &str) { - *self.shared.motd.lock().unwrap() = motd.to_owned(); - } pub fn stop(&mut self) { self.shared.stop.store(true, Ordering::Relaxed); self.stop_listening(); diff --git a/crates/horizon-client/src/lang.rs b/crates/horizon-client/src/lang.rs index 9f04ef27a..15f47285a 100644 --- a/crates/horizon-client/src/lang.rs +++ b/crates/horizon-client/src/lang.rs @@ -77,12 +77,6 @@ pub fn apply_deprecated(map: &mut HashMap, json: &[u8]) { } impl Language { - pub fn from_map(code: &str, map: HashMap) -> Self { - Self { - code: code.to_owned(), - map, - } - } /// ClientLanguage.loadFrom: en_us first, then the selected language, each /// from every namespace and every source in priority order (later sources /// override). diff --git a/crates/horizon-client/src/light.rs b/crates/horizon-client/src/light.rs index d7ea7d7fd..6cb4b65b1 100644 --- a/crates/horizon-client/src/light.rs +++ b/crates/horizon-client/src/light.rs @@ -203,7 +203,7 @@ impl LightTables { Ok(tables) } /// Assembled tables (tests and benchmarks): derives the packed light cache. - #[allow(dead_code)] + #[cfg(test)] fn from_parts(cells: Vec, occludes: Vec, faces: usize) -> Self { let mut tables = Self { cells, diff --git a/crates/horizon-client/src/mobs/anim.rs b/crates/horizon-client/src/mobs/anim.rs index 1410bf858..aa0d8fb2a 100644 --- a/crates/horizon-client/src/mobs/anim.rs +++ b/crates/horizon-client/src/mobs/anim.rs @@ -239,10 +239,6 @@ pub enum ArmPose { /// Raising a trident to throw it (or to launch with Riptide). ThrowTrident, } -/// HumanoidModel.setupAnim for piglins: `PiglinModel` poses the arms itself. -pub fn humanoid_item(p: &mut Poses, s: &State, _holding: bool) { - humanoid(p, s, &Hum::new(ArmPose::Empty, ArmPose::Empty)); -} /// HumanoidModel.setupAnim with empty hands (endermen). pub fn humanoid_pub(p: &mut Poses, s: &State, _m: &Mob) { humanoid(p, s, &Hum::new(ArmPose::Empty, ArmPose::Empty)); diff --git a/crates/horizon-client/src/mobs/creaking_heart.rs b/crates/horizon-client/src/mobs/creaking_heart.rs index e3c0e4cb7..1172b229c 100644 --- a/crates/horizon-client/src/mobs/creaking_heart.rs +++ b/crates/horizon-client/src/mobs/creaking_heart.rs @@ -152,10 +152,6 @@ pub fn protector(heart: &mut CreakingHeart, host: &impl HeartHost) -> Option bool { - protector(heart, host) == Some(id) -} fn distance_to_creaking(heart: &mut CreakingHeart, pos: [i32; 3], host: &impl HeartHost) -> f64 { protector(heart, host) .and_then(|id| host.mob(id)) diff --git a/crates/horizon-client/src/mobs/goals.rs b/crates/horizon-client/src/mobs/goals.rs index c12f9e7ee..7f73e32c4 100644 --- a/crates/horizon-client/src/mobs/goals.rs +++ b/crates/horizon-client/src/mobs/goals.rs @@ -76,9 +76,6 @@ pub struct GoalSelector { locked: [Option; 4], pub disabled: u8, } -fn flag_index(f: u8) -> usize { - f.trailing_zeros() as usize -} impl GoalSelector { pub fn add(&mut self, priority: i32, goal: impl Goal + 'static) { self.goals.push(Wrapped { @@ -174,10 +171,6 @@ impl GoalSelector { } self.locked = [None; 4]; } - #[allow(dead_code)] - fn locked_by(&self, flag: u8) -> Option { - self.locked[flag_index(flag)] - } } // --- random positions (DefaultRandomPos / LandRandomPos / RandomPos) ------- @@ -565,36 +558,6 @@ impl Mob { m.land_up_out_of_solid(w, p) }) } - /// LandRandomPos.getPosTowards - pub fn land_random_pos_towards( - &mut self, - w: &MobWorld, - h: i32, - v: i32, - to: [f64; 3], - ) -> Option<[f64; 3]> { - let (xd, zd) = (to[0] - self.position.x, to[2] - self.position.z); - self.pick_best(w, |m| { - let d = m.random_direction_within( - 0.0, - f64::from(h), - v, - 0, - xd, - zd, - std::f64::consts::FRAC_PI_2, - )?; - let p = m.toward(f64::from(h), d); - if p[1] < crate::chunk::MIN_Y - || p[1] >= 320 - || m.restricted(f64::from(h), p) - || !m.stable_destination(w, p) - { - return None; - } - m.land_up_out_of_solid(w, p) - }) - } pub fn target_info(&self, w: &MobWorld) -> Option { self.ai.target.and_then(|t| w.target_info(t)) } diff --git a/crates/horizon-client/src/mobs/happy_ghast.rs b/crates/horizon-client/src/mobs/happy_ghast.rs index c0ee860dd..6fc07e898 100644 --- a/crates/horizon-client/src/mobs/happy_ghast.rs +++ b/crates/horizon-client/src/mobs/happy_ghast.rs @@ -17,7 +17,6 @@ use horizon_core::{ // Happy ghast state: `head` the harness, `scratch[0]` 1 once set up as a // baby and 2 as an adult, `ai.home` the restriction, `counter` // the end tick of the follow-an-adult range pick. -pub const BABY_SCALE: f64 = 0.2375; /// `Attributes.FLYING_SPEED` and the speed `travel` uses (`* 5 / 3`). pub const FLYING_SPEED: f64 = 0.05; pub const AIR_SPEED: f32 = 0.05 * 5.0 / 3.0; diff --git a/crates/horizon-client/src/mobs/monster_brain.rs b/crates/horizon-client/src/mobs/monster_brain.rs index eeb2c42f2..1099e0bc3 100644 --- a/crates/horizon-client/src/mobs/monster_brain.rs +++ b/crates/horizon-client/src/mobs/monster_brain.rs @@ -250,10 +250,6 @@ pub fn nearest_players(m: &Mob) -> Vec { .and_then(|b| b.mem.nearest_players.value()) .unwrap_or_default() } -/// The damage the brain remembers (`HURT_BY`). -pub fn hurt_by_present(m: &Mob) -> bool { - brain(m).is_some_and(|b| b.mem.hurt_by.present()) -} /// `HURT_BY`'s damage source entity, if a living one. fn hurt_by_entity(m: &Mob, w: &MobWorld) -> Option { let t = brain(m)?.mem.hurt_by.value()?; diff --git a/crates/horizon-client/src/mobs/nautilus.rs b/crates/horizon-client/src/mobs/nautilus.rs index efeb5cc40..2fcf7eb46 100644 --- a/crates/horizon-client/src/mobs/nautilus.rs +++ b/crates/horizon-client/src/mobs/nautilus.rs @@ -76,14 +76,6 @@ pub fn finalize(m: &mut Mob, warm_ocean: bool) { m.extra.variant = u8::from(warm_ocean); } } -/// `checkNautilusSpawnRules`: 5 to 25 blocks below sea level, water below -/// and above. -pub fn spawn_rules_ok(w: &MobWorld, x: i32, y: i32, z: i32) -> bool { - let sea = 63; - (sea - 25..=sea - 5).contains(&y) - && w.fluid(x, y - 1, z) == Fluid::Water - && w.block_name(x, y + 1, z) == "minecraft:water" -} /// `getControllingPassenger`: a player on a saddled nautilus. pub fn controlled(m: &Mob) -> bool { m.rider.is_some() && m.extra.saddled diff --git a/crates/horizon-client/src/mobs/nav.rs b/crates/horizon-client/src/mobs/nav.rs index 24dafa48d..793303c6d 100644 --- a/crates/horizon-client/src/mobs/nav.rs +++ b/crates/horizon-client/src/mobs/nav.rs @@ -582,26 +582,4 @@ impl Mob { NavKind::Amphibious => !w.facts.is_air(w.world.block(p[0], p[1] - 1, p[2])), } } - pub fn should_recompute_path(&self, p: [i32; 3]) -> bool { - if self.ai.nav.delayed_recompute { - return false; - } - let Some(path) = &self.ai.nav.path else { - return false; - }; - if path.is_done() || path.nodes.is_empty() { - return false; - } - let Some(end) = path.end() else { return false }; - let mid = [ - (f64::from(end.x) + self.position.x) / 2.0, - (f64::from(end.y) + self.position.y) / 2.0, - (f64::from(end.z) + self.position.z) / 2.0, - ]; - let d = (f64::from(p[0]) + 0.5 - mid[0]).powi(2) - + (f64::from(p[1]) + 0.5 - mid[1]).powi(2) - + (f64::from(p[2]) + 0.5 - mid[2]).powi(2); - let r = (path.nodes.len() - path.next) as f64; - d < r * r - } } diff --git a/crates/horizon-client/src/mobs/spawn_selection.rs b/crates/horizon-client/src/mobs/spawn_selection.rs index 046583a1f..4e51722f1 100644 --- a/crates/horizon-client/src/mobs/spawn_selection.rs +++ b/crates/horizon-client/src/mobs/spawn_selection.rs @@ -769,19 +769,6 @@ pub fn weighted_pick(list: &[SpawnEntry], random: &mut impl RandomSource) -> Opt None } -/// `NaturalSpawner.getRandomSpawnMobAt`. -pub fn random_spawn_mob_at( - list: &[SpawnEntry], - category: &str, - reduced_water_ambient: bool, - random: &mut impl RandomSource, -) -> Option { - if category == "water_ambient" && reduced_water_ambient && random.next_float() < 0.98 { - return None; - } - weighted_pick(list, random) -} - /// `SpawnerData.count().sample(random)`: a constant draws nothing. pub fn sample_count(entry: &SpawnEntry, random: &mut impl RandomSource) -> u32 { if entry.constant { diff --git a/crates/horizon-client/src/mobs/spawning.rs b/crates/horizon-client/src/mobs/spawning.rs index 0bfd5d223..93e3fe119 100644 --- a/crates/horizon-client/src/mobs/spawning.rs +++ b/crates/horizon-client/src/mobs/spawning.rs @@ -30,25 +30,6 @@ pub struct BiomeFacts { pub fn placement_ok(species: Species, w: &MobWorld, x: i32, y: i32, z: i32) -> bool { super::spawn_rules::is_spawn_position_ok(species, w, x, y, z) } -/// `SpawnPlacements.checkSpawnRules` for a natural spawn. -pub fn spawn_rules_ok( - species: Species, - w: &MobWorld, - random: &mut impl RandomSource, - x: i32, - y: i32, - z: i32, -) -> bool { - super::spawn_rules::check_spawn_rules( - species, - w, - super::spawn_rules::Reason::Natural, - random, - x, - y, - z, - ) -} /// Mob.finalizeSpawn for natural, chunk-generation and summoned mobs. /// `DifficultyInstance`: the local difficulty at a position. #[derive(Clone, Copy, Debug)] diff --git a/crates/horizon-client/src/mobs/villager_brain.rs b/crates/horizon-client/src/mobs/villager_brain.rs index e02cfa176..194bd75ff 100644 --- a/crates/horizon-client/src/mobs/villager_brain.rs +++ b/crates/horizon-client/src/mobs/villager_brain.rs @@ -10,7 +10,7 @@ //! other `GateBehavior`s shuffle with a random of their own, seeded with //! `Brain::shuffle_seed` when the brain is built. use super::{ - Mob, MobEvent, MobWorld, Seen, Species, Who, + Mob, MobEvent, MobWorld, Species, Who, path::{Path, PathNode}, }; use horizon_core::{ @@ -4156,10 +4156,6 @@ pub fn woken(m: &mut Mob, now: i64) { pub fn potential_job_site(m: &Mob) -> Option<[i32; 3]> { mem_ref(m).and_then(|mm| mm.potential_job_site.value()) } -/// Whether a seen mob is a villager wanting to breed (`AgeableMob::canBreed`). -pub fn seen_can_breed(s: &Seen) -> bool { - s.species == Species::Villager && s.in_love -} /// The memories other villagers read: the interaction target, the path's /// nodes (while it is not done), whether a golem was seen lately and the /// last sleep. diff --git a/crates/horizon-client/src/mobs/world.rs b/crates/horizon-client/src/mobs/world.rs index 79bbaa30c..7836a49ef 100644 --- a/crates/horizon-client/src/mobs/world.rs +++ b/crates/horizon-client/src/mobs/world.rs @@ -1,7 +1,7 @@ //! What mobs read from the level: block solidity, ray clipping for line of //! sight (`ClipContext.Block.COLLIDER`), sky visibility, light-dependent //! values and the positions of other entities. -use super::{MobWorld, Seen, Species, Who, data}; +use super::{MobWorld, Seen, Who, data}; use crate::{ blocks::{BlockFacts, Fluid}, collisions::SceneCollisions, @@ -269,12 +269,6 @@ impl MobWorld<'_> { }); v.into_iter() } - pub fn count_species(&self, species: Species) -> usize { - self.others - .iter() - .filter(|s| s.species == species && s.alive) - .count() - } } /// Level.clip with VISUAL shapes and no fluids: the block the segment first diff --git a/crates/horizon-client/src/packs.rs b/crates/horizon-client/src/packs.rs index 7bd4fd782..5daaaacad 100644 --- a/crates/horizon-client/src/packs.rs +++ b/crates/horizon-client/src/packs.rs @@ -804,11 +804,6 @@ impl SelectionModel { false } } - /// Whether activating the entry asks first (`handlePackSelection`'s - /// ConfirmScreen for an incompatible pack). - pub fn needs_confirmation(&self, selected: bool, i: usize) -> bool { - self.can_select(selected, i) && !self.unselected[i].compatible - } /// `moveUp` / `moveDown` when allowed. pub fn move_by(&mut self, selected: bool, i: usize, up: bool) -> bool { let ok = if up { diff --git a/crates/horizon-client/src/recipe_book.rs b/crates/horizon-client/src/recipe_book.rs index 27051bbc6..fa247a695 100644 --- a/crates/horizon-client/src/recipe_book.rs +++ b/crates/horizon-client/src/recipe_book.rs @@ -384,21 +384,6 @@ impl Book { order, } } - /// Which book a recipe id belongs to. - pub fn book_of(&self, id: &str) -> Option { - let e = self.entries.iter().find(|e| e.id == id)?; - Some(match e.category { - Category::CraftingBuilding - | Category::CraftingRedstone - | Category::CraftingEquipment - | Category::CraftingMisc => BookType::Crafting, - Category::FurnaceFood | Category::FurnaceBlocks | Category::FurnaceMisc => { - BookType::Furnace - } - Category::BlastBlocks | Category::BlastMisc => BookType::BlastFurnace, - Category::SmokerFood => BookType::Smoker, - }) - } /// `RecipeDisplayEntry.canCraft`: the recipe's placement ingredients /// (`craftingRequirements`) can all be found in `stock`. pub fn can_craft(&self, entry: &Entry, stock: &crate::menu::place::Stacked) -> bool { diff --git a/crates/horizon-client/src/save.rs b/crates/horizon-client/src/save.rs index dd86c8f9c..7819a9b0b 100644 --- a/crates/horizon-client/src/save.rs +++ b/crates/horizon-client/src/save.rs @@ -750,12 +750,6 @@ fn heightmaps(chunk: &Chunk, tables: &SaveTables) -> Tag { ) })) } -/// The heightmaps a ClientboundLevelChunkPacketData carries (the types with -/// sendToClient: WORLD_SURFACE, MOTION_BLOCKING, MOTION_BLOCKING_NO_LEAVES), -/// as (network id, packed longs) in Heightmap.Types order. -pub fn client_heightmaps(chunk: &Chunk, tables: &SaveTables) -> Vec<(i32, Vec)> { - client_heightmaps_in(&chunk.sections, tables, MIN_Y, SECTIONS as i32 * 16) -} /// The client heightmaps of a column's sections, in a level from `min_y`, /// `height` blocks high. pub fn client_heightmaps_in( diff --git a/crates/horizon-client/src/sculk.rs b/crates/horizon-client/src/sculk.rs index 58ac921ff..3affbda77 100644 --- a/crates/horizon-client/src/sculk.rs +++ b/crates/horizon-client/src/sculk.rs @@ -78,7 +78,6 @@ pub const RESONANCE: [&str; 15] = [ ]; pub const SHRIEK: &str = "minecraft:shriek"; pub const TENDRILS_CLICKING: &str = "minecraft:sculk_sensor_tendrils_clicking"; -pub const NO_VIBRATION_FREQUENCY: i32 = 0; /// `VibrationSystem.getGameEventFrequency`. pub fn frequency(event: &str) -> i32 { @@ -567,10 +566,6 @@ pub struct WardenSpawnTracker { } impl WardenSpawnTracker { pub const MAX_WARNING_LEVEL: i32 = 4; - /// Blocks around a shrieker within which players are warned. - pub const PLAYER_SEARCH_RADIUS: f64 = 16.0; - /// `AABB.ofSize(centre, 48, 48, 48)` for an existing warden. - pub const WARNING_CHECK_DIAMETER: f64 = 48.0; const DECREASE_EVERY: i32 = 12000; const INCREASE_COOLDOWN: i32 = 200; pub fn tick(&mut self) { diff --git a/crates/horizon-client/src/settings.rs b/crates/horizon-client/src/settings.rs index 1fadacf57..97acc91c9 100644 --- a/crates/horizon-client/src/settings.rs +++ b/crates/horizon-client/src/settings.rs @@ -81,10 +81,6 @@ pub fn sound_source(event: &str) -> usize { index("master") } } -/// Volume multiplier of an event's source (master applied separately). -pub fn event_volume(event: &str) -> f32 { - source_volume(sound_source(event)) -} /// Volume multiplier of a sound source by index. pub fn source_volume(i: usize) -> f32 { if i == 0 { diff --git a/crates/horizon-client/src/tab_list.rs b/crates/horizon-client/src/tab_list.rs index 2c03f999f..0374e3fc2 100644 --- a/crates/horizon-client/src/tab_list.rs +++ b/crates/horizon-client/src/tab_list.rs @@ -317,9 +317,6 @@ impl TabList { self.visible = visible; } } - pub fn is_visible(&self) -> bool { - self.visible - } /// `reset`. pub fn reset(&mut self) { self.header = None; diff --git a/crates/horizon-client/src/text.rs b/crates/horizon-client/src/text.rs index 9f39155d1..11abb3328 100644 --- a/crates/horizon-client/src/text.rs +++ b/crates/horizon-client/src/text.rs @@ -455,9 +455,6 @@ impl Text { } out } - pub fn char_count(&self) -> usize { - self.spans.iter().map(|s| s.text.chars().count()).sum() - } } /// The style fields of a component's JSON. diff --git a/crates/horizon-client/src/title.rs b/crates/horizon-client/src/title.rs index b4958c600..f77ac93eb 100644 --- a/crates/horizon-client/src/title.rs +++ b/crates/horizon-client/src/title.rs @@ -1630,26 +1630,6 @@ fn caret_field<'a>( _ => None, } } -/// `yyyy/MM/dd HH:mm` (UTC) for a modification time in Unix seconds. -pub fn date_label(secs: u64) -> String { - date_string(secs) -} -fn date_string(secs: u64) -> String { - // Civil date from Unix time (days-from-civil inverse), UTC. - let days = (secs / 86400) as i64; - let (h, m) = ((secs % 86400) / 3600, (secs % 3600) / 60); - let z = days + 719_468; - let era = z.div_euclid(146_097); - let doe = z - era * 146_097; - let yoe = (doe - doe / 1460 + doe / 36524 - doe / 146_096) / 365; - let y = yoe + era * 400; - let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); - let mp = (5 * doy + 2) / 153; - let d = doy - (153 * mp + 2) / 5 + 1; - let mo = if mp < 10 { mp + 3 } else { mp - 9 }; - let y = if mo <= 2 { y + 1 } else { y }; - format!("{y}-{mo:02}-{d:02} {h:02}:{m:02}") -} #[cfg(test)] mod classic_tests { diff --git a/crates/horizon-client/src/ui.rs b/crates/horizon-client/src/ui.rs index b1ffab866..63a6d1de7 100644 --- a/crates/horizon-client/src/ui.rs +++ b/crates/horizon-client/src/ui.rs @@ -793,10 +793,6 @@ impl EditBox { text_color: rgba(224, 224, 224, 255), } } - /// When the field gained focus, for the cursor's blink. - pub fn focused_since(&mut self, at: Instant) { - self.focused_at = at; - } pub fn inner_width(&self) -> f32 { if self.bordered { self.width - 8.0 diff --git a/crates/horizon-client/src/worldborder.rs b/crates/horizon-client/src/worldborder.rs index 3ed4ea152..3673db403 100644 --- a/crates/horizon-client/src/worldborder.rs +++ b/crates/horizon-client/src/worldborder.rs @@ -7,7 +7,6 @@ pub use horizon_core::geometry::border::BorderStatus; /// `WorldBorder.MAX_SIZE` (the float 5.999997E7 as a double). pub const MAX_SIZE: f64 = 59_999_968.0; -pub const MAX_CENTER: f64 = 2.999_998_4e7; /// `BorderStatus.getColor`: the wall colour. pub fn status_color(status: BorderStatus) -> u32 { diff --git a/crates/horizon-core/src/density/beardifier.rs b/crates/horizon-core/src/density/beardifier.rs index 5dec64189..b041be160 100644 --- a/crates/horizon-core/src/density/beardifier.rs +++ b/crates/horizon-core/src/density/beardifier.rs @@ -168,9 +168,6 @@ impl Beardifier { self.kernel_junctions = junctions; self } - pub fn affected_bounds(&self) -> Option { - self.affected - } fn sample_unchecked(&self, [x, y, z]: [i32; 3]) -> f32 { let mut value = 0.; // The kernel is a process-wide constant; resolving it once keeps the diff --git a/crates/horizon-core/src/geometry/shape/join.rs b/crates/horizon-core/src/geometry/shape/join.rs index 57c981e65..261c33802 100644 --- a/crates/horizon-core/src/geometry/shape/join.rs +++ b/crates/horizon-core/src/geometry/shape/join.rs @@ -13,8 +13,6 @@ impl ShapeOp { pub const XOR: Self = Self(6); pub const ONLY_FIRST: Self = Self(4); pub const ONLY_SECOND: Self = Self(2); - pub const FIRST: Self = Self(12); - pub const SECOND: Self = Self(10); pub const fn from_truth_table(bits: u8) -> Self { Self(bits & 15) } diff --git a/crates/horizon-core/src/paletted.rs b/crates/horizon-core/src/paletted.rs index d9ade23f2..802eac225 100644 --- a/crates/horizon-core/src/paletted.rs +++ b/crates/horizon-core/src/paletted.rs @@ -466,34 +466,6 @@ impl PalettedContainer { } } } - /// Block ids as 16-bit values (callers whose registry fits in 16 bits). - pub fn unpack_u16(&self, out: &mut [u16; 4096]) { - debug_assert_eq!(self.strategy.entries(), 4096); - match &self.palette { - Palette::Single(value) => out.fill(*value as u16), - Palette::List(list) => { - let bits = usize::from(self.bits); - let per = 64 / bits; - let m = mask(self.bits); - for (chunk, &word) in out.chunks_mut(per).zip(&self.words) { - for (slot, cell) in chunk.iter_mut().enumerate() { - let id = ((word >> (slot * bits)) & m) as usize; - *cell = list[id] as u16; - } - } - } - Palette::Global => { - let bits = usize::from(self.bits); - let per = 64 / bits; - let m = mask(self.bits); - for (chunk, &word) in out.chunks_mut(per).zip(&self.words) { - for (slot, cell) in chunk.iter_mut().enumerate() { - *cell = ((word >> (slot * bits)) & m) as u16; - } - } - } - } - } /// A container holding `values` in the smallest configuration for their /// distinct count, with palette ids in first-occurrence order, like a /// container unpacked from disk. diff --git a/crates/horizon-core/src/ticks/generation.rs b/crates/horizon-core/src/ticks/generation.rs index 4e1fdce6f..f81d9353e 100644 --- a/crates/horizon-core/src/ticks/generation.rs +++ b/crates/horizon-core/src/ticks/generation.rs @@ -91,9 +91,6 @@ impl WorldGenTickAccess { pub fn containers_mut(&mut self) -> &mut C { &mut self.containers } - pub fn into_containers(self) -> C { - self.containers - } pub fn schedule(&mut self, tick: ScheduledTick) -> Result { Ok(self.containers.container_at(tick.pos)?.schedule(tick)) } diff --git a/crates/horizon-core/src/ticks/mod.rs b/crates/horizon-core/src/ticks/mod.rs index f3cc83999..693aab130 100644 --- a/crates/horizon-core/src/ticks/mod.rs +++ b/crates/horizon-core/src/ticks/mod.rs @@ -636,7 +636,4 @@ impl LevelTicks { pub fn copy_area(&mut self, area: TickArea, offset: BlockPos) { self.schedule_copy(self.area_ticks(area), offset); } - pub fn copy_area_from(&mut self, source: &Self, area: TickArea, offset: BlockPos) { - self.schedule_copy(source.area_ticks(area), offset); - } } diff --git a/crates/horizon-core/src/version.rs b/crates/horizon-core/src/version.rs index 29994823c..cb3e85629 100644 --- a/crates/horizon-core/src/version.rs +++ b/crates/horizon-core/src/version.rs @@ -11,10 +11,6 @@ pub const PROTOCOL_VERSION: i32 = 777; pub const DATA_VERSION: i32 = 5023; /// `WorldVersion.packVersion(PackType.CLIENT_RESOURCES)`: (major, minor). pub const RESOURCE_PACK_FORMAT: (i64, i64) = (97, 1); -/// `WorldVersion.packVersion(PackType.SERVER_DATA)`: (major, minor). -pub const DATA_PACK_FORMAT: (i64, i64) = (121, 0); -/// The Java major version the game runs on. -pub const JAVA_VERSION: u32 = 25; /// `WorldVersion.stable()`: false for snapshots and pre-releases. pub const STABLE: bool = true; /// `WorldVersion.buildTime()` as `Date.toString()` prints it in UTC (`/version`). diff --git a/crates/horizon-friends/src/guest.rs b/crates/horizon-friends/src/guest.rs index 4f64bb1cc..492f4d482 100644 --- a/crates/horizon-friends/src/guest.rs +++ b/crates/horizon-friends/src/guest.rs @@ -296,14 +296,4 @@ impl Tunnel { })?; Ok((port, thread)) } - /// The protected stream itself (tests, or a client that reads it - /// directly). - pub fn into_stream( - self, - ) -> ( - crypto::SecureReader, - crypto::SecureWriter, - ) { - self.secure - } } diff --git a/crates/horizon-server-files/src/user_cache.rs b/crates/horizon-server-files/src/user_cache.rs index c8ccd6cf0..38e779488 100644 --- a/crates/horizon-server-files/src/user_cache.rs +++ b/crates/horizon-server-files/src/user_cache.rs @@ -190,14 +190,6 @@ impl UserCache { result } - /// `get(UUID)`: a cached player by id (expired or not). - pub fn get_by_id(&mut self, id: u128) -> Option { - let index = *self.by_uuid.get(&id)?; - self.operations += 1; - self.infos[index].last_access = self.operations; - Some(self.infos[index].user.clone()) - } - /// The file's text: the 1000 most recently used entries, most recent /// first, as Gson writes them (compact, HTML-safe). pub fn to_json(&self) -> String { diff --git a/crates/horizon-server-files/src/user_lists.rs b/crates/horizon-server-files/src/user_lists.rs index 77de64e31..5bef4f38f 100644 --- a/crates/horizon-server-files/src/user_lists.rs +++ b/crates/horizon-server-files/src/user_lists.rs @@ -416,11 +416,6 @@ pub type WhiteList = UserList; pub type BanList = UserList>; pub type IpBanList = UserList>; -/// IpBanList.getIpFromAddress. -pub fn ip_of(address: &std::net::SocketAddr) -> String { - address.ip().to_string() -} - #[cfg(test)] mod tests { use super::*; diff --git a/crates/horizon-world/src/block_entities.rs b/crates/horizon-world/src/block_entities.rs index 22a2bc959..1ee8a90e0 100644 --- a/crates/horizon-world/src/block_entities.rs +++ b/crates/horizon-world/src/block_entities.rs @@ -62,9 +62,6 @@ impl ProtoBlockEntities { pub fn active(&self, position: BlockPos) -> Option<&E> { self.active.get(&position) } - pub fn active_mut(&mut self, position: BlockPos) -> Option<&mut E> { - self.active.get_mut(&position) - } pub fn pending(&self, position: BlockPos) -> Option<&Tag> { self.pending.get(&position) } diff --git a/crates/horizon-world/src/block_render.rs b/crates/horizon-world/src/block_render.rs index 1ed9c51af..aa10d361c 100644 --- a/crates/horizon-world/src/block_render.rs +++ b/crates/horizon-world/src/block_render.rs @@ -157,12 +157,6 @@ impl FaceVisibility { } } } - /// Whether the state's occlusion face toward `direction` is the full square. - pub fn full_face(&self, state: BlockStateId, direction: Direction) -> bool { - self.states - .get(state.0 as usize) - .is_some_and(|s| s.faces[direction as usize] == 1) - } /// The state's occlusion face toward `direction` (`getFaceOcclusionShape`) and /// its shared ID: 0 is the empty singleton, 1 the full-block singleton. pub fn occlusion_face( @@ -173,12 +167,6 @@ impl FaceVisibility { let id = self.states.get(state.0 as usize)?.faces[direction as usize]; Some((id, &self.faces[id as usize])) } - /// Whether the state's occlusion face toward `direction` is empty. - pub fn empty_face(&self, state: BlockStateId, direction: Direction) -> bool { - self.states - .get(state.0 as usize) - .is_none_or(|s| s.faces[direction as usize] == 0) - } pub fn skip_rendering( &self, state: BlockStateId, diff --git a/crates/horizon-world/src/block_support.rs b/crates/horizon-world/src/block_support.rs index 295999d18..d3ac386cd 100644 --- a/crates/horizon-world/src/block_support.rs +++ b/crates/horizon-world/src/block_support.rs @@ -186,25 +186,6 @@ impl<'r> BlockSupportRegistry<'r> { pub fn registry(&self) -> &'r BlockRegistry { self.cached.registry() } - pub fn support_shape( - &self, - world: &mut W, - state: BlockStateId, - position: [i32; 3], - ) -> Result> { - if let Some(shape) = self - .cached - .cached_shape(state) - .map_err(SupportQueryError::Data)? - { - return Ok(shape.clone()); - } - self.dynamic - .get(&state) - .ok_or(SupportQueryError::Unsupported(state))? - .shape(world, position) - .map_err(SupportQueryError::Dynamic) - } pub fn is_face_sturdy( &self, world: &mut W, diff --git a/crates/horizon-world/src/block_survival.rs b/crates/horizon-world/src/block_survival.rs index bb21f46df..ae53451ba 100644 --- a/crates/horizon-world/src/block_survival.rs +++ b/crates/horizon-world/src/block_survival.rs @@ -524,14 +524,6 @@ impl<'r> BlockSurvivalRegistry<'r> { bubble_down: tag_states("minecraft:enables_bubble_column_drag_down")?, }) } - pub fn supported_states(&self) -> usize { - self.rules.iter().filter(|r| r.is_some()).count() - } - pub fn supports_state(&self, state: BlockStateId) -> bool { - self.rules - .get(state.0 as usize) - .is_some_and(Option::is_some) - } fn read( &self, world: &mut W, diff --git a/crates/horizon-world/src/component_durability.rs b/crates/horizon-world/src/component_durability.rs index 15237133b..5bf576c08 100644 --- a/crates/horizon-world/src/component_durability.rs +++ b/crates/horizon-world/src/component_durability.rs @@ -3,7 +3,6 @@ use crate::{ component_patch::{ComponentMap, MissingPrototype, Patch, Prototype}, item_durability::DurabilityStorage, - item_use_catalog::UseComponents, }; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Key { @@ -52,13 +51,6 @@ impl DurabilityPrototype { } Self(Prototype::new(entries)) } - pub fn from_defaults(defaults: &UseComponents) -> Self { - Self::new([ - Change::MaxDamage(defaults.max_damage), - Change::Damage(defaults.damage), - Change::Unbreakable(defaults.unbreakable), - ]) - } } #[derive(Clone, Debug)] pub struct DurabilityPatch(Patch); diff --git a/crates/horizon-world/src/datafix/dynamic.rs b/crates/horizon-world/src/datafix/dynamic.rs index 44336729c..69cca1453 100644 --- a/crates/horizon-world/src/datafix/dynamic.rs +++ b/crates/horizon-world/src/datafix/dynamic.rs @@ -157,12 +157,6 @@ pub fn map(tag: &Tag) -> Option<&Compound> { _ => None, } } -pub fn map_mut(tag: &mut Tag) -> Option<&mut Compound> { - match tag { - Tag::Compound(c) => Some(c), - _ => None, - } -} /// `Dynamic.set`: only maps change. pub fn set(tag: &mut Tag, field: &str, value: Tag) { if let Tag::End = tag { @@ -193,12 +187,6 @@ pub fn update(tag: &mut Tag, field: &str, f: impl FnOnce(Tag) -> Tag) { set(tag, field, f(v)); } } -/// `Dynamic.update` in place. -pub fn update_mut(tag: &mut Tag, field: &str, f: impl FnOnce(&mut Tag)) { - if let Some(v) = tag.get_mut(field) { - f(v); - } -} /// `Dynamic.renameAndFixField`: the fixed value under the new name, removed when /// the fix gives nothing. pub fn rename_and_fix(tag: &mut Tag, from: &str, to: &str, f: impl FnOnce(Tag) -> Option) { @@ -223,15 +211,6 @@ pub fn is_empty_map(tag: &Tag) -> bool { pub fn or_empty_map(tag: Option<&Tag>) -> Tag { tag.cloned().unwrap_or_else(empty_map) } -/// Apply `f` to every element of a list field (`Dynamic.createList(asStream().map(f))`). -pub fn map_list(tag: &mut Tag, field: &str, mut f: impl FnMut(Tag) -> Tag) { - if let Some(v) = tag.get(field) - && is_list(Some(v)) - { - let list = stream(Some(v)).into_iter().map(&mut f).collect(); - set(tag, field, Tag::List(list)); - } -} /// `NamespacedSchema.ensureNamespaced`. pub fn namespaced(id: &str) -> String { match crate::datafix::identifier(id) { diff --git a/crates/horizon-world/src/entity_move.rs b/crates/horizon-world/src/entity_move.rs index b3b189df0..25d7aef14 100644 --- a/crates/horizon-world/src/entity_move.rs +++ b/crates/horizon-world/src/entity_move.rs @@ -44,9 +44,6 @@ impl MovementHistory { } self.records.push_back(record); } - pub fn remove_latest(&mut self) { - self.records.pop_back(); - } pub fn clear(&mut self) { self.records.clear(); } diff --git a/crates/horizon-world/src/entity_obstruction.rs b/crates/horizon-world/src/entity_obstruction.rs index 89f7f586b..aac2306b6 100644 --- a/crates/horizon-world/src/entity_obstruction.rs +++ b/crates/horizon-world/src/entity_obstruction.rs @@ -73,17 +73,3 @@ pub fn is_unobstructed( } Ok(true) } - -/// Entity obstruction for the unit cube used by the vanilla block predicate. -/// Translate the voxel shape in floating point: integer MAX + 1 must not wrap. -pub fn is_block_unobstructed( - world: &mut W, - position: [i32; 3], -) -> Result> { - let shape = VoxelShape::block().moved(horizon_core::geometry::Vec3::new( - f64::from(position[0]), - f64::from(position[1]), - f64::from(position[2]), - )); - is_unobstructed(world, None, &shape) -} diff --git a/crates/horizon-world/src/fluid.rs b/crates/horizon-world/src/fluid.rs index 4a89764a8..ab03d6a52 100644 --- a/crates/horizon-world/src/fluid.rs +++ b/crates/horizon-world/src/fluid.rs @@ -272,13 +272,6 @@ impl FluidStateTable { pub fn get(&self, state: BlockStateId) -> Option { self.0.get(state.0 as usize).copied() } - pub fn matching_states(&self, mask: u8) -> impl Iterator + '_ { - self.0 - .iter() - .enumerate() - .filter(move |(_, state)| state.kind.mask() & mask != 0) - .map(|(i, _)| BlockStateId(i as u32)) - } } /// Bound identities for converting fluid states into their legacy liquid blocks. diff --git a/crates/horizon-world/src/level/bonemeal.rs b/crates/horizon-world/src/level/bonemeal.rs index 274512138..ef52ca625 100644 --- a/crates/horizon-world/src/level/bonemeal.rs +++ b/crates/horizon-world/src/level/bonemeal.rs @@ -160,16 +160,6 @@ impl Behaviours { ) -> bool { self.sim(level, ticks).grow_water_plant(pos, face) } - /// The `BonemealableBlock.Type` particle spread of a block at level event - /// 1505: Some(true) for `NEIGHBOR_SPREADER` (particles over a 3-block - /// area above), Some(false) for `GROWER`, None when not bonemealable. - pub fn bone_meal_spreads(&self, state: BlockStateId) -> Option { - let kind = self.bonemeal_kind(state)?; - Some(matches!( - kind, - Kind::Grass | Kind::Nylium | Kind::Netherrack | Kind::FeaturePlacer - )) - } fn bonemeal_kind(&self, state: BlockStateId) -> Option { let data = self.data(state); if !data.implements(Interface::Bonemealable) { diff --git a/crates/horizon-world/src/level/classes.rs b/crates/horizon-world/src/level/classes.rs index 9540a5a47..2d0193de5 100644 --- a/crates/horizon-world/src/level/classes.rs +++ b/crates/horizon-world/src/level/classes.rs @@ -15,9 +15,6 @@ macro_rules! classes { pub fn from_java(name: &str) -> Option { match name { $($java => Some(Class::$name),)* _ => None } } - pub const fn java_name(self) -> &'static str { - match self { $(Class::$name => $java,)* } - } } }; } diff --git a/crates/horizon-world/src/level/mod.rs b/crates/horizon-world/src/level/mod.rs index e343e06a7..696777386 100644 --- a/crates/horizon-world/src/level/mod.rs +++ b/crates/horizon-world/src/level/mod.rs @@ -148,7 +148,6 @@ pub mod flags { pub const UPDATE_NEIGHBORS: i32 = 1; pub const UPDATE_CLIENTS: i32 = 2; pub const UPDATE_INVISIBLE: i32 = 4; - pub const UPDATE_IMMEDIATE: i32 = 8; pub const UPDATE_KNOWN_SHAPE: i32 = 16; pub const UPDATE_SUPPRESS_DROPS: i32 = 32; pub const UPDATE_MOVE_BY_PISTON: i32 = 64; diff --git a/crates/horizon-world/src/level/states.rs b/crates/horizon-world/src/level/states.rs index c7fe012dc..8d2544953 100644 --- a/crates/horizon-world/src/level/states.rs +++ b/crates/horizon-world/src/level/states.rs @@ -348,10 +348,4 @@ impl StateTable { } result } - pub fn property_names(&self, block: BlockId) -> impl Iterator { - self.info(block) - .slots - .iter() - .map(|slot| self.key_names[slot.key.0 as usize].as_str()) - } } diff --git a/crates/horizon-world/src/level/ticks.rs b/crates/horizon-world/src/level/ticks.rs index fbad6c28d..c8d715623 100644 --- a/crates/horizon-world/src/level/ticks.rs +++ b/crates/horizon-world/src/level/ticks.rs @@ -149,9 +149,6 @@ impl Ticks { self.blocks .has_scheduled(pos, TickTypeId(u32::from(block.0))) } - pub fn has_fluid_tick(&self, pos: BlockPos, fluid: FluidKind) -> bool { - self.fluids.has_scheduled(pos, TickTypeId(fluid as u32)) - } pub fn will_block_tick_this_tick(&mut self, pos: BlockPos, block: BlockId) -> bool { self.blocks .will_tick_this_tick(pos, TickTypeId(u32::from(block.0))) diff --git a/crates/horizon-world/src/registry_fluid.rs b/crates/horizon-world/src/registry_fluid.rs index eb0f4ffe0..a122a8978 100644 --- a/crates/horizon-world/src/registry_fluid.rs +++ b/crates/horizon-world/src/registry_fluid.rs @@ -62,9 +62,6 @@ impl<'r> FluidRegistry<'r> { pub fn blocks_flow(&self, id: BlockStateId) -> io::Result { Ok(self.state(id)?.blocks_flow) } - pub fn is_ice(&self, id: BlockStateId) -> io::Result { - Ok(self.state(id)?.ice) - } } /// Both queries return state IDs from the same registry. Separate entry points /// preserve native world dispatch when reading a block versus its fluid cell. diff --git a/crates/horizon-world/src/retrogen.rs b/crates/horizon-world/src/retrogen.rs index fc9f450bf..2f048f48e 100644 --- a/crates/horizon-world/src/retrogen.rs +++ b/crates/horizon-world/src/retrogen.rs @@ -33,9 +33,6 @@ impl BelowZeroRetrogen { .get(index / 64) .is_some_and(|word| word & (1_u64 << (index % 64)) != 0) } - pub fn missing_bedrock_words(&self) -> &[u64] { - &self.missing_bedrock - } pub fn from_nbt(tag: &Tag) -> io::Result { if !matches!(tag, Tag::Compound(_)) { return Err(invalid("retrogen is not a compound")); diff --git a/crates/horizon-world/src/worldgen/aquifer.rs b/crates/horizon-world/src/worldgen/aquifer.rs index 2b4f6e7c3..44500313b 100644 --- a/crates/horizon-world/src/worldgen/aquifer.rs +++ b/crates/horizon-world/src/worldgen/aquifer.rs @@ -50,11 +50,6 @@ impl GlobalFluidPicker { disabled: false, } } - /// Matches the vanilla developer flag. Regular gameplay keeps this false. - pub const fn with_disabled(mut self, disabled: bool) -> Self { - self.disabled = disabled; - self - } } impl FluidPicker for GlobalFluidPicker { fn compute(&self, [_, y, _]: [i32; 3]) -> FluidStatus { diff --git a/crates/horizon-world/src/worldgen/feature_region.rs b/crates/horizon-world/src/worldgen/feature_region.rs index b4e8c07b0..e1d80e8bc 100644 --- a/crates/horizon-world/src/worldgen/feature_region.rs +++ b/crates/horizon-world/src/worldgen/feature_region.rs @@ -212,9 +212,6 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { pub fn tick_clock(&self) -> (i64, i64) { (self.game_time, self.next_tick_order) } - pub fn set_game_time(&mut self, game_time: i64) { - self.game_time = game_time; - } /// Raw tick identities are default block-state IDs for block ticks and /// `FluidKind` discriminants for fluid ticks, in separate namespaces. pub fn schedule_tick( @@ -224,15 +221,6 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { ) -> Result { WorldGenTickAccess::new(RegionTickContainers { region: self, kind }).schedule(tick) } - pub fn has_scheduled_tick( - &mut self, - kind: TickKind, - position: BlockPos, - tick_type: TickTypeId, - ) -> Result { - WorldGenTickAccess::new(RegionTickContainers { region: self, kind }) - .has_scheduled(position, tick_type) - } fn request_tick( &mut self, kind: TickKind, @@ -251,11 +239,6 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { self.schedule_tick(kind, tick)?; Ok(()) } - /// Override world sea level without changing generator placement anchors. - pub fn with_world_sea_level(mut self, sea_level: i32) -> Self { - self.sea_level = sea_level; - self - } /// Release the resident chunks, ordered by X then Z; match them by position. pub fn into_chunks(self) -> Vec> { self.chunks diff --git a/crates/horizon-world/src/worldgen/material_condition/codec.rs b/crates/horizon-world/src/worldgen/material_condition/codec.rs index ec646697e..aa159bd1e 100644 --- a/crates/horizon-world/src/worldgen/material_condition/codec.rs +++ b/crates/horizon-world/src/worldgen/material_condition/codec.rs @@ -65,12 +65,6 @@ impl MaterialConditionRegistry { pub fn from_json(definitions: &BTreeMap) -> Result { Self::load(definitions, None) } - pub fn from_json_with_biomes( - definitions: &BTreeMap, - biomes: &BTreeSet, - ) -> Result { - Self::from_json_with_biome_tags(definitions, biomes, &BTreeMap::new()) - } /// Bind resolved biome tags, such as `TagDefinitions::build().tags`. /// Names and memberships remain immutable for the lifetime of this registry. pub fn from_json_with_biome_tags( diff --git a/crates/horizon-world/src/worldgen/state_provider.rs b/crates/horizon-world/src/worldgen/state_provider.rs index 098decdf1..da39cd246 100644 --- a/crates/horizon-world/src/worldgen/state_provider.rs +++ b/crates/horizon-world/src/worldgen/state_provider.rs @@ -344,12 +344,6 @@ impl BlockStateProvider { _ => Err(DecodeError::Field("exclusive state or provider")), } } - pub fn from_typed_json( - json: &str, - bindings: &StateProviderBindings<'_>, - ) -> Result { - Self::decode_typed(json, bindings, 0, &mut 65536, None) - } fn decode_typed( json: &str, bindings: &StateProviderBindings<'_>, diff --git a/crates/horizon-world/src/worldgen/terrain.rs b/crates/horizon-world/src/worldgen/terrain.rs index 8ea3b01be..5ecc48045 100644 --- a/crates/horizon-world/src/worldgen/terrain.rs +++ b/crates/horizon-world/src/worldgen/terrain.rs @@ -432,18 +432,6 @@ impl<'r, B: TerrainBlockStates> TerrainChunk<'r, B> { )?; Ok(()) } - pub fn set_heightmap_raw( - &mut self, - kind: HeightmapType, - words: &[u64], - ) -> Result<(), TerrainError> { - self.ensure_heightmap(kind); - self.heightmaps[kind as usize] - .as_mut() - .unwrap() - .set_raw_data(&self.blocks, words)?; - Ok(()) - } /// Before replaying a saved chunk's `PostProcessing` lists. pub fn clear_postprocessing(&mut self) { self.postprocessing.iter_mut().for_each(Vec::clear);