Helper methods for hardware colorization (#5870)

This commit is contained in:
Dániel Juhász 2017-06-24 18:15:09 +00:00 committed by Nils Dagsson Moskopp
parent dcde9046b5
commit 5f6d3bba2a
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 12 additions and 0 deletions

View File

@ -572,6 +572,18 @@ function core.node_dig(pos, node, digger)
end end
end end
function core.itemstring_with_palette(item, palette_index)
local stack = ItemStack(item) -- convert to ItemStack
stack:get_meta():set_int("palette_index", palette_index)
return stack:to_string()
end
function core.itemstring_with_color(item, colorstring)
local stack = ItemStack(item) -- convert to ItemStack
stack:get_meta():set_string("color", colorstring)
return stack:to_string()
end
-- This is used to allow mods to redefine core.item_place and so on -- This is used to allow mods to redefine core.item_place and so on
-- NOTE: This is not the preferred way. Preferred way is to provide enough -- NOTE: This is not the preferred way. Preferred way is to provide enough
-- callbacks to not require redefining global functions. -celeron55 -- callbacks to not require redefining global functions. -celeron55