fix cape rendering conflicts

The elytra and the normal cape were able to render at the same time while wearing an elytra.
This commit is contained in:
chmodsayshello 2023-12-17 15:45:53 +01:00
parent 89eb0f9b3e
commit bfe333ef60
2 changed files with 11 additions and 3 deletions

View File

@ -241,7 +241,7 @@ minetest.register_tool("mcl_armor:elytra", {
local cape = mcl_skins.player_skins[obj].cape
if cape ~= "blank.png" then
local skinval = mcl_player.player_get_skin(obj)
skinval = skinval:gsub("^" .. cape, "")
skinval = skinval:gsub("%^" .. cape, "")
mcl_player.player_set_skin(obj, skinval)
-- this doesn't mess with the data mcl_skins has, so when mcl_skins reloads (which happens when the elytra is unequipped), the normal cape returns
end

View File

@ -161,8 +161,16 @@ function mcl_skins.update_player_skin(player)
end
local skin = mcl_skins.player_skins[player]
local skinval = mcl_skins.compile_skin(skin)
mcl_player.player_set_skin(player, mcl_skins.compile_skin(skin))
if player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra" then
skinval = skinval:gsub("%^" .. skin.cape, "")
-- don't render the "normal" cape on players while wearing the elytra.
-- this is NOT used when the player puts an elytra on, see register.lua in mcl_armor for that.
-- this is used when a player joins or changes something regarding their skin.
end
mcl_player.player_set_skin(player, skinval)
local slim_arms
if skin.simple_skins_id then
@ -705,7 +713,7 @@ end
init()
if not minetest.settings:get_bool("mcl_keepInventory", false) then
minetest.register_on_dieplayer(function(player)
minetest.register_on_respawnplayer(function(player)
mcl_skins.update_player_skin(player) -- ensures players have their cape again after dying with an elytra
end)
end