From 64e510a7305e46514194f1ac8cd268d4c8d49928 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sat, 2 Jan 2021 12:21:35 +0100 Subject: [PATCH] Better bookshelf counting --- mods/ITEMS/mcl_enchanting/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_enchanting/init.lua b/mods/ITEMS/mcl_enchanting/init.lua index 2d4d33dae1..0ee9352fdb 100644 --- a/mods/ITEMS/mcl_enchanting/init.lua +++ b/mods/ITEMS/mcl_enchanting/init.lua @@ -235,7 +235,8 @@ minetest.register_node("mcl_enchanting:table", { if table_name == "" then table_name = S("Enchant") end - player_meta:set_int("mcl_enchanting:num_bookshelves", num_bookshelves) + local bookshelves = mcl_enchanting.get_bookshelves(pos) + player_meta:set_int("mcl_enchanting:num_bookshelves", math.min(15, #bookshelves)) player_meta:set_string("mcl_enchanting:table_name", table_name) mcl_enchanting.show_enchanting_formspec(clicker) -- Respawn book entity just in case it got lost @@ -310,7 +311,6 @@ minetest.register_abm({ }) end end - minetest.get_meta(pos):set_int("mcl_enchanting:num_bookshelves", math.min(15, #absolute)) end })