CC: Relative Routing

Call peripherals using relative coordinates instead of ids

Редакция NLZONE · 2 мин чтения · 1 просмотр
CC: Relative Routing
Скачать CC: Relative Routing1.21.1 · с официальной страницы: modrinth.com
Перейти к загрузке

Что это

Call peripherals using relative coordinates instead of ids

  • Тип: мод
  • Загрузчик: neoforge
  • Версии Minecraft: 1.21.1
  • Скачиваний на Modrinth: 1 805

Подробно

CC: Relative Routing adds two ComputerCraft peripherals that lets you interact with the world using relative coordinates instead of peripheral IDs, making your programs portable and reproducible.

Send wireless redstone signals to relative coordinates and block faces.

Connect a CC computer to the Redstone Router, then use the redstonerouter peripheral:

lua local router = peripheral.find("redstonerouter")

-- Power the north face of the block 3 east, 0 up, 2 north of the router router.setRedstone(3, 0, -2, "north", 15)

-- Read redstone print(router.getRedstone(3, 0, -2, "north")) -- 15

-- Remove all active signals router.clearAll()

| Method | Description | |--------|-------------| | setRedstone(x, y, z, side, power) | Sets a redstone signal (power 0–15) on the given face of the target block. Power 0 removes the signal. | | getRedstone(x, y, z, side) | Returns the currently stored power for that offset + face. | | clearAll() | Removes all active signals from this router. |

side is one of: north south east west up down

Wrap any CC-compatible peripheral nearby using relative coordinates instead of a peripheral name or side. The peripheral can be used as if it was connected to the computer.

lua local router = peripheral.find("peripheralrouter")

-- Wrap a monitor at offset (3, 0, 0) local mon = router.wrap(3, 0, 0) mon.setTextScale(1) mon.clear() mon.setCursorPos(1, 1) mon.write("Hello from relative routing!")

-- Check what's at an offset before wrapping if router.isPresent(0, 2, 0) then print(router.getType(0, 2, 0)) -- e.g. "monitor" print(router.getMethods(0, 2, 0)) -- list all methods end

-- Call a single method without wrapping router.call(3, 0, 0, "write", "Hello")

-- You can even move fluids local inputfluidtank = router.wrap(1,0,0) local outputfluidtank = router.wrap(3,0,0) local moved = outputfluidtank.pullFluid(inputfluidtank, 1000, "minecraft:water") print(moved .. " mB moved")

| Method | Description | |--------|-------------| | wrap(x, y, z) | Returns a proxy object with all the target peripheral's methods. Prefer this for interacting with peripherals. | | isPresent(x, y, z) | Returns true if a peripheral exists at the offset. | | getType(x, y, z) | Returns the peripheral type string, or nil if none. | | getMethods(x, y, z) | Returns a table of all method names on the peripheral. | | call(x, y, z, method, ...) | Calls a single named method. Note: may return nil for value-returning methods. Use wrap() when you need return values.

Как установить

Скачайте файл на официальной странице ниже и положите его в папку mods (для модов) или plugins (для плагинов) вашего сервера или клиента. Для модов нужен совместимый загрузчик. Версия должна совпадать с версией Minecraft.

Текст подготовлен автоматически из описания на Modrinth и ждёт проверки редакцией.

Редакция NLZONE

Пишем о серверах, модах и играх, в которые играем сами. Нашли ошибку — напишите нам, исправим.

Комментарии 0

Комментарии к этому материалу отключены.

Читайте также