From 903d1777be98e62e1f9c11aedcda8236688dc796 Mon Sep 17 00:00:00 2001 From: NO11 Date: Thu, 18 Nov 2021 17:40:32 +0100 Subject: [PATCH] Use set_count instead of creating a new item and checking for enchanted books --- mods/HUD/mcl_inventory/creative.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 76139160b..f5a9574eb 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -695,9 +695,9 @@ minetest.register_on_joinplayer(function(player) end) minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info) - local stack = inventory_info.stack - local item = stack:get_name() - if minetest.is_creative_enabled(player:get_player_name()) and action == "put" and inventory_info.listname == "main" and get_stack_size(player) == 64 and not item:find("mcl_enchanting:book_enchanted") then - player:get_inventory():set_stack("main", inventory_info.index, item .. " " .. stack:get_stack_max()) + if minetest.is_creative_enabled(player:get_player_name()) and get_stack_size(player) == 64 and action == "put" and inventory_info.listname == "main" then + local stack = inventory_info.stack + stack:set_count(stack:get_stack_max()) + player:get_inventory():set_stack("main", inventory_info.index, stack) end -end) \ No newline at end of file +end)