mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-09 17:23:49 +01:00
Fix enchanted book
This commit is contained in:
parent
0477e729f5
commit
66eb5c35da
@ -2,7 +2,7 @@ local S = minetest.get_translator("mcl_enchanting")
|
|||||||
local F = minetest.formspec_escape
|
local F = minetest.formspec_escape
|
||||||
|
|
||||||
function mcl_enchanting.is_book(itemname)
|
function mcl_enchanting.is_book(itemname)
|
||||||
return itemname == "mcl_books:book" or itemname == "mcl_enchanting:book_enchanted"
|
return itemname == "mcl_books:book" or itemname == "mcl_enchanting:book_enchanted" or itemname == "mcl_books:book_enchanted"
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_enchanting.get_enchantments(itemstack)
|
function mcl_enchanting.get_enchantments(itemstack)
|
||||||
@ -147,7 +147,8 @@ function mcl_enchanting.combine(itemstack, combine_with)
|
|||||||
local itemname = itemstack:get_name()
|
local itemname = itemstack:get_name()
|
||||||
local combine_name = combine_with:get_name()
|
local combine_name = combine_with:get_name()
|
||||||
local enchanted_itemname = mcl_enchanting.get_enchanted_itemstring(itemname)
|
local enchanted_itemname = mcl_enchanting.get_enchanted_itemstring(itemname)
|
||||||
if enchanted_itemname ~= mcl_enchanting.get_enchanted_itemstring(combine_name) and not mcl_enchanting.is_book(itemname) then
|
if enchanted_itemname ~= mcl_enchanting.get_enchanted_itemstring(combine_name) and not mcl_enchanting.is_book(combine_name) then
|
||||||
|
print(combine_name, mcl_enchanting.is_book(combine_name))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
local enchantments = mcl_enchanting.get_enchantments(itemstack)
|
local enchantments = mcl_enchanting.get_enchantments(itemstack)
|
||||||
@ -211,7 +212,7 @@ function mcl_enchanting.initialize()
|
|||||||
local register_tool_list = {}
|
local register_tool_list = {}
|
||||||
local register_item_list = {}
|
local register_item_list = {}
|
||||||
for itemname, itemdef in pairs(minetest.registered_items) do
|
for itemname, itemdef in pairs(minetest.registered_items) do
|
||||||
if mcl_enchanting.can_enchant_freshly(itemname) then
|
if mcl_enchanting.can_enchant_freshly(itemname) and not mcl_enchanting.is_book(itemname) then
|
||||||
local new_name = itemname .. "_enchanted"
|
local new_name = itemname .. "_enchanted"
|
||||||
minetest.override_item(itemname, {_mcl_enchanting_enchanted_tool = new_name})
|
minetest.override_item(itemname, {_mcl_enchanting_enchanted_tool = new_name})
|
||||||
local new_def = table.copy(itemdef)
|
local new_def = table.copy(itemdef)
|
||||||
|
@ -143,6 +143,8 @@ minetest.register_craftitem("mcl_enchanting:book_enchanted", {
|
|||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_alias("mcl_books:book_enchanted", "mcl_enchanting:book_enchanted")
|
||||||
|
|
||||||
local spawn_book_entity = function(pos, respawn)
|
local spawn_book_entity = function(pos, respawn)
|
||||||
if respawn then
|
if respawn then
|
||||||
-- Check if we already have a book
|
-- Check if we already have a book
|
||||||
|
Loading…
Reference in New Issue
Block a user