Archive incari-client (client, 26.3, clean)

This commit is contained in:
2026-11-28 00:54:38 -06:00
parent 7a6174687f
commit 12838e838c
2383 changed files with 280266 additions and 0 deletions
@@ -0,0 +1,28 @@
# Incari's Low Shield (features/lowshield) for the Rust build (ADR 0068, 0069).
# Hooks by name where Horizon has stamped the hook point (native-hooks.json), by function where
# it's still pending. Its settings are the client's (rust/mods/incari): the module menu shows them.
[mod]
id = "incari_lowshield"
version = "0.1.0"
priority = 100
[[module]]
id = "runtime"
file = "crates/horizon-client/src/game.rs"
name = "incari_lowshield"
source = "runtime.rs"
[[injection]]
id = "pose"
# Horizon's hand_pose hook point is still a pending fragment
# (tools/native-hook-fragments/incari_client_hooks.json), so this targets its function. Make it
# `hook = "hand_pose"` and `hook_version = 1` once Horizon stamps it.
target = "horizon_client::game::native_hooks::Game<'_>::native_hand_pose"
kind = "HEAD"
helper = "pose.rs"
bindings = [
{ name = "game", ty = "&crate::game::Game<'_>", value = "self" },
{ name = "stack", ty = "&horizon_client::items::ItemStack", value = "stack" },
{ name = "using", ty = "bool", value = "using" },
{ name = "pose", ty = "&mut glam::Mat4", value = "&mut *pose" },
]
@@ -0,0 +1,19 @@
// The shield moved down in its own space.
fn incari_lowshield_pose(
game: &crate::game::Game<'_>,
stack: &horizon_client::items::ItemStack,
using: bool,
pose: &mut glam::Mat4,
) {
use crate::game::{incari_client as c, incari_lowshield as m};
let _ = game;
let Some((lower, while_blocking)) =
c::settings(m::ID, |s| (s.int("lower"), s.bool("while-blocking")))
else {
return;
};
let drop = m::drop(&stack.item, using, lower, while_blocking);
if drop > 0.0 {
*pose *= glam::Mat4::from_translation(glam::Vec3::new(0.0, -drop, 0.0));
}
}
@@ -0,0 +1,35 @@
// Incari's Low Shield for the Rust build (ADR 0068, 0069), as features/lowshield does it: your
// shield drawn lower in first person, so it hides less; blocking is unchanged. Horizon's hand pose
// hook moves the drawn item only. Its settings are the module's in `incari_core::modules`.
// No game types: rust/lib.rs tests it.
/// The module's id, as the Java client's profiles name it.
pub const ID: &str = "lowshield";
pub const SHIELD: &str = "minecraft:shield";
/// The hand's units a percent moves the shield, as the Java module measured them: 100% is the
/// shield's height on screen.
pub const UNITS_PER_PERCENT: f32 = 0.0018;
/// How far down to move `item`, held up (`using`) or not, for the `lower` (a percent) and
/// `while-blocking` settings; 0 for anything but a shield.
pub fn drop(item: &str, using: bool, lower: i32, while_blocking: bool) -> f32 {
if item != SHIELD || (using && !while_blocking) {
return 0.0;
}
lower.clamp(0, 90) as f32 * UNITS_PER_PERCENT
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn lowers_only_shields() {
assert!((drop(SHIELD, true, 35, true) - 0.063).abs() < 1e-6);
assert_eq!(drop("minecraft:stone_sword", false, 35, true), 0.0);
assert_eq!(drop(SHIELD, true, 35, false), 0.0);
assert!(drop(SHIELD, false, 35, false) > 0.0);
}
}