Replace deprecated get_metadata() calls (#3142)

This commit is contained in:
Niklp 2024-07-27 15:42:08 +03:00 committed by GitHub
parent 9cb57ae5f2
commit 88ecab34d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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