Guest User

Sample CRL code

a guest
Mar 30th, 2024
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. local CRL = peripheral.wrap("top")
  2.  
  3. local handles = {}
  4. local links = {}
  5.  
  6. local links_config = {
  7.     action_1 = {"minecraft:red_wool", "minecraft:lever"},
  8.     action_2 = {"minecraft:blue_wool", "minecraft:lever"},
  9.     action_3 = {"minecraft:green_wool", "minecraft:lever"}
  10. }
  11.  
  12. -- Load the handles
  13. for _, h in pairs(CRL.getHandles()) do
  14.     local items = h.getItems()
  15.     handles[items[1]..items[2]] = h
  16. end
  17.  
  18. -- Assign relevant handles
  19. for id, items in pairs(links_config) do
  20.     links[id] = handles[items[1]..items[2]] or CRL.openHandle(items[1], items[2])
  21. end
Advertisement
Add Comment
Please, Sign In to add comment