Jump to content




[MC 1.7.10][CC 1.73] Redstone I/O

peripheral

2 replies to this topic

#1 FireHead996

  • Members
  • 14 posts
  • LocationPoland

Posted 03 August 2015 - 09:16 AM

Redstone I/O
Posted Image

What is this?
Redstone I/O is a peripheral for ComputerCraft that is meant to be connected to a LAN cable and can be used for various things like:
- reading a redstone signal (with strength)
- sending a redstone signal (with strength)
- throwing an Lua event when detects any change in redstone signal
Redstone signal can be placed only from side which is indicated by red cross.

Recipe
Recipe is the same as in older version made by Nuchaz.
Redstone block in the middle and smooth stones on the outside.
Posted Image

Code
redio = peripheral.wrap("io_1")

redio.setOutput(true)	-- enables a redstone signal with strength 15
redio.setOutput(false)   -- disables the redstone signal
redio.setOutput(10)	 -- outputs a redstone signal of 10
redio.setOutput(0)	 -- disables the redstone signal
redio.getInput()	 -- returns true/false if there is a redstone signal or not (any strength)
redio.getAnalogInput()   -- returns an integer from 0-15 of the redstone strength

event, state, strength, id = os.pullEvent("redstone")  -- pulls an event with 4 return values
-- event returns:  redstone
-- state returns true/false if there is redstone
-- strength returns an integer from 0-15 indicating the redstone strength
-- id returns the id of the peripheral the threw the event

How to install it?
Simply put the .jar file to your mods folder.

Download
V1.01 [MC 1.7.10][CC 1.73]: Click!

V1.0 [MC 1.7.10][CC 1.73]: Click!
Source code soon...

Changelog
- V1.0: Rebuild the original code and ported to MC 1.7.10.
- V1.01: Changed methods and event name for more matching Redstone API.

Thanks for NuchaZ
I put here a link to the old version if someone want the original source code. :)
Click!


Now this block is a part of FirePeripherals pack. See here: http://www.computerc...eripherals-v10/

Edited by FireHead996, 01 September 2015 - 01:06 AM.


#2 SquidDev

    Frickin' laser beams

  • Members
  • 1,406 posts
  • LocationDoes anyone put something serious here?

Posted 03 August 2015 - 06:16 PM

I like this: +1. It would be nice though if this followed method names to the default redstone API. So for instance, I think it should queue a redstone event as well - allowing both old and redstone API style methods would support backwards compatibility and similarity to vanilla CC. You might be able to use bundled cables as well if you hook into CC's methods with reflection.

#3 FireHead996

  • Members
  • 14 posts
  • LocationPoland

Posted 03 August 2015 - 11:02 PM

V1.01: Changed methods and event name for more matching Redstone API.

View PostSquidDev, on 03 August 2015 - 06:16 PM, said:

I like this: +1. It would be nice though if this followed method names to the default redstone API. So for instance, I think it should queue a redstone event as well - allowing both old and redstone API style methods would support backwards compatibility and similarity to vanilla CC. You might be able to use bundled cables as well if you hook into CC's methods with reflection.
I think about adding a bundled support but not in this block. I can add aditional block with ProjectRed API support. What you think?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users