Infinity only saves plain arrows, not tipped or spectral ones
This commit is contained in:
@@ -9105,7 +9105,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,
|
||||
@@ -9119,9 +9122,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,
|
||||
|
||||
@@ -388,7 +388,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);
|
||||
};
|
||||
@@ -407,7 +409,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