From 4f0ee7df9495ddfa12b0ec4f16f299088a66bbb4 Mon Sep 17 00:00:00 2001 From: FunnyShadow Date: Sun, 3 Mar 2024 19:37:41 +0800 Subject: [PATCH 1/4] Enhanced compatibility with Mods such as First Person Model and RealCamera --- scripts/general.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/general.lua b/scripts/general.lua index ccec87a2..b69f293b 100644 --- a/scripts/general.lua +++ b/scripts/general.lua @@ -79,4 +79,21 @@ events.TICK:register(function () end end) +events.RENDER:register(function (delta, context) + local shouldRenderHead = not renderer:isFirstPerson() + if context == "FIRST_PERSON" then + shouldRenderHead = false + end + if context == "OTHER" then + shouldRenderHead = true + end + if context == "PAPERDOLL" then + shouldRenderHead = true + end + if context == "MINECRAFT_GUI" then + shouldRenderHead = true + end + models.models.main.Avatar.Head:setVisible(shouldRenderHead) +end) + return General \ No newline at end of file From 78c41808730f7e81dd127da26ec95f9735cda0f5 Mon Sep 17 00:00:00 2001 From: FunnyShadow Date: Sun, 3 Mar 2024 19:53:11 +0800 Subject: [PATCH 2/4] Update the name of the calling function --- scripts/physics.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/physics.lua b/scripts/physics.lua index e2643f51..257dcc63 100644 --- a/scripts/physics.lua +++ b/scripts/physics.lua @@ -76,7 +76,7 @@ events.RENDER:register(function (delta, context) local tailRot = vectors.vec3(0, 0, 0) local hairAccessoryLineRot = vectors.vec3(0, 0, 0) local rotLimit = {{{-60, 60}, {-30, 30}}, {{0, 180}, {-90, 90}}} --物理演算の可動範囲:1. 尻尾:{1-1. 上下方向, 1-2. 左右方向}, 2. 髪飾りのヒモ:{2-1. 前後方向, 2-2. 左右方向} - if (context ~= "FIRST_PERSON" or client:hasIrisShader()) and (Physics.EnablePyhsics[1] or Physics.EnablePyhsics[2]) then + if (context ~= "FIRST_PERSON" or client:hasShaderPack()) and (Physics.EnablePyhsics[1] or Physics.EnablePyhsics[2]) then local playerPose = player:getPose() local rideVehicle = player:getVehicle() ~= nil if SitDown.IsAnimationPlaying or rideVehicle then From 6c54a73b1ccc69bfff6fe34ab8ee404b78b439d4 Mon Sep 17 00:00:00 2001 From: FunnyShadow Date: Tue, 5 Mar 2024 21:44:02 +0800 Subject: [PATCH 3/4] Discard an unnecessary parameter --- scripts/general.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/general.lua b/scripts/general.lua index b69f293b..be845d3a 100644 --- a/scripts/general.lua +++ b/scripts/general.lua @@ -79,7 +79,7 @@ events.TICK:register(function () end end) -events.RENDER:register(function (delta, context) +events.RENDER:register(function (_, context) local shouldRenderHead = not renderer:isFirstPerson() if context == "FIRST_PERSON" then shouldRenderHead = false From b9d6e05b52a9026938c9bd0a34e7e3f94c19e1c7 Mon Sep 17 00:00:00 2001 From: FunnyShadow Date: Tue, 5 Mar 2024 23:53:06 +0800 Subject: [PATCH 4/4] Added more context checking to optimize the visual experience --- scripts/general.lua | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/scripts/general.lua b/scripts/general.lua index be845d3a..40b6ee46 100644 --- a/scripts/general.lua +++ b/scripts/general.lua @@ -79,21 +79,18 @@ events.TICK:register(function () end end) -events.RENDER:register(function (_, context) - local shouldRenderHead = not renderer:isFirstPerson() - if context == "FIRST_PERSON" then - shouldRenderHead = false - end - if context == "OTHER" then - shouldRenderHead = true - end - if context == "PAPERDOLL" then - shouldRenderHead = true - end - if context == "MINECRAFT_GUI" then - shouldRenderHead = true - end - models.models.main.Avatar.Head:setVisible(shouldRenderHead) +events.RENDER:register(function(_, context) + local shouldRenderHead = false + if (context ~= "FIRST_PERSON" and (not renderer:isFirstPerson())) or + context == "FIRST_PERSON_WORLD" or + context == "WORLD" or + context == "OTHER" or + context == "PAPERDOLL" or + context == "MINECRAFT_GUI" or + context == "FIGURA_GUI" then + shouldRenderHead = true + end + models.models.main.Avatar.Head:setVisible(shouldRenderHead) end) -return General \ No newline at end of file +return General