Merge pull request #2159 from kacpherek/fix/infinity-plain-arrows-only
🤖 Agent: Gate check by Ludovic's AI agent (Claude). Checked against 26.3: Infinity's `ammo_use` effect only covers `minecraft:arrow`, so tipped and spectral arrows are used up. Gate: this wave's 55 PRs merged on main in one tree: clippy `-D warnings` clean, 1186 horizon-client and 163 horizon-world tests pass, and of the 101 harnesses `parity.py --changed-files` picked, 100 pass (`block_removal` failed on one spawner case from #2199's orb merging, fixed there). `lan_e2e.py` passes 24 checks with the host on its server thread and in-frame (chest, xp, pvp, doors, villagers, beds, frames, projectiles, arrows, fishing, damage, mobs, blast, drops, elytra, breath, predict, cracks, barter, kills, hurt, contacts, underwater, plates), plus forced-levels on the server thread. Thanks @kacpherek!
This commit is contained in:
@@ -9404,7 +9404,10 @@ impl Game<'_> {
|
||||
};
|
||||
// BowItem.shootProjectile: shootFromRotation(power * 3, inaccuracy 1).
|
||||
let p = Vec3::new(eye[0], eye[1] - 0.1, eye[2]);
|
||||
let (power_bonus, infinity) = self.bow_enchantments();
|
||||
let ammo = arrow_slot
|
||||
.and_then(|i| self.stack_in(i).cloned())
|
||||
.unwrap_or_else(|| ItemStack::new("minecraft:arrow", 1));
|
||||
let (power_bonus, infinity) = self.bow_enchantments(&ammo.item);
|
||||
let kind = horizon_client::projectiles::ProjectileKind::Arrow {
|
||||
base_damage: 2.0 + power_bonus,
|
||||
critical: power >= 1.0,
|
||||
@@ -9418,9 +9421,6 @@ impl Game<'_> {
|
||||
// ProjectileWeaponItem.useAmmo: creative and Infinity draw without
|
||||
// using the ammo, so the arrow is CREATIVE_ONLY; else setOwner(player)
|
||||
// lets it be picked up.
|
||||
let ammo = arrow_slot
|
||||
.and_then(|i| self.stack_in(i).cloned())
|
||||
.unwrap_or_else(|| ItemStack::new("minecraft:arrow", 1));
|
||||
if let Some(a) = arrow.arrow.as_mut() {
|
||||
a.set_item(&horizon_client::arrows::drawn_ammo(
|
||||
&ammo,
|
||||
|
||||
@@ -384,7 +384,9 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
/// Bow enchantments at release: (extra base damage, infinity keeps the arrow).
|
||||
pub(super) fn bow_enchantments(&mut self) -> (f64, bool) {
|
||||
/// `ammo` is the item being fired: `Enchantment.itemContext` hands it to the
|
||||
/// `ammo_use` conditions as the tool, so Infinity only frees plain arrows.
|
||||
pub(super) fn bow_enchantments(&mut self, ammo: &str) -> (f64, bool) {
|
||||
let Some(bow) = self.inventory[self.selected].clone() else {
|
||||
return (0.0, false);
|
||||
};
|
||||
@@ -403,7 +405,7 @@ impl Game<'_> {
|
||||
0.0,
|
||||
);
|
||||
let ammo_ctx = EffectContext {
|
||||
tool: Some("minecraft:arrow"),
|
||||
tool: Some(ammo),
|
||||
items: Some(self.res.items()),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user