mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-22 15:00:18 +01:00
Replace deprecated get_metadata()
calls (#3142)
This commit is contained in:
parent
9cb57ae5f2
commit
88ecab34d9
@ -163,12 +163,12 @@ function default.chest.register_chest(prefixed_name, d)
|
||||
local itemstack = player:get_wielded_item()
|
||||
local key_meta = itemstack:get_meta()
|
||||
|
||||
if itemstack:get_metadata() == "" then
|
||||
if itemstack:get_meta():get_string("") == "" then
|
||||
return
|
||||
end
|
||||
|
||||
if key_meta:get_string("secret") == "" then
|
||||
key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
|
||||
key_meta:set_string("secret", minetest.parse_json(itemstack:get_meta():get_string("")).secret)
|
||||
itemstack:set_metadata("")
|
||||
end
|
||||
|
||||
|
@ -57,7 +57,7 @@ local function book_on_use(itemstack, user)
|
||||
local page, page_max, lines, string = 1, 1, {}, ""
|
||||
|
||||
-- Backwards compatibility
|
||||
local old_data = minetest.deserialize(itemstack:get_metadata())
|
||||
local old_data = minetest.deserialize(itemstack:get_meta():get_string(""))
|
||||
if old_data then
|
||||
meta:from_table({ fields = old_data })
|
||||
end
|
||||
|
@ -803,7 +803,7 @@ function default.can_interact_with_node(player, pos)
|
||||
local key_meta = item:get_meta()
|
||||
|
||||
if key_meta:get_string("secret") == "" then
|
||||
local key_oldmeta = item:get_metadata()
|
||||
local key_oldmeta = item:get_meta():get_string("")
|
||||
if key_oldmeta == "" or not minetest.parse_json(key_oldmeta) then
|
||||
return false
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user