forked from Mineclonia/Mineclonia
Forbid renaming of written books
This commit is contained in:
parent
06c9b2c3f6
commit
40163aed91
|
@ -52,6 +52,7 @@ Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times
|
||||||
* `can_eat_when_full=1`: Only for foodstuffs. This item can be eaten when the user has a full hunger bar
|
* `can_eat_when_full=1`: Only for foodstuffs. This item can be eaten when the user has a full hunger bar
|
||||||
* `attached_node_facedir=1`: Like `attached_node`, but for facedir nodes
|
* `attached_node_facedir=1`: Like `attached_node`, but for facedir nodes
|
||||||
* `cauldron`: Cauldron. 1: Empty. 2-4: Water height
|
* `cauldron`: Cauldron. 1: Empty. 2-4: Water height
|
||||||
|
* `no_rename=1`: Item cannot be renamed by anvil
|
||||||
|
|
||||||
#### Footnotes
|
#### Footnotes
|
||||||
|
|
||||||
|
|
|
@ -38,14 +38,19 @@ local function update_anvil_slots(meta)
|
||||||
else
|
else
|
||||||
name_item = input1
|
name_item = input1
|
||||||
end
|
end
|
||||||
local meta = name_item:get_meta()
|
-- No renaming allowed with group no_rename=1
|
||||||
-- Limit name length
|
if minetest.get_item_group(name_item:get_name(), "no_rename") == 1 then
|
||||||
new_name = string.sub(new_name, 1, 30)
|
new_output = ""
|
||||||
-- Rename item
|
else
|
||||||
meta:set_string("description", new_name)
|
local meta = name_item:get_meta()
|
||||||
-- Double-save the name internally, too
|
-- Limit name length
|
||||||
meta:set_string("name", new_name)
|
new_name = string.sub(new_name, 1, 30)
|
||||||
new_output = name_item
|
-- Rename item
|
||||||
|
meta:set_string("description", new_name)
|
||||||
|
-- Double-save the name internally, too
|
||||||
|
meta:set_string("name", new_name)
|
||||||
|
new_output = name_item
|
||||||
|
end
|
||||||
else
|
else
|
||||||
new_output = ""
|
new_output = ""
|
||||||
end
|
end
|
||||||
|
|
|
@ -179,7 +179,7 @@ minetest.register_craftitem("mcl_books:written_book", {
|
||||||
|
|
||||||
To copy the text of the written book, place it into the crafting grid together with a book and quill (or multiple of those) and craft. The written book will not be consumed. Copies of copies can not be copied.]],
|
To copy the text of the written book, place it into the crafting grid together with a book and quill (or multiple of those) and craft. The written book will not be consumed. Copies of copies can not be copied.]],
|
||||||
inventory_image = "mcl_books_book_written.png",
|
inventory_image = "mcl_books_book_written.png",
|
||||||
groups = { not_in_creative_inventory=1, book=1 },
|
groups = { not_in_creative_inventory=1, book=1, no_rename=1 },
|
||||||
stack_max = 16,
|
stack_max = 16,
|
||||||
on_place = read,
|
on_place = read,
|
||||||
on_secondary_use = read
|
on_secondary_use = read
|
||||||
|
|
Loading…
Reference in New Issue