Oc Sensors Mod

OC Sensors Mod (1.12.2) is an addon mod for OpenComputers Mod. It adds a sensor block that allows computers to scan surrounding blocks.

OC Sensors Mod (1.12.2) - Sensor Addon for OpenComputers 1

Features:

Available Methods

Method Description
scan(x:number, y:number, z:number, [side:number]) Scans a block relative to the sensor
search([name:string=”“], [meta:number=-1], [section:string=”“], [range:number=]) Search for blocks matching the given criteria in the given range
searchEntities(x1:number, y1:number, z1:number, x2:number, y2:number, z3:number) Scans a region relative to the sensor for entities

Examples:

Get stored energy of all energy-capable nearby blocks

local component = require('component')

local sensor = component.sensor

local totalCapacity = 0
local totalStored = 0

print("Searching for blocks handling energy")
local positions = sensor.search("", -1, "energy")

print("Scanning " .. #positions .. " blocks")
for _,pos in ipairs(positions) do
  local info = sensor.scan(pos.x, pos.y, pos.z)

  print("  " .. info.block.label .. " @ " .. pos.x .. "," .. pos.y .. "," .. pos.z)
  totalStored = totalStored + info.data.energy.energyStored
  totalCapacity = totalCapacity + info.data.energy.maxEnergyStored
end

print("")
print("Energy summary:")
print("  Total capacity: " .. totalCapacity);
print("  Total stored:   " .. totalStored);

Output a redstone signal when all nearby extra utilities 2 generators are ready to run

local component = require("component")
local sides = require("sides")

local sensor = component.sensor
local redstone = component.redstone

local redstoneSide = sides.back

-- Search for generators once
local generators = sensor.search("", -1, "extrautils2")

while(true) do
    -- Loop over nearby machines and see if they are all satisfied
    local missing = 0
    for _,pos in ipairs(generators) do
        local info = sensor.scan(pos.x, pos.y, pos.z)
        local xu = info.data.extrautils2

        -- Is the generator already running?
        local alreadyRunning = info.data.extrautils2.processTime > 0

        -- Is the Generator satisfied with items?
        local enoughItems = info.data.items.n == 0 or info.data.items.n == #info.data.items

        -- Is it satisfied with fluid?
        local enoughFluid = true
        if(info.data.fluid.n > 0) then
            for _,tank in ipairs(info.data.fluid) do
                if(tank.contents == nil or tank.contents.amount == 0) then
                    enoughFluid = false
                end
            end
        end

        if(alreadyRunning or (enoughItems and enoughFluid)) then
            --print(info.block.label .. ": " .. serialization.serialize(info.data))
            print("Ready:   " .. info.block.label)
        else
            print("Missing: " .. info.block.label)

            -- Immediately turn off all other generators
            redstone.setOutput(redstoneSide, 0)
            missing = missing + 1
        end
    end

    -- React accordingly
    if(missing == 0) then
        print("--> All generators good to go")
        redstone.setOutput(redstoneSide, 15)
    else
        print("--> Missing " .. missing .. " generators")
    end

    os.sleep(1)
end

Dump the fluid of all nearby MooFluid cows

local component = require('component')
local serialization = require('serialization')

local sensor = component.sensor

local range = 5

local foundFluids = {}
for _, entity in ipairs(sensor.searchEntities(-range, -range, -range, range, range, range)) do
    if(entity.type == "neutral" and entity.moofluids ~= nil) then
        foundFluids[#foundFluids+1] = entity.moofluids.fluid.name
    end
end

print(serialization.serialize(foundFluids))
-- {"lava", "lava", "lava", "water", "water", "lava"}

Screenshots:

OC Sensors Mod (1.12.2) - Sensor Addon for OpenComputers 2

Requires:

Minecraft Forge

OpenComputers Mod

How to install:

How To Download & Install Mods with Minecraft Forge

How To Download & Install Fabric Mods

Don’t miss out today’s latest Minecraft Mods

OC Sensors Mod (1.12.2) Download Links

For Minecraft 1.10.2

Forge version: Download from Server 1

For Minecraft 1.12.2

Forge version: Download from Server 1Download from Server 2

Mods

1.19.4 Mods

1.19.3 Mods

1.19.2 Mods

1.18.2 Mods

1.16.5 Mods

1.15.2 Mods

1.12.2 Mods

1.8.9 Mods

1.7.10 Mods

1.18.1 Mods

1.17.1 Mods

1.14.4 Mods

1.13.2 Mods

1.11.2 Mods

1.10.2 Mods

1.9.4 Mods

Minecraft Modpacks

1.19.4 Modpacks

1.19.3 Modpacks

1.19.2 Modpacks

1.18.2 Modpacks

1.16.5 Modpacks

1.12.2 Modpacks

1.7.10 Modpacks

Forge Mods

Fabric Mods

Quilt Mods

Resource Packs

1.19.4 Resource Packs

1.19.3 Resource Packs

1.19.2 Resource Packs

1.18.2 Resource Packs

1.16.5 Resource Packs

1.15.2 Resource Packs

1.12.2 Resource Packs

1.8.9 Resource Packs

1.7.10 Resource Packs

1.18.1 Resource Packs

1.17.1 Resource Packs

1.14.4 Resource Packs

1.13.2 Resource Packs

1.11.2 Resource Packs

1.10.2 Resource Packs

1.9.4 Resource Packs

Shaders

1.19.4 Shaders

1.19.3 Shaders

1.19.2 Shaders

1.18.2 Shaders

1.17.1 Shaders

1.16.5 Shaders

Maps

1.19.4 Maps

1.19.3 Maps

1.19.2 Maps

1.18.2 Maps

1.16.5 Maps

1.15.2 Maps

1.12.2 Maps

1.8.9 Maps

1.7.10 Maps

1.18.1 Maps

1.17.1 Maps

1.14.4 Maps

1.13.2 Maps

1.11.2 Maps

1.10.2 Maps

1.9.4 Maps

Data Packs

1.19.4 Data Packs

1.19.3 Data Packs

1.19.2 Data Packs

1.18.2 Data Packs

1.16.5 Data Packs

1.15.2 Data Packs

1.18.1 Data Packs

1.17.1 Data Packs

1.14.4 Data Packs

1.13.2 Data Packs

MCPE/Bedrock

Mods & Addons

MCPE 1.19 Add-ons

MCPE 1.19 Mods

Texture Packs

MCPE 1.19 Texture Packs

MCPE 1.19 Resource Packs

Maps

MCPE 1.19 Maps

Clients

MCPE 1.19 Clients

Mod Menu Clients

Shaders

MCPE 1.19 Shaders

Render Dragon Shaders

Launchers

Skin Packs

Clients

1.19.4 Clients

1.19.3 Clients

1.19.2 Clients

1.18.2 Clients

1.16.5 Clients

1.12.2 Clients

1.8.9 Clients

Launchers

1.19.4 Launchers

1.19.3 Launchers

1.19.2 Launchers

1.18.2 Launchers

1.16.5 Launchers

1.12.2 Launchers

1.7.10 Launchers

Seeds

1.19.4 Seeds

1.19.3 Seeds

1.19.2 Seeds

1.18.2 Seeds

Skins

Plugins

Bukkit Plugins

Spigot Plugins

Paper Plugins

Tutorials

Installation Guide

Mobs Wiki Guide

Seeds Wiki Guide

Biomes Wiki Guide

Status Effects Wiki Guide

Enchantments Wiki Guide

Materials Wiki Guide

Command Blocks

Versions

Backlinks