From 9919011aca6fbcf9cbb086d8260e4da0d1de3625 Mon Sep 17 00:00:00 2001 From: NO11 Date: Wed, 17 Nov 2021 16:43:48 +0100 Subject: [PATCH] Fix enchanted books losing their enchantments in creative inventory --- mods/HUD/mcl_inventory/creative.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index d2dedd556..76139160b 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -695,8 +695,9 @@ minetest.register_on_joinplayer(function(player) end) minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info) - if minetest.is_creative_enabled(player:get_player_name()) and action == "put" and inventory_info.listname == "main" and get_stack_size(player) == 64 then - local stack = inventory_info.stack - player:get_inventory():set_stack("main", inventory_info.index, stack:get_name() .. " " .. stack:get_stack_max()) + 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()) end end) \ No newline at end of file