Use set_count instead of creating a new item and checking for enchanted books
parent
9919011aca
commit
903d1777be
|
@ -695,9 +695,9 @@ minetest.register_on_joinplayer(function(player)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info)
|
minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info)
|
||||||
local stack = inventory_info.stack
|
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 item = stack:get_name()
|
local stack = inventory_info.stack
|
||||||
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
|
stack:set_count(stack:get_stack_max())
|
||||||
player:get_inventory():set_stack("main", inventory_info.index, item .. " " .. stack:get_stack_max())
|
player:get_inventory():set_stack("main", inventory_info.index, stack)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue