From 586c18b00f7803557262ee7f1a465c89bc8e1665 Mon Sep 17 00:00:00 2001 From: kay27 Date: Tue, 22 Jun 2021 03:15:39 +0400 Subject: [PATCH] [mcl_mobs/api] Continue float function on acceleration.y equals zero --- mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua index 893f8eeded..d9698a0a75 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua @@ -32,12 +32,15 @@ end mobs.float = function(self) local acceleration = self.object:get_acceleration() - if acceleration and acceleration.y ~= 0 then - self.object:set_acceleration(vector.new(0,0,0)) - else + + if not acceleration then return end + if acceleration.y ~= 0 then + self.object:set_acceleration({x=0, y=0, z=0}) + end + local current_velocity = self.object:get_velocity() local goal_velocity = { @@ -46,7 +49,7 @@ mobs.float = function(self) z = 0, } - local new_velocity_addition = vector.subtract(goal_velocity,current_velocity) + local new_velocity_addition = vector.subtract(goal_velocity, current_velocity) new_velocity_addition.x = 0 new_velocity_addition.z = 0