Skip to content

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

Merge branch 'optifine/cit-items' into optifine/cit-armor

some-du6e74664db43638
diff --cc crates/horizon-client/src/client_lib.rs
index 000000000,d46cc4bb4..3ab677fef
mode 000000,100644..100644
--- a/crates/horizon-client/src/client_lib.rs
+++ b/crates/horizon-client/src/client_lib.rs
@@@ -1,0 -1,164 +1,164 @@@
+ //! Horizon native client: resources, world streaming, rendering and the
+ //! bindings between the validated simulation pieces and the game loop.
+ #![forbid(unsafe_code)]
+ extern crate self as horizon_client;
+ pub mod advancements;
+ pub mod ambience;
+ pub mod animate_tick;
+ pub mod arrows;
+ pub mod block_contact;
+ pub use horizon_client_render::{
+ assets, atlas_sources, audio, auth, ban_notice, bidi, biome, block_edit, block_entities,
+ block_entity_anim, block_entity_render, border_render, breaking, brewing, camera, chat, chunk,
- chunk_map, cit, cit_assets, clouds, collisions, command_block, containers, crash, datapack,
++ chunk_map, cit, cit_armor, cit_assets, clouds, collisions, command_block, containers, crash, datapack,
+ dynamic_light, effects, environment, extras, fast_hash, fog, font, gfx, graphics,
+ graphics_style, graphics_ui, hdr_calibration, hud, hud_layout, hud_overlays, inventory_effects,
+ java_text, jigsaw_block, level_loading, light, lod, logging, menu_blur, mesher, minimap,
+ mipmap, mod_list, model_library, models, multiline_edit, native_emissive, options_file,
+ options_fixes, options_ui, overlay, pack_screen, packs, par, particles, poi_sections,
+ post_chain, potent_sulfur, preedit, providers, screen_draw, screen_effects, sculk,
+ section_mask, settings, shader_options, shader_pack_list, signs, skins, sound_engine,
+ sound_events, sound_preview, spans, split_layout, split_profiles, sprites, streaming,
+ structure_block, tab_list, telemetry, test_block, test_instance_block, testgen, title_edition,
+ trims, ui, vault, weather, widgets, world, worldborder, zip,
+ };
+ pub mod attack_strength;
+ pub mod attribute_updates;
+ pub mod auto_jump;
+ pub mod banner;
+ pub mod beehive;
+ pub mod benchmark;
+ pub mod block_entity_item;
+ pub mod block_pattern;
+ pub mod block_transform;
+ pub mod boss_overlay;
+ pub mod breathing;
+ pub mod cauldron;
+ pub mod chunk_io;
+ pub mod clock;
+ pub mod command_storage;
+ pub mod confirm_screen;
+ pub mod container_screen;
+ pub mod content_identity;
+ pub mod control;
+ pub mod crafting;
+ pub mod creative;
+ pub mod cushion;
+ pub mod data_cmd;
+ pub mod debug_chart;
+ pub mod debug_entries;
+ pub mod debug_keys;
+ pub mod debug_overlay;
+ pub mod debugworld;
+ pub mod dialog;
+ pub mod dialog_screen;
+ pub mod discord_presence;
+ pub mod end_crystal;
+ pub mod end_gateway;
+ pub mod entities;
+ pub mod entity_culling;
+ pub mod entity_nbt;
+ pub mod extras_hud;
+ pub mod falling_block;
+ pub mod fire_render;
+ pub mod first_person;
+ pub mod flatgen;
+ pub mod friends_screen;
+ pub mod furnace;
+ pub mod game_mode_switcher;
+ pub mod game_rules_screen;
+ pub mod gizmos;
+ pub mod gossip;
+ pub mod health;
+ pub mod heartbeat;
+ pub mod hotbar;
+ pub mod hunger;
+ pub mod inv_sort;
+ pub mod item_activation;
+ pub mod item_render;
+ pub mod item_sync;
+ pub mod item_tooltip;
+ pub mod lan;
+ pub mod landing;
+ pub mod locator_bar;
+ pub mod lod_net;
+ pub mod menu;
+ pub mod merchant;
+ pub mod mobs;
+ pub mod mod_content;
+ pub mod motion;
+ pub mod multiplayer;
+ pub mod music;
+ pub mod native_data;
+ pub mod net;
+ pub mod nether_portal;
+ pub mod no_resources;
+ pub mod offline_name;
+ pub mod old_world;
+ pub mod osk;
+ pub mod patrol;
+ pub mod perf_overlay;
+ pub mod pick_item;
+ pub mod player_sync;
+ pub mod portal_sections;
+ pub mod pose;
+ pub mod pregen;
+ pub mod projectiles;
+ pub mod raid;
+ pub mod ram_limit;
+ pub mod random_tick_sections;
+ pub mod recipe_book;
+ pub mod recipe_book_screen;
+ pub mod reconnect;
+ pub mod save;
+ pub mod scoreboard_cmd;
+ pub mod screen_layout;
+ pub mod screen_narrator;
+ pub mod social_screen;
+ pub use horizon_server_files as server;
+ pub mod server_packs;
+ pub mod shadows;
+ pub mod spear;
+ pub mod spectator_menu;
+ pub mod sprint;
+ pub mod stations;
+ pub mod stopwatches;
+ pub mod structure_blocks;
+ pub mod text_display;
+ pub mod tick_chunk_membership;
+ pub mod ticket_levels;
+ pub mod title;
+ pub mod toasts;
+ pub mod ui_theme;
+ pub mod vanillagen;
+ pub mod win_screen;
+ pub mod world_spawn;
+ pub use horizon_client_core::Result;
+ pub use horizon_client_core::block_entity_nbt;
+ pub use horizon_client_core::bossbar;
+ pub use horizon_client_core::component;
+ pub use horizon_client_core::fastutil_order;
+ pub use horizon_client_core::gamerules;
+ pub use horizon_client_core::lang;
+ pub use horizon_client_core::nbt_path;
+ pub use horizon_client_core::scoreboard;
+ pub use horizon_client_core::snbt;
+ pub use horizon_client_core::text;
+ pub use horizon_client_input::clipboard;
+ pub use horizon_client_input::gamepad;
+ pub use horizon_client_input::input;
+ pub use horizon_client_input::interaction_input;
+ pub use horizon_client_input::key_names;
+ pub use horizon_client_input::keybinds;
+ pub use horizon_client_input::keymapping;
+ pub use horizon_client_input::mouse;
+ pub use horizon_client_input::window;
+ pub use horizon_command as command;
+ pub use horizon_items::blocks;
+ pub use horizon_items::bundle;
+ pub use horizon_items::cooldowns;
+ pub use horizon_items::enchant;
+ pub use horizon_items::flowers;
+ pub use horizon_items::item_data;
+ pub use horizon_items::items;
+ pub use horizon_items::random_sequences;
diff --cc crates/horizon-client/src/game/armor_stands.rs
index 59ac93318,12654be7d..0d6ad46c2
--- a/crates/horizon-client/src/game/armor_stands.rs
+++ b/crates/horizon-client/src/game/armor_stands.rs
@@@ -156,30 -154,9 +156,30 @@@ impl ArmorStandAssets
}
}
impl Game<'_> {
+ /// OptiFine CIT: the winning armour or elytra rule (`kind`) of the worn `stack`. No lookup
+ /// without CIT rules.
+ pub(super) fn cit_worn_rule(&self, kind: Kind, stack: &ItemStack) -> Option<&Rule> {
+ let rules = &self.pack.item_renderer.cit.as_ref()?.rules;
+ let item_max = self.items().get(&stack.item).map_or(0, |i| i.max_damage);
+ horizon_client::item_render::cit::worn_rule(rules, kind, stack, item_max)
+ .and_then(|i| rules.rules.get(i))
+ }
+ /// The atlas rect of an armour layer `texture` of equipment asset `asset`, or of the one CIT
+ /// armour rule `cit` puts there when the atlas has it.
+ fn armor_layer_rect(
+ &self,
+ cit: Option<&Rule>,
+ asset: &str,
+ kind: &str,
+ texture: &str,
+ ) -> Option<[f32; 4]> {
+ let sprites = &self.gui.atlas.sprites;
+ let r = cit_armor::worn_layer(cit, asset, kind, texture, |s| sprites.get(s))?;
+ Some([r.u0, r.v0, r.u1, r.v1])
+ }
/// `HumanoidArmorLayer` for the player: (model, texture rect, colour,
/// overlay) of each worn piece, head to feet.
- pub(super) fn player_armor_layers(&self) -> Vec<(&Part, [f32; 4], u32, u32)> {
+ pub(super) fn player_armor_layers(&self) -> Vec<(&Part, [f32; 4], u32, u32, bool)> {
self.stack_armor_layers(&self.armor)
}
/// `HumanoidArmorLayer` for worn stacks (head to feet), trims included.
@@@ -263,7 -245,20 +269,14 @@@
continue;
};
let color = layer_color(*undyed, stack);
- out.push((part, uv, color, if i == 0 { overlay } else { 0 }));
- out.push((
- part,
- [r.u0, r.v0, r.u1, r.v1],
- color,
- if i == 0 { overlay } else { 0 },
- false,
- ));
++ out.push((part, uv, color, if i == 0 { overlay } else { 0 }, false));
+ // The layer's OptiFine emissive overlay, full bright without the glint.
+ if let Some(g) = emissive
+ .overlay(texture)
+ .and_then(|e| self.gui.atlas.sprites.get(e))
+ {
+ out.push((part, [g.u0, g.v0, g.u1, g.v1], color, 0, true));
+ }
}
if let Some(r) = stack
.and_then(|s| assets.trim_texture(&asset, kind, s))