OpenLights is an OpenComputers: Rebooted addon that adds a programmable light block. Computers can set its RGB color and vanilla light level from 0 to 15.
- Minecraft 1.21.1
- NeoForge 21.1.233 or newer
- OpenComputers: Rebooted 1.9.4 or newer
- Java 21
Veil 2.0 or newer is optional. When present, OpenLights uses Veil point lights so the programmed RGB color also illuminates the world. Without Veil, the block remains color-tinted and emits the programmed vanilla light level.
Run gradlew.bat build on Windows or ./gradlew build on Linux and macOS. The built mod is written to build/libs.
An OpenLight is exposed as an openlight component with the original API:
greet()setColor(color)setBrightness(brightness)getColor()getBrightness()
The controller solves the OpenComputers component limit: one controller component can manage up to 4,096 OpenLights without connecting each light to a cable network.
- Place an OpenLights Controller and connect it to the computer network with OpenComputers cable.
- Sneak-use the controller once. The chat message confirms the selected controller.
- Sneak-use each OpenLight you want to enroll. Chat reports its stable numeric ID.
- Keep sneak-using lights to enroll more; the selection stays active. Sneak-use a bound light without a selected controller to report its current ID.
The controller appears as the openlights_controller component on a connected computer. Its callbacks are:
getControllerId()returns the controller UUID.count()returns the number of registered lights.list()returns ID-keyed records containingx,y,z, andloaded; loaded records also containcolor,colorHex, andbrightness.getLight(id)returns one record.setColor(id, color),setBrightness(id, brightness), andsetLight(id, color, brightness)control one loaded light.setAllColor(color),setAllBrightness(brightness), andsetAll(color, brightness)control every loaded registered light. Each returns changed and unavailable counts.removeLight(id)unregisters a light.
Colors are numeric RGB values such as 0xFF4000; brightness is 0 through 15. Registered lights in unloaded chunks remain in list() with loaded=false and are not force-loaded by callbacks.
Example:
local controller = component.openlights_controller
for id, light in pairs(controller.list()) do
if light.loaded then controller.setColor(id, 0xFF4000) end
end
controller.setAllBrightness(12)