Skip to content

Commit

Permalink
Replace deprecated get_metadata() calls (#3142)
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklp09 authored Jul 27, 2024
1 parent 9cb57ae commit 88ecab3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mods/default/chests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion mods/default/craftitems.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mods/default/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 88ecab3

Please sign in to comment.