java.lang.Object
io.github.nbcss.createfactorycontroller.content.compat.computercraft.FactoryControllerPeripheral
All Implemented Interfaces:
dan200.computercraft.api.peripheral.IPeripheral

public class FactoryControllerPeripheral extends Object implements dan200.computercraft.api.peripheral.IPeripheral
Allow computers from CC: Tweaked to access information from a factory controller. The factory controller acts as a peripheral.

Lua usage:

local fc = peripheral.find("factory_controller")
fc.getInfo()

The controller's state is read-only.

  • Method Details

    • getType

      public @NonNull String getType()
      Specified by:
      getType in interface dan200.computercraft.api.peripheral.IPeripheral
    • getTarget

      public Object getTarget()
      Specified by:
      getTarget in interface dan200.computercraft.api.peripheral.IPeripheral
    • equals

      public boolean equals(@Nullable @Nullable dan200.computercraft.api.peripheral.IPeripheral other)
      Specified by:
      equals in interface dan200.computercraft.api.peripheral.IPeripheral
    • getInfo

      @LuaFunction(mainThread=true) public final Map<String,Object> getInfo()
      Get general information about the factory controller.
      Returns:
      {
          pos: {
              x: int
              y: int
              z: int
          }
          name: string -- Custom name of the controller, if any
          redstonePowered: boolean -- Whether the controller is powered by redstone
          componentCount: int -- The number of components in the factory controller
      }
      
    • getNetworks

      @LuaFunction(mainThread=true) public final List<String> getNetworks()
      Get the UUIDs of all networks known to the factory controller.
      Returns:
      string[] -- Network UUIDs
      
    • getComponents

      @LuaFunction(mainThread=true) public final List<Map<String,Object>> getComponents()
      Get summaries for all components placed in the factory controller.
      Returns:
      {
          pos: string -- Component position as "x,y"
          type: string -- Component type ID
      }[]
      
    • getGauges

      @LuaFunction(mainThread=true) public final List<Map<String,Object>> getGauges()
      Get information about all gauges placed in the factory controller.
      Returns:
      {
          pos: string -- Component position as "x,y"
          type: string -- Component type ID
          item: string -- Item ID, or an empty string when no item is set
          count: int -- Requested item count
          unit: string -- Gauge unit
          requestMode: string -- Gauge request mode
          workMode: string -- Gauge work mode
          stock: int -- Current stock level
          promised: int -- Current promised item count
          satisfied: boolean -- Whether the gauge is satisfied
          waitingForNetwork: boolean -- Whether the gauge is waiting for a network
          redstonePowered: boolean -- Whether the gauge is powered by redstone
          address: string -- Recipe address, if any
          network: string -- Network UUID, if any
          gaugeId: string -- Gauge UUID, if any
      }[]
      
    • getLogicTubes

      @LuaFunction(mainThread=true) public final List<Map<String,Object>> getLogicTubes()
      Get information about all logical tubes attached to the factory controller.
      Returns:
      {
          pos: string -- Component position as "x,y"
          type: string -- Component type ID
          mode: string -- Logical tube mode
          powered: boolean -- Whether the logical tube is powered
      }[]
      
    • getMissingLinks

      @LuaFunction(mainThread=true) public final List<Map<String,Object>> getMissingLinks()
      Get missing links in the factory controller's known networks.
      Returns:
      {
          network: string -- Network UUID
          links: string[] -- Missing link positions as "dimension@x,y,z"
      }[]
      
    • getPromiseCountForGauge

      @LuaFunction(mainThread=true) public final int getPromiseCountForGauge(String network, String gaugeId)
      Get the number of active promises associated with one gauge on a network.
      Parameters:
      network - Network UUID from getNetworks()
      gaugeId - Gauge UUID from getGauges()
      Returns:
      int -- Active promise count
      
    • getPromiseCountForAddress

      @LuaFunction(mainThread=true) public final int getPromiseCountForAddress(String network, String address)
      Get the number of active promises targeting a packager address on a network.
      Parameters:
      network - Network UUID from getNetworks()
      address - Packager address
      Returns:
      int -- Active promise count