From 88df9fb5b6c78df9485e8bf3750e2608bd78e14c Mon Sep 17 00:00:00 2001 From: red-001 Date: Tue, 31 Jan 2017 13:18:52 +0000 Subject: Add `get_wielded_item` --- clientmods/preview/init.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'clientmods') diff --git a/clientmods/preview/init.lua b/clientmods/preview/init.lua index db4f28350..2ca4594d3 100644 --- a/clientmods/preview/init.lua +++ b/clientmods/preview/init.lua @@ -60,6 +60,28 @@ end) core.register_on_punchnode(function(pos, node) print("The local player punched a node!") + local itemstack = core.get_wielded_item() + --[[ + -- getters + print(dump(itemstack:is_empty())) + print(dump(itemstack:get_name())) + print(dump(itemstack:get_count())) + print(dump(itemstack:get_wear())) + print(dump(itemstack:get_meta())) + print(dump(itemstack:get_metadata())) + print(dump(itemstack:is_known())) + --print(dump(itemstack:get_definition())) + print(dump(itemstack:get_tool_capabilities())) + print(dump(itemstack:to_string())) + print(dump(itemstack:to_table())) + -- setters + print(dump(itemstack:set_name("default:dirt"))) + print(dump(itemstack:set_count("95"))) + print(dump(itemstack:set_wear(934))) + print(dump(itemstack:get_meta())) + print(dump(itemstack:get_metadata())) + --]] + print(dump(itemstack:to_table())) print("pos:" .. dump(pos)) print("node:" .. dump(node)) return false -- cgit v1.2.3