Fix passenger walk animation in shared render state

Zero passenger walk position and speed like vanilla LivingEntityRenderer, covering local and remote riders. Extend entity model parity with moving passenger and on-foot render-state cases.

Fixes #1962

Co-Authored-By: Codex GPT-6.1 Sol <noreply@openai.com>
This commit is contained in:
rdbtCVS
2026-10-26 02:13:12 +00:00
parent 74b08e6310
commit 4cc134d08a
4 changed files with 50 additions and 5 deletions
@@ -282,6 +282,19 @@ public final class VanillaEntityAnimOracle {
state.getClass();
for (var entry : kase.entrySet())
if (!entry.getKey().startsWith("@")) set(state, entry.getKey(), entry.getValue());
if (kase.has("@walkTicks")) {
var walk = new net.minecraft.world.entity.WalkAnimationState();
for (var speed : kase.getAsJsonArray("@walkTicks"))
walk.update(speed.getAsFloat(), 0.4F, 1.0F);
// LivingEntity.calculateEntityAnimation stops passengers/dead entities;
// LivingEntityRenderer.extractRenderState also zeros both fields.
if (kase.get("isPassenger").getAsBoolean() || !kase.get("@alive").getAsBoolean())
walk.stop();
float partial = kase.get("@partial").getAsFloat();
set(state, "walkAnimationPos", gson.toJsonTree(walk.position(partial)));
set(state, "walkAnimationSpeed", gson.toJsonTree(walk.speed(partial)));
result.add("walk", gson.toJsonTree(new float[]{walk.position(partial), walk.speed(partial)}));
}
hooks(state, kase);
if (state instanceof net.minecraft.client.renderer.entity.state.ArmedEntityRenderState armed && armed.swingAnimation > 0)
armed.currentSwing = new net.minecraft.world.entity.LivingEntity.SwingDescription(net.minecraft.world.InteractionHand.MAIN_HAND, net.minecraft.world.item.component.SwingAnimation.DEFAULT, 6);