Improved cloak physics

This commit is contained in:
2026-03-21 00:38:41 +01:00
parent b60f218e29
commit 0471a007ce
@@ -314,25 +314,16 @@ public class CloakFeatureRenderer extends FeatureRenderer<PlayerEntityRenderStat
long now = System.currentTimeMillis();
if (now - lastUpdate >= 20) {
float velX = Math.min(1.0f, playerEntityRenderState.field_53537 / 108.0f);
float velX = Math.min(0.6f, playerEntityRenderState.field_53537 / 108.0f);
float rawVelY = playerEntityRenderState.field_53536;
float velY = (rawVelY > 4.0f ? rawVelY : 0.0f) / 16;
float velY = (rawVelY > 3.4f ? rawVelY : 0.0f) / 16;
float value = playerEntityRenderState.isSwimming ? 0.0f : velX + velY;
if (Config.cloakPhysics.value) {
updateSegmentValues(value);
updateSegmentValues(segmentValues[0] + (value - segmentValues[0]) * 0.3f);
} else {
float last = segmentValues[0];
float maxStep = 0.02f;
float next = value;
if (next > last)
next = Math.min(next, last + maxStep);
else if (next < last)
next = Math.max(next, last - maxStep);
Arrays.fill(segmentValues, next);
Arrays.fill(segmentValues, segmentValues[0] + (value - segmentValues[0]) * 0.05f);
}
lastUpdate = now;
}