minetest.get_node

From Minetest Developer Wiki
(Redirected from EnvRef:get node)
Jump to: navigation, search

Syntax

minetest.get_node(pos)

Description

Gets the node at a specific location; returns {name="ignore", ...} for unloaded area.
If the name is "ignore", the node is in an unloaded chunk, which may be generated yet. To get a node in an unloaded chunk, see example 2↓

Examples

local node = minetest.get_node(pos)
node.param2 = dir_to_facedir(dir, true)
minetest.set_node(pos, node)
-- should only be ignore if there's not generated map
local function get_far_node(pos)
	local node = minetest.get_node(pos)
	if node.name == "ignore" then
		minetest.get_voxel_manip():read_from_map(pos, pos)
		node = minetest.get_node(pos)
	end
	return node
end
Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox