Craft Guide : go to the last page when clicking on previous on page 0
This commit is contained in:
parent
ae7a51d86c
commit
46f3fb3bda
@ -123,8 +123,7 @@ function worktable.craft_output_recipe(pos, start_i, pagenum, stackname, recipe_
|
|||||||
inv:set_size("craft_output_recipe", 1)
|
inv:set_size("craft_output_recipe", 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
local craft, dye_color, flower_color = {}, "", ""
|
local craft = {}
|
||||||
|
|
||||||
for k, def in pairs(stack_items) do
|
for k, def in pairs(stack_items) do
|
||||||
craft[#craft+1] = def
|
craft[#craft+1] = def
|
||||||
if def and def:find("^group:") then
|
if def and def:find("^group:") then
|
||||||
@ -135,10 +134,10 @@ function worktable.craft_output_recipe(pos, start_i, pagenum, stackname, recipe_
|
|||||||
elseif def:find("wool$") then
|
elseif def:find("wool$") then
|
||||||
def = "wool:white"
|
def = "wool:white"
|
||||||
elseif def:find("dye$") then
|
elseif def:find("dye$") then
|
||||||
dye_color = def:match(".*_([%w_]+)")
|
local dye_color = def:match(".*_([%w_]+)")
|
||||||
def = "dye:"..dye_color
|
def = "dye:"..dye_color
|
||||||
elseif def:find("^group:flower") then
|
elseif def:find("^group:flower") then
|
||||||
flower_color = def:match(".*_([%w_]+)")
|
local flower_color = def:match(".*_([%w_]+)")
|
||||||
if flower_color == "red" then
|
if flower_color == "red" then
|
||||||
def = "flowers:rose"
|
def = "flowers:rose"
|
||||||
elseif flower_color == "yellow" then
|
elseif flower_color == "yellow" then
|
||||||
@ -299,13 +298,17 @@ function worktable.fields(pos, _, fields, sender)
|
|||||||
worktable.craft_output_recipe(pos, 0, 1, nil, 1, "")
|
worktable.craft_output_recipe(pos, 0, 1, nil, 1, "")
|
||||||
elseif fields.prev or fields.next then
|
elseif fields.prev or fields.next then
|
||||||
local inventory_size = #meta:to_table().inventory.inv_items_list
|
local inventory_size = #meta:to_table().inventory.inv_items_list
|
||||||
|
|
||||||
if fields.prev or start_i >= inventory_size then
|
if fields.prev or start_i >= inventory_size then
|
||||||
start_i = start_i - 8*4
|
start_i = start_i - 8*4
|
||||||
elseif fields.next or start_i < 0 then
|
elseif fields.next or start_i < 0 then
|
||||||
start_i = start_i + 8*4
|
start_i = start_i + 8*4
|
||||||
end
|
end
|
||||||
if start_i < 0 or start_i >= inventory_size then
|
|
||||||
|
if start_i >= inventory_size then
|
||||||
start_i = 0
|
start_i = 0
|
||||||
|
elseif start_i < 0 then
|
||||||
|
start_i = inventory_size - (inventory_size % (8*4))
|
||||||
end
|
end
|
||||||
|
|
||||||
worktable.craft_output_recipe(pos, start_i, start_i / (8*4) + 1, nil, 1, filter)
|
worktable.craft_output_recipe(pos, start_i, start_i / (8*4) + 1, nil, 1, filter)
|
||||||
|
Loading…
Reference in New Issue
Block a user