# Block Management

Before using block API, please create the block management objects. The methods as follows:

local Block = class.Block.new()

The specific function name and description are as follows:

Serial number Function name Description
1 isSolidBlock(...) Whether it is solid block
2 isLiquidBlock(...) Whether it is liquid block
3 isAirBlock(...) Whether it is gas block
4 getBlockID(...) Obtain corresponding block id
5 setBlockAll(...) Set blockalldata. Update and notify
6 getBlockData(...) Obtain blockdata
7 destroyBlock(...) Destroy the block dropitem:Drops(Default false, no drops)
8 placeBlock(...) Place the block
9 replaceBlock(...) Replace blocks 1.1+
10 setBlockAllForUpdate(...) Set blockalldata, notify surrounding blocks
11 setBlockAllForNotify(...) Set blockalldata update the block of current location
12 setBlockSettingAttState(...) Set block's attribute and state
13 getBlockSettingAttState(...) Obtain the attribute and status of block Set
14 getBlockSwitchStatus(...) Obtain on-off state of function block
15 setBlockSwitchStatus(...) Set on-off state of function block
16 convertBlockDirToData(...) Obtain the data of block via direction
17 getBlockPowerStatus(...) Obtain the status of block with power 1.1+

# isSolidBlock

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Whether it is solid block
  • The specific use cases are as follows:
local result = Block:isSolidBlock(x, y, z)

# isLiquidBlock

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Whether it is liquid block
  • The specific use cases are as follows:
local result = Block:isLiquidBlock(x, y, z)

# isAirBlock

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Whether it is gas block
  • The specific use cases are as follows:
local result = Block:isAirBlock(x, y, z)

# getBlockID

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain corresponding block id
  • The specific use cases are as follows:
local result = Block:getBlockID(x, y, z)

# setBlockAll

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set blockalldata. Update and notify
  • The specific use cases are as follows:
local result = Block:setBlockAll(x, y, z, blockid, data)

# getBlockData

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain blockdata
  • The specific use cases are as follows:
local result = Block:getBlockData(x, y, z)

# destroyBlock

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Destroy the block dropitem:Drops(Default false, no drops)
  • The specific use cases are as follows:
local result = Block:destroyBlock(x, y, z, dropitem)

# placeBlock

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Place the block
  • The specific use cases are as follows:
local result = Block:placeBlock(blockid, x, y, z, face)

# replaceBlock 1.1+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Replace blocks
  • The specific use cases are as follows:
local result = Block:replaceBlock(blockid, x, y, z, face)

# setBlockAllForUpdate

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set blockalldata, notify surrounding blocks
  • The specific use cases are as follows:
local result = Block:setBlockAllForUpdate(x, y, z, blockid)

# setBlockAllForNotify

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set blockalldata update the block of current location
  • The specific use cases are as follows:
local result = Block:setBlockAllForNotify(x, y, z, blockid)

# setBlockSettingAttState

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set block's attribute and state
  • The specific use cases are as follows:
local result = Block:setBlockSettingAttState(blockid, attrtype, switch)

# getBlockSettingAttState

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain the attribute and status of block Set
  • The specific use cases are as follows:
local result = Block:getBlockSettingAttState(blockid, attrtype)

# getBlockSwitchStatus

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain on-off state of function block
  • The specific use cases are as follows:
local result = Block:getBlockSwitchStatus(pos)

# setBlockSwitchStatus

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set on-off state of function block
  • The specific use cases are as follows:
local result = Block:setBlockSwitchStatus(pos, isactive)

# convertBlockDirToData

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain the data of block via direction
  • The specific use cases are as follows:
local result = Block:convertBlockDirToData(blockid, data, dir)

# getBlockPowerStatus 1.1+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain the status of block with power
  • The specific use cases are as follows:
local result = Block:getBlockPowerStatus(pos)
Last Update: 11/22/2019, 2:31:59 PM