Merge pull request #294 from ludovic111/fix/arrow-interpolation

Arrows stop jumping along their path after they land (#278)
This commit is contained in:
Ludovic Marie
2026-10-15 09:58:46 +02:00
committed by GitHub
4 changed files with 16 additions and 9 deletions
@@ -262,7 +262,7 @@ fn main() -> Result<()> {
let a = arrow.arrow.as_ref().unwrap();
writeln!(
out,
"arrow {} {} {:08x} {:08x} {} {} {} {} {} {} {} {} {} {:016x} {:016x} {} {} {:016x}",
"arrow {} {} {:08x} {:08x} {} {} {} {} {} {} {} {} {} {:016x} {:016x} {} {} {:016x} {}",
bits(arrow.position),
bits(arrow.velocity),
arrow.pitch.to_bits(),
@@ -280,7 +280,8 @@ fn main() -> Result<()> {
a.fluids.fluid_height(&Tags, LAVA).to_bits(),
a.removed,
arrow.critical(),
a.fall_distance.to_bits()
a.fall_distance.to_bits(),
bits(arrow.previous)
)?;
writeln!(out, "events {}", events.join(" | "))?;
let a = arrow.arrow.as_ref().unwrap();
+3
View File
@@ -387,6 +387,9 @@ pub fn tick(p: &mut Projectile, scene: &ArrowScene, targets: &[(Who, Aabb)]) ->
let Some(mut st) = p.arrow.take() else {
return (false, Hit::None);
};
// Entity.setOldPosAndRot: the renderer interpolates from here, in flight
// and stuck alike.
p.previous = p.position;
let hit = Ticker {
p,
st: &mut st,
@@ -151,6 +151,8 @@ public final class VanillaArrowOracle {
var a=new Arrow(level,0,0,0,ammo,null);
random.set(a,net.minecraft.util.RandomSource.create(seed(row.get("seed"))));
a.setPos(VanillaSceneCollisionOracle.vector(row.get("position")));a.setDeltaMovement(VanillaSceneCollisionOracle.vector(row.get("velocity")));
// The client's recreateFromPacket snaps a spawned arrow, old position included.
a.setOldPosAndRot();
a.setCritArrow(row.get("crit").getAsBoolean());a.setNoPhysics(row.get("no_physics").getAsBoolean());
String touched="-";
for(var value:row.getAsJsonArray("ops")){
@@ -187,9 +189,9 @@ public final class VanillaArrowOracle {
default->throw new AssertionError(op);
}
var state=(BlockState)lastState.get(a);
out.printf("arrow %s %s %08x %08x %s %d %d %d %s %d %s %s %s %016x %016x %s %s %016x%n",bits(a.position()),bits(a.getDeltaMovement()),Float.floatToIntBits(a.getXRot()),Float.floatToIntBits(a.getYRot()),
out.printf("arrow %s %s %08x %08x %s %d %d %d %s %d %s %s %s %016x %016x %s %s %016x %s%n",bits(a.position()),bits(a.getDeltaMovement()),Float.floatToIntBits(a.getXRot()),Float.floatToIntBits(a.getYRot()),
inGround.invoke(a),inGroundTime.getInt(a),life.getInt(a),a.shakeTime,state==null?"none":Block.getId(state),a.getRemainingFireTicks(),touching.getBoolean(a),eyes.getBoolean(a),first.getBoolean(a),
Double.doubleToLongBits(a.getFluidHeight(net.minecraft.tags.FluidTags.WATER)),Double.doubleToLongBits(a.getFluidHeight(net.minecraft.tags.FluidTags.LAVA)),a.isRemoved(),a.isCritArrow(),Double.doubleToLongBits(a.fallDistance));
Double.doubleToLongBits(a.getFluidHeight(net.minecraft.tags.FluidTags.WATER)),Double.doubleToLongBits(a.getFluidHeight(net.minecraft.tags.FluidTags.LAVA)),a.isRemoved(),a.isCritArrow(),Double.doubleToLongBits(a.fallDistance),bits(new Vec3(a.xo,a.yo,a.zo)));
out.println("events "+String.join(" | ",level.events));level.events.clear();
out.printf("pickup %d %s %s%n",a.pickup.ordinal(),a.getPickupItemStackOrigin().has(net.minecraft.core.component.DataComponents.INTANGIBLE_PROJECTILE),touched);touched="-";
}
+6 -5
View File
@@ -5,11 +5,12 @@ Real vanilla `Arrow` entities tick in an independently built copy of the
scene (`VanillaArrowOracle`, client and server jars); Horizon's
`arrows::tick` runs over the scene itself (`examples/arrow_probe.rs`). Every
operation prints the arrow's position, motion, rotation, ground state, life,
shake, stuck block, fire ticks, water flags, fluid heights, removal, crit flag
and fall distance by exact bits, then its sounds, particles and game events in
order, then its pickup rule, whether its item is intangible and what a player
touching it took. Cases: flights in the air with and without crits or physics, into and
through water (inertia, bubbles, splashes, currents of flowing water, eyes),
shake, stuck block, fire ticks, water flags, fluid heights, removal, crit flag,
fall distance and old position (what rendering interpolates from) by exact
bits, then its sounds, particles and game events in order, then its pickup
rule, whether its item is intangible and what a player touching it took.
Cases: flights in the air with and without crits or physics, into and through
water (inertia, bubbles, splashes, currents of flowing water, eyes),
kelp, seagrass and waterlogged blocks, bubble columns with and without drag
and with air or water above, sticking in full and partial blocks, falling out
when the block goes, starting inside a block, and despawning after 1200 ticks;