Set the specified block data||doc135409

September 20, 2022

Format

 Map:setBlockData(pos, value)
  • The class to which the function belongs:Map

Description

Set the custom block data at the specified coordinates in the map.


Parameters

Variable name type Description
pos Vector3 specified location
value variant block data to set


Code Samples

Set custom square data for (1, 1, 1) coordinates on the map001 map

local map = World.CurWorld:getMap("map001")
local data = map:getBlockData(Lib.v3(1, 1, 1))
if not data then
    data = {}
end
data.sign = true
map:setBlockData(Lib.v3(1, 1, 1), data)

More convenient custom data settings

local map = World.CurWorld:getMap("map001")
local data = map:getOrCreateBlockData(Lib.v3(1, 1, 1))
data.sign = true