Wiki 9Minecraft Silents Mechanisms Wiki
Silents Mechanisms WikiDocumentation › Cc: Tweaked (Computercraft) Compatibility

Cc: Tweaked (Computercraft) Compatibility

Silent's Mechanisms allows CC: Tweaked (ComputerCraft) computers to interact with many of its blocks. This includes battery boxes, generators, and processing machines (anything that has a redstone mode toggle in the interface). A list of redstone modes is included below for convenience.

Methods

  • getEnergy () - Gets the current amount of energy (FE) stored
  • getMaxEnergy () - Gets the maximum amount of energy (FE) that can be stored
  • getRedstoneMode () - Gets the current redstone response mode (IGNORED, ON, or OFF)
  • setRedstoneMode (mode) - Sets the redstone response mode
    • mode - Can be "IGNORED", "ON", or "OFF" (case insensitive)

Redstone Modes

  • IGNORED - Machine works regardless of redstone power received
  • ON - Machine works only when receiving redstone power
  • OFF - Machine works only when not receiving redstone power

Example

This script can be used to enable/disable generators based on the energy stored in a battery box. The values at the top can be modified to fit your setup. It assumes the generators' redstone mode is set to ON.

ENABLE_VALUE = 0.9
DISABLE_VALUE = 0.5
BATBOX_SIDE = "back"
REDSTONE_SIDE = "left"

batbox = peripheral.wrap(BATBOX_SIDE)

while (true)
do
    ratio = batbox.getEnergy() / batbox.getMaxEnergy()
    print(ratio)
    if (ratio < ENABLE_VALUE)
    then
        redstone.setOutput(REDSTONE_SIDE, true)
    elseif (ratio > DISABLE_VALUE)
    then
        redstone.setOutput(REDSTONE_SIDE, false)
    end
    
    os.sleep(30)
end