From ece79cad8a69c49d24d9c03978241810554c35eb Mon Sep 17 00:00:00 2001
From: Sumyjkl <sumianvoice@gmail.com>
Date: Wed, 3 Aug 2022 00:08:30 +1000
Subject: [PATCH] prevent player from getting hyperspeed while flying from
 ground

---
 mods/PLAYER/mcl_playerplus/init.lua | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua
index 19b8c7839..cf8eafc2e 100644
--- a/mods/PLAYER/mcl_playerplus/init.lua
+++ b/mods/PLAYER/mcl_playerplus/init.lua
@@ -282,7 +282,7 @@ minetest.register_globalstep(function(dtime)
 		local is_just_jumped = control.jump and not is_pressing_jump and not elytra.active
 		is_pressing_jump = control.jump
 		if is_just_jumped and not elytra.active then
-			elytra.speed = clamp(get_overall_velocity(player:get_velocity()) - 1, 0, 20)
+			elytra.speed = clamp(get_overall_velocity(player:get_velocity()) - 1, 0, 2)
 		end
 		-- don't let player get too fast by spamming jump
 		local block_below = minetest.get_node(vector.offset(player:get_velocity(), 0, -0.7, 0)).name
@@ -353,9 +353,10 @@ minetest.register_globalstep(function(dtime)
 			-- NOTE: do not set this higher than about 0.7 or the game will get the wrong vel and it will be broken
 			-- this is far from ideal, but there's no good way to set_velocity on the player
 			player_vel = vector.multiply(player_vel, -0.1)
+			if speed_mult < 1 then player_vel.y = player_vel.y * 0.1 end
 			new_vel = vector.add(new_vel, player_vel)
 
-			new_vel.y = new_vel.y - (200 / math.max(speed_mult*10, 2)) * dtime
+			new_vel.y = new_vel.y + clamp(speed_mult * dtime * 10, -10, 0)
 			new_vel.y = new_vel.y - fall_speed * dtime
 			player:add_velocity(new_vel)
 		else