From b7c7c2627beba086c922df0a20939b67ae1eb464 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Sun, 25 Apr 2021 01:44:46 -0400 Subject: [PATCH 1/3] Fix parrots not drowning --- mods/ENTITIES/mobs_mc/parrot.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua index fb1bc6f9bc..8b3be80dd9 100644 --- a/mods/ENTITIES/mobs_mc/parrot.lua +++ b/mods/ENTITIES/mobs_mc/parrot.lua @@ -20,7 +20,8 @@ mobs:register_mob("mobs_mc:parrot", { xp_min = 1, xp_max = 3, tilt_fly = true, - collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.89, 0.25}, + collisionbox = {-0.25, 0, -0.25, 0.25, 0.9, 0.25}, + eye_height = 0.45, visual = "mesh", mesh = "mobs_mc_parrot.b3d", textures = {{"mobs_mc_parrot_blue.png"},{"mobs_mc_parrot_green.png"},{"mobs_mc_parrot_grey.png"},{"mobs_mc_parrot_red_blue.png"},{"mobs_mc_parrot_yellow_blue.png"}}, From bac191293bc23405bfc02ef0795f0296fdaeb95a Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Sun, 25 Apr 2021 01:45:03 -0400 Subject: [PATCH 2/3] Fix clientside guessing making floating go crazy client side --- mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua index dbc9848198..81f78d161d 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua @@ -38,6 +38,10 @@ end --this is a generic float function mobs.float = function(self) + if self.object:get_acceleration().y ~= 0 then + self.object:set_acceleration(vector_new(0,0,0)) + end + local current_velocity = self.object:get_velocity() local goal_velocity = { From df364eed286fced64f3c4bff897fcfe91a9dd540 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Sun, 25 Apr 2021 01:45:35 -0400 Subject: [PATCH 3/3] Implement basics of head movement and fix walking mobs flying away after floating --- mods/ENTITIES/mcl_mobs/api/api.lua | 8 +++++- .../mcl_mobs/api/mob_functions/ai.lua | 25 ++++++++++++++++--- .../mcl_mobs/api/mob_functions/head_logic.lua | 8 ++++++ 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 mods/ENTITIES/mcl_mobs/api/mob_functions/head_logic.lua diff --git a/mods/ENTITIES/mcl_mobs/api/api.lua b/mods/ENTITIES/mcl_mobs/api/api.lua index ad2b9cb54b..3b34ec58ce 100644 --- a/mods/ENTITIES/mcl_mobs/api/api.lua +++ b/mods/ENTITIES/mcl_mobs/api/api.lua @@ -165,6 +165,7 @@ dofile(api_path .. "death_logic.lua") dofile(api_path .. "mob_effects.lua") dofile(api_path .. "projectile_handling.lua") dofile(api_path .. "breeding.lua") +dofile(api_path .. "head_logic.lua") mobs.spawning_mobs = {} @@ -362,9 +363,14 @@ function mobs:register_mob(name, def) ignores_cobwebs = def.ignores_cobwebs, breath = def.breath_max or 6, - --random_sound_timer = 0, random_sound_timer_min = 3, random_sound_timer_max = 10, + + + --head code variables + has_head = def.has_head or false, + head_bone = def.head_bone, + --end j4i stuff -- MCL2 extensions diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua index da15e8bb8a..a1c5feb031 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua @@ -371,6 +371,8 @@ local land_state_execution = function(self,dtime) if float_now then mobs.float(self) + elseif self.object:get_acceleration().y == 0 then + self.object:set_acceleration(vector_new(0,-self.gravity,0)) end end @@ -817,6 +819,17 @@ mobs.mob_step = function(self, dtime) return false end + + --DEBUG TIME! + + mobs.do_head_logic(self) + + + + --if true then--DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG + -- return + --end + --despawn mechanism --don't despawned tamed or bred mobs if not self.tamed and not self.bred then @@ -1101,10 +1114,16 @@ mobs.mob_step = function(self, dtime) mobs.stick_in_cobweb(self) + self.was_stuck_in_cobweb = true + else - --return the mob back to normal - if self.object:get_acceleration().y == 0 and not self.swim and not self.fly then - self.object:set_acceleration(vector_new(0,-self.gravity,0)) + --do not override other functions + if self.was_stuck_in_cobweb == true then + --return the mob back to normal + self.was_stuck_in_cobweb = nil + if self.object:get_acceleration().y == 0 and not self.swim and not self.fly then + self.object:set_acceleration(vector_new(0,-self.gravity,0)) + end end end end diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/head_logic.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/head_logic.lua new file mode 100644 index 0000000000..fe75a5b195 --- /dev/null +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/head_logic.lua @@ -0,0 +1,8 @@ +mobs.do_head_logic = function(self) + local yaw = self.object:get_yaw() + + + + + +end \ No newline at end of file