Wall-Jump! [FORGE]

Wall-Jump! [FORGE]

22M Downloads

Player can jump two blocks high while sprinting

genandnic opened this issue ยท 5 comments

commented
commented

That issue comes from the port of the following part (https://github.com/genandnic/Wall-Jump/blob/1.15/src/main/java/genandnic/walljump/client/SpeedBoostLogic.java#L24-L27):

        int jumpBoostLevel = 0;
        EffectInstance jumpBoostEffect = pl.getActivePotionEffect(Effect.get(8));
        if (jumpBoostEffect != null) jumpBoostLevel = jumpBoostEffect.getAmplifier() + 1;
        pl.jumpMovementFactor = (float) (pl.getAIMoveSpeed() * (pl.isSprinting() ? 1 : 1.3) / 5) * (jumpBoostLevel * 0.5f + 1);

@genandnic could you please explain to me what's the objective of this code?
I take it gets the active level of the vanilla jump boost potion effect and then overrides the jumpMovementFactor based on movement speed, whether the player is sprinting or not and the previously obtained jumpBoostLevel. But how is jumpMovementFactor related to aiMoveSpeed ?

Sadly I fail to find anything matching this jumpMovementFactor in ClientPlayerEntity on Fabric decompiled mapped sources. getAIMoveSpeed seems to simply be getMovementSpeed on my side.

I might be able to replicate behavior in another place though, but I fail to understand this part.

commented

For whatever reason that appears to be flyingSpeed on Yarn mappings -- I'll try to fix it using that.

commented

So it really bothered me that the player's airspeed did not scale with the players ground speed in vanilla minecraft. For example, after you drink a speed boost potion in the base game it's actually slower to jump while sprinting (without the potion it's faster). Or when you drink a jump boost potion your jump height increases but the distance traveled horizontally stays the same, which makes the effect kinda boring.

The tweak is really subtle, though. If the variable isn't available I'd just remove that block entirely. It doesn't have anything to do with the speed boost enchantments anyway, they'd be completely unaffected.

commented

Thanks for the explanation -- indeed I never really noticed it but it does make Potion of Leaping way more nice to use now.

I found a way to fix it :D beta3 incoming with the fix.