your current location:首页 > news>OC Sensors Minecraft

OC Sensors Minecraft

2024-12-15 02:31:56|Myriagame |source:minecraft skins

ocSensors

The sensor extension of an open computer.

Similar to an open computer sensor, this module adds a sensor block that allows scanning to scan around.

Feasible method

Method Introduction Scan (X: Number, Y: Number, Z: Number, [SIDE: Number]) Scan a block of the square near the sensor ([name: string = ""], [meta: number = -1], [Meta: number = -1], [Section: string = ""], [Range: number =]) Find the blocks of the cubes (X1: Number, Y1: Number, Z1: Number, Y2: Number, Z3: Number)Scan the entity near the sensor area

example

Get the energy storage energy of nearby energy storage blocks

 Local Component = Require ('Component') Local Sensor = Component.sensor Local CaPaPacity = 0 LocalStored = 0 PR int("", -1, "Energy") Print ("Scanning" .. #positations .. "blocks") for _, POS in iPairs (POSITIONS) do local info = Sensor.scan (pos.x, pos.yyyyPOS.Z) Print ("" .. Info.block.label .. "@" .. pos.x .. "," .. pos.y .. "," .. pos.z) totalStored = TotalStored+Info.data.energy.nergystored TotalCapAcity = TotalCapAcity+Info.Data.energy.MaxenerGystored End Print ("") Print ("Energy Summary:") Print ("Tot al capacity: ".. TotalCapAcity); Print (" Total Stored: ".. TotalStored); 

When all nearby practical equipment 2 generators are ready to run, the output redstone signal is output

 Local Component = Require ("Component") Local Sides = Require ("SIDES") Local Sensor = Component.sensor Local Redstone = Compon ENT.RDSTONE LOCAL RedStoneSide = Sides.Back-SearchFor Generators once Local Generators = Sensor.search ("", -1, "Extrautils2") While (TRUE) Do-Loop Over Nearby Machines and See If 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 AlreamRunnn ing = info.data.extrautils2.processStime> 0--IS the Generator SatisFied with items? Local Enoughs = 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.flum) Do If (tank.contents == nil or tank.Contents.amount == 0) then enoughfluid = false end end if (Alreadyrunning or (ENOUGHITEMS and EnoGhflum)) then --Print (INFO .block.label .. ":" .. Serialization.serialize (info.data))Print ("Ready:" .. Info.block.label) Else Print ("missing:" .. info.block.label)

-Immediaately Turn Off All Other Generators Redstone.Setoutput (RedStoneSide, 0) Missing = MISSING+1 END END-React Accordingly IF (M Isning == 0) TheN PRINT ("-> All Generators Good to go") Redstone.setput (redstoneSide, 15) Else Print ("-> missing" .. missing .. "Generators") end os.sleep (1) end

discard the fluid of all nearby moofluid beef cows.

 Local Component = Require ('Component') Local Serialization = Require ('Serialization') LOCAL SENSOR = Component.sensor Loc aligne = 5 local finddfluids = {} 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.moFLUIDS.FLUID.NAME END END PRINT (Serialization.serialize (Foundfluids))-{"lava", "lava", "lava", "water", "lava"} 
"

Minecraft images

G Copyright Mc Encyclopedia 2013-2024 mcmod.cn | Hubei ICP No. 11010313 -2

In addition to other statements, MCMOD.CN, all open public editing content uses the BY-NC-SA 3.0 protocol.

Minecraft images

Minecraft images