From e7e332f4ca98afde83253a52c0ecb278236504ec Mon Sep 17 00:00:00 2001 From: sasheg dev <152582704+SashegDev@users.noreply.github.com> Date: Wed, 21 Oct 2026 21:14:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D1=8B=D0=B6=D0=BE=D0=BA=20=D1=81?= =?UTF-8?q?=D1=87=D0=B8=D1=82=D0=B0=D0=B5=D1=82=D1=81=D1=8F=20=D1=82=D0=BE?= =?UTF-8?q?=D1=87=D0=BD=D0=BE:=20=D0=B2=D1=8B=D1=81=D0=BE=D1=82=D0=B0=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=B1=D0=B8=D1=80=D0=B0=D0=B5=D1=82=D1=81?= =?UTF-8?q?=D1=8F=20=D0=BE=D0=B1=D1=80=D0=B0=D1=82=D0=BD=D1=8B=D0=BC=20?= =?UTF-8?q?=D1=81=D1=87=D0=B5=D1=82=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Формула v = 0.42 * sqrt(h / 1.25) давала 1.48 вместо 1.5, потому что движение каждый тик теряет часть на сопротивление воздуха. Теперь высота находится обратным счетом по физике ваниллы (гравитация 0.08, сопротивление 0.98). Высота -> импульс: 1.25 -> 0.41961, 1.35 -> 0.43713, 1.5 -> 0.46341, 1.6 -> 0.48093, 2.0 -> 0.54485. Задаётся: run-game.ps1 -ExtraArgs "-Drsx.jumpHeight=1.5" --- .../net/rustnotmc/client/RsxPlayerTuning.java | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/game-fork/src-overlay/net/rustnotmc/client/RsxPlayerTuning.java b/game-fork/src-overlay/net/rustnotmc/client/RsxPlayerTuning.java index 2430d10..3068e32 100644 --- a/game-fork/src-overlay/net/rustnotmc/client/RsxPlayerTuning.java +++ b/game-fork/src-overlay/net/rustnotmc/client/RsxPlayerTuning.java @@ -42,6 +42,12 @@ public final class RsxPlayerTuning { /** The speed the vanilla jumps with. */ private static final float VANILLA_JUMP_MOTION = 0.42F; + /** How fast the motion falls on every tick. */ + private static final float GRAVITY = 0.08F; + + /** How much of the motion the air takes on every tick. */ + private static final float AIR_DRAG = 0.98F; + private RsxPlayerTuning() { } @@ -78,15 +84,43 @@ public final class RsxPlayerTuning { /** * The upward speed a jump of that height needs. * - * The vanilla jumps with 0.42 and that carries it 1.25 blocks. The height - * grows with the square of the speed, so the speed for a height is the - * vanilla one times the square root of the ratio. + * The height of a jump is not the square of the speed, because the + * motion loses a little to the air on every tick. So the speed is found + * the honest way: the height is computed for a guess and the guess is + * corrected until it is the height that was asked for. */ public static float jumpMotion(float height) { if (height <= 0.0F) { return VANILLA_JUMP_MOTION; } - return VANILLA_JUMP_MOTION * (float) Math.sqrt(height / VANILLA_JUMP_HEIGHT); + float low = 0.0F; + float high = 1.0F; + for (int i = 0; i < 60; i++) { + float middle = (low + high) * 0.5F; + if (heightOf(middle) < height) { + low = middle; + } else { + high = middle; + } + } + return (low + high) * 0.5F; + } + + /** + * How high a jump with that speed carries the player. + * + * The motion of the vanilla on every tick: the speed falls by the + * gravity and then by the air. The player is as high as the sum of the + * upward steps. + */ + private static float heightOf(float motion) { + float height = 0.0F; + float speed = motion; + while (speed > 0.0F) { + height += speed; + speed = (speed - GRAVITY) * AIR_DRAG; + } + return height; } private static float setting(String name, float fallback, float floor) {