This “API” provides a global table to allow you to refer to sides / directions by name, as opposed to their numbers. The underlying number values are identical to Minecraft's internal numbering (as well as the ForgeDirection
Enum). This table serves as a two-directional look-up, so you can resolve names to numbers, but also numbers back to a human readable name. For example, sides.top
has the value 1
, whereas sides[1]
has the string value top
. A couple of aliases for the side names are available, so it's less likely to accidentally pick the wrong one. These are the basic values:
bottom
), Number: 0top
), Number: 1back
), Number: 2front
), Number: 3right
), Number: 4left
), Number: 5The following aliases are defined per default:
down
, negy
up
, posy
north
, negz
south
, posz
, forward
west
, negx
east
, posx
Useful for setting or getting redstone outputs or inputs, for example:
local component = require("component") local sides = require("sides") local rs = component.redstone rs.setOutput(sides.back, rs.getInput(sides.left))