forked from VoxeLibre/VoxeLibre
Merge pull request 'Fixed a crash' (#4154) from fix_capes_crash into master
Reviewed-on: MineClone2/MineClone2#4154 Reviewed-by: chmodsayshello <chmodsayshello@hotmail.com>
This commit is contained in:
commit
a2a38b7b3d
|
@ -163,6 +163,8 @@ function mcl_skins.update_player_skin(player)
|
||||||
local skin = mcl_skins.player_skins[player]
|
local skin = mcl_skins.player_skins[player]
|
||||||
local skinval = mcl_skins.compile_skin(skin)
|
local skinval = mcl_skins.compile_skin(skin)
|
||||||
|
|
||||||
|
if not skin.cape then skin.cape = "blank.png" end
|
||||||
|
|
||||||
if player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra" then
|
if player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra" then
|
||||||
skinval = skinval:gsub("%^" .. skin.cape, "")
|
skinval = skinval:gsub("%^" .. skin.cape, "")
|
||||||
-- don't render the "normal" cape on players while wearing the elytra.
|
-- don't render the "normal" cape on players while wearing the elytra.
|
||||||
|
@ -283,7 +285,7 @@ function mcl_skins.show_formspec(player, active_tab, page_num)
|
||||||
|
|
||||||
|
|
||||||
local cape_tab = active_tab == "cape"
|
local cape_tab = active_tab == "cape"
|
||||||
|
|
||||||
if active_tab == "skin" then
|
if active_tab == "skin" then
|
||||||
local page_start = (page_num - 1) * 8 - 1
|
local page_start = (page_num - 1) * 8 - 1
|
||||||
local page_end = math.min(page_start + 8 - 1, #mcl_skins.simple_skins)
|
local page_end = math.min(page_start + 8 - 1, #mcl_skins.simple_skins)
|
||||||
|
@ -351,7 +353,7 @@ function mcl_skins.show_formspec(player, active_tab, page_num)
|
||||||
end
|
end
|
||||||
|
|
||||||
local slot_offset = 0
|
local slot_offset = 0
|
||||||
|
|
||||||
if page_num == 1 then
|
if page_num == 1 then
|
||||||
formspec = formspec ..
|
formspec = formspec ..
|
||||||
"label[6,3;" .. S("(None)") .. "]"..
|
"label[6,3;" .. S("(None)") .. "]"..
|
||||||
|
@ -486,7 +488,7 @@ function mcl_skins.show_formspec(player, active_tab, page_num)
|
||||||
end
|
end
|
||||||
|
|
||||||
if page_num > 1 then
|
if page_num > 1 then
|
||||||
if cape_tab then
|
if cape_tab then
|
||||||
formspec = formspec ..
|
formspec = formspec ..
|
||||||
"image_button[4.5,0.7;1,1;mcl_skins_arrow.png^[transformFX;previous_page;]"
|
"image_button[4.5,0.7;1,1;mcl_skins_arrow.png^[transformFX;previous_page;]"
|
||||||
else
|
else
|
||||||
|
@ -723,4 +725,4 @@ if not minetest.settings:get_bool("mcl_keepInventory", false) then
|
||||||
minetest.register_on_respawnplayer(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
|
mcl_skins.update_player_skin(player) -- ensures players have their cape again after dying with an elytra
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue