From e7f49a54f24f86874bdd7a57db4c0589c2b9f25d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 6 Feb 2017 00:32:14 +0100 Subject: [PATCH] Flip direction of crafting guide arrow --- mods/mcl_craftguide/init.lua | 22 ++++++++++-------- .../textures/craftguide_arrow.png | Bin 242 -> 202 bytes 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/mods/mcl_craftguide/init.lua b/mods/mcl_craftguide/init.lua index 5b4f37875..48eb16440 100644 --- a/mods/mcl_craftguide/init.lua +++ b/mods/mcl_craftguide/init.lua @@ -103,6 +103,7 @@ function craftguide:get_recipe(iY, xoffset, tooltip, item, recipe_num, recipes) local items = recipes[recipe_num].items local width = recipes[recipe_num].width + local cooking_time = 10 local is_shapeless = false if recipe_type == "normal" and width == 0 then is_shapeless = true @@ -114,17 +115,17 @@ function craftguide:get_recipe(iY, xoffset, tooltip, item, recipe_num, recipes) end if recipe_type == "cooking" then + cooking_time = width + width = 1 formspec = formspec.. "image["..(xoffset-0.8)..","..(iY+1).. ".5;0.5,0.5;default_furnace_front_active.png]" elseif is_shapeless then formspec = formspec.. "image["..(xoffset-0.8)..","..(iY+1).. - ".5;0.5,0.5;craftguide_shapeless.png^[transformFX]" + ".5;0.5,0.5;craftguide_shapeless.png]" end - -- TODO: Make “crafting arrow” point to the right, not to the left - local rows = ceil(maxn(items) / width) local btn_size, craftgrid_limit = 1, 5 @@ -136,13 +137,14 @@ function craftguide:get_recipe(iY, xoffset, tooltip, item, recipe_num, recipes) width.."x"..rows..")]" else for i, v in pairs(items) do - local X = (i-1) % width + xoffset + local X = (i-1) % width + xoffset - 4 + (3 - max(1, width)) local Y = ceil(i / width + iY+2 - min(2, rows)) if recipe_type == "normal" and width > 3 or rows > 3 then btn_size = width > 3 and 3 / width or 3 / rows - X = btn_size * (i % width) + xoffset + X = btn_size * (i % width) + xoffset - 4 + (3 - max(1, width)) + Y = btn_size * floor((i-1) / width) + iY+3 - min(2, rows) end @@ -151,7 +153,7 @@ function craftguide:get_recipe(iY, xoffset, tooltip, item, recipe_num, recipes) local label = groups and "\nG" or "" local item_r = self:group_to_item(v) local tltip = self:get_tooltip( - item_r, recipe_type, width, groups) + item_r, recipe_type, cooking_time, groups) formspec = formspec.. "item_image_button["..X..","..Y..";".. @@ -163,7 +165,7 @@ function craftguide:get_recipe(iY, xoffset, tooltip, item, recipe_num, recipes) return formspec.. "image["..(xoffset-1)..","..(iY+2).. ".12;0.9,0.7;craftguide_arrow.png]".. - "item_image_button["..(xoffset-2)..","..(iY+2)..";1,1;".. + "item_image_button["..(xoffset)..","..(iY+2)..";1,1;".. output..";"..item..";]"..tooltip end @@ -199,7 +201,7 @@ function craftguide:get_formspec(player_name, is_fuel) mt.formspec_escape(data.filter).."]" local even_num = data.iX % 2 == 0 - local xoffset = data.iX / 2 + (even_num and 0.5 or 0) + local xoffset = data.iX / 2 + (even_num and 0.5 or 0) + 2 if not next(data.items) then formspec = formspec.. @@ -226,9 +228,9 @@ function craftguide:get_formspec(player_name, is_fuel) formspec = formspec.. "image["..(xoffset-1)..","..(iY+2).. ".12;0.9,0.7;craftguide_arrow.png]".. - "item_image_button["..xoffset..","..(iY+2).. + "item_image_button["..(xoffset-2)..","..(iY+2).. ";1,1;"..data.item..";"..data.item..";]".. - tooltip.."image["..(xoffset-2)..",".. + tooltip.."image["..(xoffset)..",".. (iY+1.98)..";1,1;craftguide_fire.png]" else formspec = formspec..self:get_recipe( diff --git a/mods/mcl_craftguide/textures/craftguide_arrow.png b/mods/mcl_craftguide/textures/craftguide_arrow.png index e8d3598a1b8d1ad3d505bb99421495cad111a35d..055bd2a5a43e1204054c9d4ff2042a1756022bf3 100644 GIT binary patch delta 185 zcmV;q07n1v0m=c88Gi%-0048iln4L-00DDSM?wIu&K&6g0007FOGiWi0IH26G5`Po z32;bRa{vGf6951U69E94oEQKA00(qQO+^Rc0tFWaGpsSPumAu6PDw;TR4C7_(oqTk zAP57{oz)|Fe^{T@Ky48F8xIK+M3ta6=&I6Ra)(aF*nlLWthMs% z%qla2Xsr>Okt4K}0x5ioE@1`wfK?~}B$6TO?)$K^(pk*adzYdBFvdVOv$T8N|9Tuv zg}cMd($Tmn+wxct6~0^|X$AiJ37z8Mx4H9ZGj4?Sj@VmcN^bxF002ovPDHLkV1j3| BSk3?d