Create Crafts & Additions
The electric blocks of Create Crafts & Additions driven by a computer: motors set to a speed or an angle, accumulators and relays read, and a digital adapter that writes on Display Links and works the Create blocks around it.
The blocks of this page come from Create Crafts & Additions. Without that mod, they do not exist, and peripheral.find("electric_motor") returns nil.
Crafts & Additions brings electricity to Create, as Forge Energy (FE): alternators make it from rotation, wires carry it, accumulators store it, and electric motors turn it back into rotation. A computer connected to these blocks sets the speed of a motor, turns a servo to an exact angle, watches the charge of an accumulator, and through the digital adapter writes on Display Boards and drives the Create blocks around it, up to calling an elevator.
| Block (in game) | peripheral type | what it reads or sets |
|---|---|---|
| Electric Motor | electric_motor | sets its speed; how much energy it uses; how long a move takes |
| Servo Motor | servo_motor | turns a structure to an angle set by redstone; sets its angles |
| Accumulator | modular_accumulator | the energy stored in the whole accumulator |
| Portable Energy Interface | portable_energy_interface | the energy of the contraption docked to it |
| Redstone Relay | redstone_relay | the energy it lets through, and whether redstone opens it |
| Digital Adapter | digital_adapter | 16 lines for a Display Link; the Create blocks on its sides |
| Electric Pump | electric_pump | sets its pumping strength |
| Blaze Burner with Straw | liquid_blaze_burner | its heat, and how long its fuel keeps it burning |
Reaching a block. Against the computer a block is called by its side ("left", "top"...); on a Data Cable (Minicomputer and newer) it gets a name such as electric_motor@12,64,-30. The easiest is peripheral.find with the type of the table. See Peripherals.
local motor = peripheral.find("electric_motor")
local acc = peripheral.find("modular_accumulator")
if acc.percent() > 20 then
motor.set_speed(128)
else
motor.stop() -- save the last of the charge
endThe first six blocks of the table also have ComputerCraft peripherals in Crafts & Additions itself. The methods here are the same ones, in Brass naming: getSpeed() becomes speed(), setTargetAngle(a) becomes set_target_angle(a), isAssembled() becomes assembled(), hasElevatorArrived(side) becomes elevator_arrived(side). What differs: elevator floors are numbered from 1 (from 0 there), an unknown side of the digital adapter is an error (not north), and a speed or an angle out of range is brought back into range instead of stopping the program. The Electric Pump and the Blaze Burner with Straw are added by Computing Ages.
Each call reads the block again, so a value is always fresh and a wrapped block never goes stale. When something is wrong, the call stops the program with an error you can catch with pcall:
| error | when |
|---|---|
electric motor removed | the block was broken or replaced since peripheral.wrap: also servo motor removed, accumulator removed, portable energy interface removed, redstone relay removed, digital adapter removed, electric pump removed, liquid blaze burner removed |
peripheral is not loaded | the chunk of the block is not loaded |
bad argument #1 to 'set_speed' (...) | a wrong argument: the message says what was expected |
this version of Create Crafts & Additions has no ... | your version of the mod lacks what the method reads (the name at the end is the one missing) |
Create Crafts & Additions error: ... | the block itself failed while answering |
Also kinetic, energy and tank blocks. The Electric Motor, the Servo Motor and the Electric Pump are Create machines, so they also have the methods of Create kinetic blocks: stress(), capacity(), overstressed(). But their own speed() and set_speed() come first and hide the kinetic ones: **speed() is the speed set on the block**, not the speed of its shaft, and active() tells whether it really runs. Every block of the mod that holds FE (both motors, the pump, the accumulator, the interface) is also an Energy blocks block, with energy() and energy_capacity(): for a motor or the pump, the energy in its own buffer (5000 FE by default). Mind the two capacity(): on a motor it is the stress capacity of its kinetic network (SU), on an accumulator its energy capacity (FE). The Blaze Burner with Straw is also a Tanks: tank.tanks() reads the fuel waiting in it.
Units. Speeds in RPM, angles in degrees, distances in blocks, durations in seconds, energy in FE, transfer rates in FE per tick (20 ticks a second). Numbers come rounded to 3 decimals. The limits quoted on this page are the defaults of Crafts & Additions' settings (motor_rpm_range...), which a server may change.
motor.speed() | The speed set on the motor's value box, in RPM. It is the setting, not a measure: the motor gives it only while it runs (electric_motor.active()). It hides the kinetic.speed() of other kinetic blocks; to read the shaft itself, wrap a Speedometer or another block of the same network. |
motor.set_speed(rpm) | Sets the motor's speed, like turning its value box. It is kept between -256 and 256 RPM, and taken at the motor's next tick. An infinite number stops the program with bad argument #1 to 'set_speed' (speed must be a finite number). |
motor.stop() | Sets the speed to 0, like set_speed(0): the motor stops and uses no more energy. The speed stays 0 until a program or a player sets another one. |
motor.active() | true while the motor runs: it has the energy for its speed and no redstone signal powers it. false when its buffer ran short or redstone stops it: its shaft then stands still, whatever speed() says. A motor stopped for lack of energy starts again by itself once its buffer holds twice what it uses in a tick. |
motor.stress_capacity() | The stress capacity the motor adds to its network for each RPM: 64 SU. Times the speed, it is what the motor gives. |
motor.energy_consumption() | The energy the motor uses per tick at its speed, whether it runs or not: 480 FE per tick at 256 RPM, in proportion below (120 at 64 RPM), never under 8; 0 at speed 0. Engineer's Goggles show the same number. |
motor.rotate(degrees [, rpm]) | The time a Mechanical Bearing driven by this motor takes to turn by degrees. With rpm, the motor is first set to that speed, positive for a positive angle and negative for a negative one; without, the time is for the speed already set. The motor does not stop by itself: sleep for the time returned, then stop it. 0 when the speed is under 0.1 RPM. |
motor.translate(blocks [, rpm]) | The same as rotate, for a Mechanical Piston, a Rope Pulley or a Gantry Carriage driven by the motor: they move rpm / 512 blocks per tick. With rpm, the speed is set first, its sign following the way asked. |
motor.max_insert() | How fast the motor's buffer can fill, 5000 FE per tick: a transfer limit, not what it uses. |
motor.max_extract() | The FE per tick the motor gives out: always 0, a motor gives no energy back. |
servo.speed() | The speed set on the servo's value box, in RPM: how fast it turns towards its angle. Like the electric motor's, it is the setting, and it hides kinetic.speed(). |
servo.set_speed(rpm) | Sets the speed the servo turns at, kept between -256 and 256 RPM, at the end of the tick. The servo turns towards its angle whatever the sign. An infinite number stops the program with bad argument #1 to 'set_speed' (speed must be a finite number). |
servo.active() | true while the servo has the energy for its speed. Only then does it read its redstone and turn: a servo out of energy stays where it is. Redstone does not stop it (redstone is its angle). |
servo.energy_consumption() | The same rule as the electric motor (electric_motor.energy_consumption()): 480 FE per tick at 256 RPM, never under 8. The servo uses all of it while it turns, a tenth while it holds its structure still. |
servo.angle() | The angle the structure is at now: 0 where it was assembled, positive towards the max angle, negative towards the min angle. |
servo.target_angle() | The angle the redstone asks for: max angle × signal / 15 for a signal on the top face, min angle × signal / 15 (negative) on the bottom face. The servo turns until servo_motor.angle() gets there. It is worked out again at the servo's next tick after a change of redstone or of limits, and only while it is active. |
servo.min_angle() | The min angle, read as a negative number: the "Min Angle" box shows 90, min_angle() gives -90. |
servo.max_angle() | The max angle, in degrees: 90 for a new servo. |
servo.set_min_angle(degrees) | Sets how far the bottom face turns the servo, like its "Min Angle" box: 45 and -45 both give a min angle of -45. Whole degrees, at most 180, applied at the end of the tick. |
servo.set_max_angle(degrees) | Sets the max angle, like the "Max Angle" box: whole degrees, at most 180, applied at the end of the tick. With 180, each redstone step turns the servo 12 degrees further. |
servo.set_target_angle(degrees) | Sets both limits so that a full redstone signal turns the servo to degrees. For a positive angle, the max angle becomes degrees and the min angle 0: a signal of 15 on the top face. For a negative angle, the min angle becomes -degrees and the max angle 0: a signal of 15 on the bottom face. It does not turn the servo by itself, the redstone does. Whole degrees, kept between -180 and 180, applied at the end of the tick. |
servo.assembled() | true while the structure is assembled (turning or held), false while it is blocks. In the default movement mode, it turns false once the servo reaches its max or min angle. |
servo.assemble() | Assembles the blocks in front of the servo into a structure, like a Mechanical Bearing, at its next tick. Does nothing when it is already assembled. When Create refuses (nothing to carry, too many blocks), assembled() stays false. |
servo.disassemble() | Puts the structure back as blocks, at the end of the tick. Does nothing when it is not assembled. |
acc.energy() | The energy stored in the whole accumulator, in FE, whichever block of it is wrapped. |
acc.capacity() | The energy the whole accumulator holds when full: its number of blocks times 2,000,000 FE. Unlike the capacity() of a kinetic block, it is energy, not stress. |
acc.percent() | How full it is, in whole percent rounded down (100 only when full), as the "Percentage" of a Display Link shows it. |
acc.width() | The width of the accumulator (it is as deep as it is wide), from 1 to 3. |
acc.height() | The height of the accumulator, from 1 to 5. |
acc.max_insert() | 5000 FE per tick: how fast it can charge. |
acc.max_extract() | 5000 FE per tick: how fast it can discharge. |
pei.energy() | The energy of the accumulators on the contraption docked to the interface, in FE. 0 while no contraption is there. |
pei.capacity() | The capacity of the accumulators on the docked contraption. With energy(), how full the train is: |
pei.connected() | true while a contraption is docked and connected to the interface. |
pei.max_insert() | 5000 FE per tick. |
pei.max_extract() | 5000 FE per tick. |
relay.throughput() | The energy going from the input side to the output side, in FE per tick. 0 while the relay is not powered, or when the output side needs nothing. |
relay.powered() | true while redstone powers the relay, that is while it lets energy through. |
relay.max_insert() | The limit Crafts & Additions gives for the relay, that of a Small Connector: 1000 FE per tick. |
relay.max_extract() | 1000 FE per tick, like max_insert. |
da.print(text) | Writes text on the current line, in place of what was there, then moves to the next line. After line 16 it stays on line 16: each new print replaces that last line. |
da.clear_line() | Empties the current line. The current line does not move. |
da.clear() | Empties the 16 lines. The current line does not move: set_line(1) to write from the top again. |
da.line() | The current line, where the next print writes: 1 for a new adapter. |
da.set_line(n) | Makes line n the current line. A number outside 1 to 16 is not taken: the line stays where it was, and the call returns that line. |
da.max_lines() | Always 16. |
da.target_speed(side) | The target speed of the Rotation Speed Controller on that side: the speed of its large cogwheel, as set on its value box. |
da.set_target_speed(side, rpm) | Sets the target speed of the Rotation Speed Controller on that side, like turning its value box. It is kept within the server's top speed (digital_adapter.kinetic_top_speed()) and applied at the end of the program's tick. A number with decimals stops the program with bad argument #2 to 'set_target_speed' (number has no integer representation). |
da.kinetic_speed(side) | The speed of the Speedometer's shaft, negative when it turns the other way. |
da.kinetic_stress(side) | The stress the machines of the Stressometer's network draw, as its dial shows it. |
da.kinetic_capacity(side) | What the sources of the Stressometer's network give. |
da.kinetic_top_speed() | Create's top speed, 256 RPM unless the server changed it. No side: it is the same everywhere. |
da.pulley_distance(side) | How far a Rope Pulley, a Hose Pulley or an Elevator Pulley on that side has gone down from where it hangs. |
da.piston_distance(side) | How far the Mechanical Piston on that side has pushed its structure out. |
da.bearing_angle(side) | The angle a Mechanical Bearing or a Windmill Bearing on that side has turned its structure, within one turn. |
da.duration_angle(degrees, rpm) | The time a bearing turning at rpm takes to turn by degrees, one tick of margin included: the same count as the electric motor's rotate, without a motor. No side. |
da.duration_distance(blocks, rpm) | The time a piston, a pulley or a gantry driven at rpm takes to move blocks: rpm / 512 blocks per tick. |
da.elevator_floor(side) | The floor the elevator is heading for, or stands at once arrived. 0 when there is no assembled elevator on that side, or when it has no floor to go to. |
da.elevator_arrived(side) | true once the elevator is within half a block of its floor; false while it moves, or without elevator. |
da.elevator_floors(side) | How many Elevator Contacts its column has. |
da.elevator_floor_name(side, floor) | The short name set on the floor's Elevator Contact ("G", "2"...), the one the elevator's controls show. nil past the last floor, below 1, or without elevator. |
da.goto_elevator_floor(side, floor) | Calls the elevator to that floor, like a player choosing it in the elevator, at the end of the program's tick. Returns the distance from the floor it was heading for to the new one, in blocks, positive up and negative down. 0 when the floor does not exist or the elevator cannot reach it (nothing is called then), or when it is already going there. |
pump.speed() | The pumping strength set on the pump's value box. It is the setting, not a measure: the pump uses it only while it runs (electric_pump.active()). It hides kinetic.speed(). |
pump.set_speed(rpm) | Sets the pumping strength, like the value box: kept between 0 and 256, applied at the end of the tick. 0 stops the pump. A number with decimals stops the program with bad argument #1 to 'set_speed' (number has no integer representation). |
pump.active() | true while the pump runs: a strength above 0, the energy it needs, and no redstone signal. |
pump.energy_consumption() | The energy the pump uses per tick at its strength: 120 FE per tick at 256, in proportion down to 15 FE per tick at 32, and 15 below that; 0 at strength 0. |
burner.heat() | The heat of the burner, with the names of Create's Blaze Burner: "smouldering" while no fuel burns (the blaze idles), "kindled" with a normal fuel (heated), "fading" when that fuel has under 6.25 seconds left, "seething" with a superheating fuel. The list of Create also has "none", an empty Blaze Burner: this one always has its blaze. |
burner.burn_time() | How long the burner keeps its heat with the fuel already taken, in seconds, without the fuel waiting in its tank. When a superheating fuel runs out, the burner goes on kindled for 250 seconds. 0 for a burner fed a Creative Blaze Cake, which burns for ever. |
Electric Motor
The Electric Motor turns FE into rotation: it drives its shaft at the speed of its value box, from -256 to 256 RPM. It runs while it has the energy for that speed (it starts once its buffer holds twice what it uses in a tick) and no redstone signal powers it: a redstone signal stops it, without changing its speed. It gives 64 SU of stress capacity per RPM, 16384 SU at 256 RPM.
A new speed is taken at the motor's next tick: speed() read in the same tick still gives the old one. The value box keeps the speed after the program ends.
motor.speed()
The speed set on the motor's value box, in RPM. It is the setting, not a measure: the motor gives it only while it runs (electric_motor.active()). It hides the kinetic.speed() of other kinetic blocks; to read the shaft itself, wrap a Speedometer or another block of the same network.
- number
- the speed set on the motor, in RPM, negative for the other way
local motor = peripheral.find("electric_motor")
if motor.active() then
print("turning at " .. motor.speed() .. " RPM")
else
print("set to " .. motor.speed() .. " RPM, but stopped")
endSee also electric_motor.set_speed() electric_motor.active() kinetic.speed()
motor.set_speed(rpm)
Sets the motor's speed, like turning its value box. It is kept between -256 and 256 RPM, and taken at the motor's next tick. An infinite number stops the program with bad argument #1 to 'set_speed' (speed must be a finite number).
rpmnumber- the new speed in RPM, negative to turn the other way
motor.set_speed(64)
motor.set_speed(-32) -- the other waymotor.stop()
Sets the speed to 0, like set_speed(0): the motor stops and uses no more energy. The speed stays 0 until a program or a player sets another one.
See also electric_motor.set_speed()
motor.active()
true while the motor runs: it has the energy for its speed and no redstone signal powers it. false when its buffer ran short or redstone stops it: its shaft then stands still, whatever speed() says. A motor stopped for lack of energy starts again by itself once its buffer holds twice what it uses in a tick.
- boolean
- true while the motor runs
if not motor.active() then
print("Motor stopped, " .. motor.energy() .. " FE in its buffer")
endSee also electric_motor.speed() energy.energy()
motor.stress_capacity()
The stress capacity the motor adds to its network for each RPM: 64 SU. Times the speed, it is what the motor gives.
- number
- the stress capacity the motor gives per RPM, in SU
print(motor.stress_capacity() * math.abs(motor.speed()) .. " SU")See also kinetic.capacity()
motor.energy_consumption()
The energy the motor uses per tick at its speed, whether it runs or not: 480 FE per tick at 256 RPM, in proportion below (120 at 64 RPM), never under 8; 0 at speed 0. Engineer's Goggles show the same number.
- number
- the FE per tick the motor uses at the speed set
How long an accumulator keeps the motor running:
local acc = peripheral.find("modular_accumulator")
local per_second = motor.energy_consumption() * 20
if per_second > 0 then
print(math.floor(acc.energy() / per_second) .. " s of running left")
endSee also modular_accumulator.energy()
motor.rotate(degrees [, rpm])
The time a Mechanical Bearing driven by this motor takes to turn by degrees. With rpm, the motor is first set to that speed, positive for a positive angle and negative for a negative one; without, the time is for the speed already set. The motor does not stop by itself: sleep for the time returned, then stop it. 0 when the speed is under 0.1 RPM.
degreesnumber- how far the bearing should turn, in degrees; with rpm, its sign gives the way
rpmnumber optional- the speed to set first, in RPM (its sign is ignored)
- number
- the time the turn takes, in seconds
The time is right when nothing between the motor and the bearing changes the speed (no gearing up or down); it counts one tick of margin.
local t = motor.rotate(90, 32) -- 0.519 s
sleep(t)
motor.stop()See also electric_motor.translate() digital_adapter.duration_angle()
motor.translate(blocks [, rpm])
The same as rotate, for a Mechanical Piston, a Rope Pulley or a Gantry Carriage driven by the motor: they move rpm / 512 blocks per tick. With rpm, the speed is set first, its sign following the way asked.
blocksnumber- how far the piston, the pulley or the gantry should move, in blocks; with rpm, its sign gives the way
rpmnumber optional- the speed to set first, in RPM (its sign is ignored)
- number
- the time the move takes, in seconds
local t = motor.translate(5, 64) -- 2 s
sleep(t)
motor.stop()See also electric_motor.rotate() digital_adapter.duration_distance()
motor.max_insert()
How fast the motor's buffer can fill, 5000 FE per tick: a transfer limit, not what it uses.
- number
- the most FE per tick the motor takes in
motor.max_extract()
The FE per tick the motor gives out: always 0, a motor gives no energy back.
- number
- always 0
Servo Motor
The Servo Motor is an electric motor and a Mechanical Bearing in one block: it assembles the blocks in front of it into a structure, turns it to an exact angle, and holds it there. The angle comes from redstone:
- a signal on its top face (the face with the "Max Angle" value box: the top when the servo faces sideways) turns it to
max angle × signal / 15; - a signal on its bottom face (the "Min Angle" box) turns it the other way, to
min angle × signal / 15, read back as a negative angle; - both at once subtract: equal signals cancel out.
Both limits are 90 degrees for a new servo. A signal that arrives assembles the structure if needed. The servo turns towards its angle at its speed (32 RPM for a new servo, 192 degrees a second), and only while it has energy: all its consumption while it turns, a tenth while it holds still.
Its movement mode is that of a Mechanical Bearing. "Always Place when Stopped", the default, puts the structure back as blocks once it reaches its max or min angle; "Only Place near Initial Angle" once it is back at 0; "Only Place when Anchor Destroyed" keeps it assembled, which is usually what a program wants.
Driving it from a computer. The program sets the limits, then gives the redstone: rs.set on the side of the computer that touches the servo's top face, or a Redstone Link next to it (see link). Redstone has 16 steps: with set_max_angle(180), each step is 12 degrees. For any whole angle, servo_motor.set_target_angle() and a full signal. A new speed, limit or target is applied at the end of the program's tick, and the servo reads its redstone again at its next tick: a new limit counts at once, without waiting for the redstone to change.
servo.speed()
The speed set on the servo's value box, in RPM: how fast it turns towards its angle. Like the electric motor's, it is the setting, and it hides kinetic.speed().
- number
- the speed set on the servo, in RPM
local servo = peripheral.find("servo_motor")
print(servo.speed())servo.set_speed(rpm)
Sets the speed the servo turns at, kept between -256 and 256 RPM, at the end of the tick. The servo turns towards its angle whatever the sign. An infinite number stops the program with bad argument #1 to 'set_speed' (speed must be a finite number).
rpmnumber- the new speed, in whole RPM (decimals are dropped)
servo.set_speed(64) -- 384 degrees a secondSee also servo_motor.speed()
servo.active()
true while the servo has the energy for its speed. Only then does it read its redstone and turn: a servo out of energy stays where it is. Redstone does not stop it (redstone is its angle).
- boolean
- true while the servo has the energy to work
servo.energy_consumption()
The same rule as the electric motor (electric_motor.energy_consumption()): 480 FE per tick at 256 RPM, never under 8. The servo uses all of it while it turns, a tenth while it holds its structure still.
- number
- the FE per tick the servo uses while it turns, at the speed set
print(servo.energy_consumption(), "FE/t")servo.angle()
The angle the structure is at now: 0 where it was assembled, positive towards the max angle, negative towards the min angle.
- number
- the angle of the structure now, in degrees
See also servo_motor.target_angle()
servo.target_angle()
The angle the redstone asks for: max angle × signal / 15 for a signal on the top face, min angle × signal / 15 (negative) on the bottom face. The servo turns until servo_motor.angle() gets there. It is worked out again at the servo's next tick after a change of redstone or of limits, and only while it is active.
- number
- the angle the servo turns to, in degrees
Wait until the structure is there:
while math.abs(servo.angle() - servo.target_angle()) > 0.5 do
sleep(0.1)
end
print("in place")servo.min_angle()
The min angle, read as a negative number: the "Min Angle" box shows 90, min_angle() gives -90.
- number
- the angle a full signal on the bottom face turns it to, from -180 to 0
print(servo.min_angle(), servo.max_angle()) -- -90 and 90 for a new servoSee also servo_motor.set_min_angle()
servo.max_angle()
The max angle, in degrees: 90 for a new servo.
- number
- the angle a full signal on the top face turns it to, from 0 to 180
See also servo_motor.set_max_angle()
servo.set_min_angle(degrees)
Sets how far the bottom face turns the servo, like its "Min Angle" box: 45 and -45 both give a min angle of -45. Whole degrees, at most 180, applied at the end of the tick.
degreesnumber- how far a full signal on the bottom face turns it, from 0 to 180 (the sign is ignored)
servo.set_min_angle(45)See also servo_motor.min_angle()
servo.set_max_angle(degrees)
Sets the max angle, like the "Max Angle" box: whole degrees, at most 180, applied at the end of the tick. With 180, each redstone step turns the servo 12 degrees further.
degreesnumber- how far a full signal on the top face turns it, from 0 to 180 (the sign is ignored)
servo.set_max_angle(180)
rs.set("bottom", 5) -- the computer sits on the servo's top face: 60 degreesSee also servo_motor.max_angle()
servo.set_target_angle(degrees)
Sets both limits so that a full redstone signal turns the servo to degrees. For a positive angle, the max angle becomes degrees and the min angle 0: a signal of 15 on the top face. For a negative angle, the min angle becomes -degrees and the max angle 0: a signal of 15 on the bottom face. It does not turn the servo by itself, the redstone does. Whole degrees, kept between -180 and 180, applied at the end of the tick.
degreesnumber- the angle a full signal should turn it to, from -180 to 180
local servo = peripheral.find("servo_motor")
servo.set_target_angle(-45) -- a full signal on the bottom face now turns it to -45A door on a servo, opened and closed by the computer that sits on the servo's top face:
local servo = peripheral.find("servo_motor")
servo.set_target_angle(90)
rs.set("bottom", 15) -- open: turn to 90
sleep(5)
rs.set("bottom", 0) -- close: back to 0See also servo_motor.target_angle() servo_motor.set_max_angle()
servo.assembled()
true while the structure is assembled (turning or held), false while it is blocks. In the default movement mode, it turns false once the servo reaches its max or min angle.
- boolean
- true while the servo carries an assembled structure
if not servo.assembled() then
servo.assemble()
endSee also servo_motor.assemble()
servo.assemble()
Assembles the blocks in front of the servo into a structure, like a Mechanical Bearing, at its next tick. Does nothing when it is already assembled. When Create refuses (nothing to carry, too many blocks), assembled() stays false.
servo.disassemble()
Puts the structure back as blocks, at the end of the tick. Does nothing when it is not assembled.
See also servo_motor.assemble()
Accumulator
The Accumulator stores FE: 2,000,000 FE per block. Blocks placed together form one accumulator, up to 3 wide and 5 high. Connectors and wires bring energy in and take it out, and it also pushes energy into the blocks above and below it. Any block of it answers for the whole accumulator.
acc.energy()
The energy stored in the whole accumulator, in FE, whichever block of it is wrapped.
- number
- the FE held by the whole accumulator
local acc = peripheral.find("modular_accumulator")
print(acc.energy() .. " / " .. acc.capacity() .. " FE")See also modular_accumulator.capacity() modular_accumulator.percent()
acc.capacity()
The energy the whole accumulator holds when full: its number of blocks times 2,000,000 FE. Unlike the capacity() of a kinetic block, it is energy, not stress.
- number
- the most FE the accumulator holds
See also modular_accumulator.energy()
acc.percent()
How full it is, in whole percent rounded down (100 only when full), as the "Percentage" of a Display Link shows it.
- number
- how full the accumulator is, a whole number from 0 to 100
local acc = peripheral.find("modular_accumulator")
rs.set("top", acc.percent() < 10) -- a lamp when the charge runs lowSee also modular_accumulator.energy()
acc.width()
The width of the accumulator (it is as deep as it is wide), from 1 to 3.
- number
- the width of the accumulator, in blocks
print(acc.width() .. " x " .. acc.width() .. " x " .. acc.height())acc.height()
The height of the accumulator, from 1 to 5.
- number
- the height of the accumulator, in blocks
acc.max_insert()
5000 FE per tick: how fast it can charge.
- number
- the most FE per tick the accumulator takes in
acc.max_extract()
5000 FE per tick: how fast it can discharge.
- number
- the most FE per tick the accumulator gives out
Portable Energy Interface
The Portable Energy Interface is Create's Portable Storage Interface for energy. One rides on a contraption (a train, a minecart contraption, a piston...), another stands in the world. When the contraption stops in front of the fixed one, they connect, and energy flows through the fixed interface into or out of the accumulators the contraption carries. The computer wraps the fixed one.
pei.energy()
The energy of the accumulators on the contraption docked to the interface, in FE. 0 while no contraption is there.
- number
- the FE in the accumulators of the contraption docked to it; 0 when none
local pei = peripheral.find("portable_energy_interface")
if pei.connected() then
print(pei.energy() .. " FE on board")
endpei.capacity()
The capacity of the accumulators on the docked contraption. With energy(), how full the train is:
- number
- the most FE the accumulators of the docked contraption hold; 0 when none
local cap = pei.capacity()
if cap > 0 then
print("train charged at " .. math.floor(pei.energy() / cap * 100) .. " %")
endpei.connected()
true while a contraption is docked and connected to the interface.
- boolean
- true while a contraption is docked to the interface
while not pei.connected() do
sleep(0.5)
end
print("a train is charging")pei.max_insert()
5000 FE per tick.
- number
- the most FE per tick the interface takes in
pei.max_extract()
5000 FE per tick.
- number
- the most FE per tick the interface gives out
Redstone Relay
The Redstone Relay joins two wire networks: energy goes from its input connector to its output connector, but only while a redstone signal powers it. A computer next to it opens and closes it with rs.set, and its peripheral reads what goes through.
relay.throughput()
The energy going from the input side to the output side, in FE per tick. 0 while the relay is not powered, or when the output side needs nothing.
- number
- the FE per tick going through the relay now
local relay = peripheral.find("redstone_relay")
print(relay.throughput() .. " FE/t")See also redstone_relay.powered()
relay.powered()
true while redstone powers the relay, that is while it lets energy through.
- boolean
- true while a redstone signal powers the relay
rs.set("left", true) -- the relay is on the left of the computer
sleep(0.1)
print(relay.powered(), relay.throughput())relay.max_insert()
The limit Crafts & Additions gives for the relay, that of a Small Connector: 1000 FE per tick.
- number
- the most FE per tick the relay takes in
relay.max_extract()
1000 FE per tick, like max_insert.
- number
- the most FE per tick the relay gives out
Digital Adapter: lines for a Display Link
The Digital Adapter does nothing on its own: a computer works through it. Its first job is 16 lines of text that a Display Link shows. Put a Display Link against the adapter, with "Digital Adapter" as its source, and point it at a Display Board, a sign, Nixie Tubes... It shows the adapter's lines at its next update.
print writes a line and moves to the next one, like a printer; set_line goes back to a given line. Crafts & Additions does not save the lines: after a restart they are empty until the program writes them again. (A computer is a Display Link source by itself too: see display and Display Link and nixie tubes.)
da.print(text)
Writes text on the current line, in place of what was there, then moves to the next line. After line 16 it stays on line 16: each new print replaces that last line.
textstring- the text of the line, cut at 128 characters
local da = peripheral.find("digital_adapter")
da.clear()
da.set_line(1)
da.print("Hello")
da.print("second line")da.clear_line()
Empties the current line. The current line does not move.
da.set_line(2)
da.clear_line()See also digital_adapter.clear()
da.clear()
Empties the 16 lines. The current line does not move: set_line(1) to write from the top again.
See also digital_adapter.clear_line()
da.line()
The current line, where the next print writes: 1 for a new adapter.
- number
- the line print writes on, from 1 to 16
da.set_line(n)
Makes line n the current line. A number outside 1 to 16 is not taken: the line stays where it was, and the call returns that line.
nnumber- a whole number from 1 to 16
- number
- the current line after the call
da.set_line(1)
da.print("Title")da.max_lines()
Always 16.
- number
- the number of lines, 16
Digital Adapter: the Create blocks around it
The adapter's second job is the Create blocks on its six sides: it reads a Speedometer, a Stressometer, a pulley, a Mechanical Piston or a bearing, and reads and sets a Rotation Speed Controller. The gauges and the controller are peripherals on their own too (Create machines); the adapter adds the pulleys, the piston and the bearings, and one adapter serves up to six blocks.
A side is a direction of the world. The adapter has no front, so its sides are named by their direction: "north", "south", "east", "west", "up" (or "top"), "down" (or "bottom"), in upper or lower case. The F3 screen shows which way you face. Any other name stops the program with bad argument #1 to 'kinetic_speed' (a side: north, south, east, west, up or down). When the block on that side is not of the right kind, or not loaded, a reading gives 0 and a setting does nothing.
da.target_speed(side)
The target speed of the Rotation Speed Controller on that side: the speed of its large cogwheel, as set on its value box.
sidestring- "north", "south", "east", "west", "up" or "down"
- number
- the speed set on the Rotation Speed Controller on that side, in RPM; 0 without one
print(da.target_speed("north"))See also digital_adapter.set_target_speed()
da.set_target_speed(side, rpm)
Sets the target speed of the Rotation Speed Controller on that side, like turning its value box. It is kept within the server's top speed (digital_adapter.kinetic_top_speed()) and applied at the end of the program's tick. A number with decimals stops the program with bad argument #2 to 'set_target_speed' (number has no integer representation).
sidestring- "north", "south", "east", "west", "up" or "down"
rpmnumber- the new target speed, a whole number of RPM, negative for the other way
da.set_target_speed("north", 64)See also digital_adapter.target_speed() speed_controller.set_target_speed()
da.kinetic_speed(side)
The speed of the Speedometer's shaft, negative when it turns the other way.
sidestring- "north", "south", "east", "west", "up" or "down"
- number
- the speed the Speedometer on that side shows, in RPM; 0 without one
print(da.kinetic_speed("up"), "RPM")da.kinetic_stress(side)
The stress the machines of the Stressometer's network draw, as its dial shows it.
sidestring- "north", "south", "east", "west", "up" or "down"
- number
- the stress used on the network of the Stressometer on that side, in SU; 0 without one
print(da.kinetic_stress("up") .. " / " .. da.kinetic_capacity("up") .. " SU")See also digital_adapter.kinetic_capacity()
da.kinetic_capacity(side)
What the sources of the Stressometer's network give.
sidestring- "north", "south", "east", "west", "up" or "down"
- number
- the stress capacity of the network of the Stressometer on that side, in SU; 0 without one
See also digital_adapter.kinetic_stress()
da.kinetic_top_speed()
Create's top speed, 256 RPM unless the server changed it. No side: it is the same everywhere.
- number
- the fastest speed Create allows on the server, in RPM
da.pulley_distance(side)
How far a Rope Pulley, a Hose Pulley or an Elevator Pulley on that side has gone down from where it hangs.
sidestring- "north", "south", "east", "west", "up" or "down"
- number
- how far the pulley on that side is lowered, in blocks; 0 without one
print(da.pulley_distance("east"), "blocks")da.piston_distance(side)
How far the Mechanical Piston on that side has pushed its structure out.
sidestring- "north", "south", "east", "west", "up" or "down"
- number
- how far the Mechanical Piston on that side is out, in blocks; 0 without one
da.bearing_angle(side)
The angle a Mechanical Bearing or a Windmill Bearing on that side has turned its structure, within one turn.
sidestring- "north", "south", "east", "west", "up" or "down"
- number
- the angle of the bearing on that side, in degrees; 0 without one
print(da.bearing_angle("up"), "degrees")da.duration_angle(degrees, rpm)
The time a bearing turning at rpm takes to turn by degrees, one tick of margin included: the same count as the electric motor's rotate, without a motor. No side.
degreesnumber- the angle to turn, in degrees (its sign is ignored)
rpmnumber- the speed of the bearing, in RPM (its sign is ignored)
- number
- the time the turn takes, in seconds; 0 under 0.1 RPM
print(da.duration_angle(90, 32)) -- 0.519See also electric_motor.rotate()
da.duration_distance(blocks, rpm)
The time a piston, a pulley or a gantry driven at rpm takes to move blocks: rpm / 512 blocks per tick.
blocksnumber- the distance to move, in blocks (its sign is ignored)
rpmnumber- the speed of the piston, the pulley or the gantry, in RPM (its sign is ignored)
- number
- the time the move takes, in seconds; 0 under 0.1 RPM
print(da.duration_distance(10, 64)) -- 4See also electric_motor.translate()
Digital Adapter: elevators
A Create elevator is an Elevator Pulley carrying a structure with an Elevator Contact; the Elevator Contacts along its column are its floors. With the adapter against the Elevator Pulley, a program knows the floors, where the elevator goes, and calls it to another floor, like a player choosing a floor inside. Floors are numbered from 1, the lowest first. The elevator must be assembled, and it needs rotation to move.
da.elevator_floor(side)
The floor the elevator is heading for, or stands at once arrived. 0 when there is no assembled elevator on that side, or when it has no floor to go to.
sidestring- the side the Elevator Pulley is on: "north", "south", "east", "west", "up" or "down"
- number
- the floor the elevator goes to or stands at, from 1; 0 without elevator
print("floor " .. da.elevator_floor("down"))See also digital_adapter.elevator_arrived()
da.elevator_arrived(side)
true once the elevator is within half a block of its floor; false while it moves, or without elevator.
sidestring- the side the Elevator Pulley is on
- boolean
- true once the elevator is at its floor
while not da.elevator_arrived("down") do
sleep(0.2)
endda.elevator_floors(side)
How many Elevator Contacts its column has.
sidestring- the side the Elevator Pulley is on
- number
- the number of floors of the elevator; 0 without elevator
da.elevator_floor_name(side, floor)
The short name set on the floor's Elevator Contact ("G", "2"...), the one the elevator's controls show. nil past the last floor, below 1, or without elevator.
sidestring- the side the Elevator Pulley is on
floornumber- the floor, a whole number from 1
- string|nil
- the short name of that floor; nil when there is no such floor
for i = 1, da.elevator_floors("down") do
print(i, da.elevator_floor_name("down", i))
endda.goto_elevator_floor(side, floor)
Calls the elevator to that floor, like a player choosing it in the elevator, at the end of the program's tick. Returns the distance from the floor it was heading for to the new one, in blocks, positive up and negative down. 0 when the floor does not exist or the elevator cannot reach it (nothing is called then), or when it is already going there.
sidestring- the side the Elevator Pulley is on
floornumber- the floor to go to, a whole number from 1
- number
- how far the elevator goes, in blocks, positive up; 0 when it cannot go there
A call panel: an Analog Lever on the left of the computer picks the floor (1 to 15), the adapter is on the Elevator Pulley. The program sleeps until the lever moves.
local da = peripheral.find("digital_adapter")
local SIDE = "down" -- the Elevator Pulley is under the adapter
while true do
local wanted = rs.get("left")
if wanted >= 1 and wanted <= da.elevator_floors(SIDE) then
local blocks = da.goto_elevator_floor(SIDE, wanted)
print("to " .. da.elevator_floor_name(SIDE, wanted) .. ": " .. blocks .. " blocks")
end
os.pull_event("redstone")
endSee also digital_adapter.elevator_arrived() digital_adapter.elevator_floor()
Electric Pump
The Electric Pump is a Mechanical Pump that runs on FE instead of rotation: it moves fluid along its pipes as a Mechanical Pump would at the speed of its value box, its pumping strength, from 0 to 256. The fluid goes the way of its arrow, which a Wrench reverses. It pumps while it has the energy and no redstone signal powers it. Computing Ages adds this peripheral: Crafts & Additions has no ComputerCraft one for the pump.
pump.speed()
The pumping strength set on the pump's value box. It is the setting, not a measure: the pump uses it only while it runs (electric_pump.active()). It hides kinetic.speed().
- number
- the pumping strength set on the pump, from 0 to 256
local pump = peripheral.find("electric_pump")
print(pump.speed())pump.set_speed(rpm)
Sets the pumping strength, like the value box: kept between 0 and 256, applied at the end of the tick. 0 stops the pump. A number with decimals stops the program with bad argument #1 to 'set_speed' (number has no integer representation).
rpmnumber- the new pumping strength, a whole number from 0 to 256
pump.set_speed(128)
pump.set_speed(0) -- stopSee also electric_pump.speed()
pump.active()
true while the pump runs: a strength above 0, the energy it needs, and no redstone signal.
- boolean
- true while the pump runs
print(pump.active())pump.energy_consumption()
The energy the pump uses per tick at its strength: 120 FE per tick at 256, in proportion down to 15 FE per tick at 32, and 15 below that; 0 at strength 0.
- number
- the FE per tick the pump uses at its strength
print(pump.energy_consumption(), "FE/t")Blaze Burner with Straw
A Blaze Burner given a Straw becomes a Blaze Burner with Straw: it burns liquid fuels, poured in with a bucket or by pipes, and heats the Basin or the Fluid Tank above it like a Blaze Burner. It burns 100 mB of fuel at a time into its heat store, whenever that store holds less than 500 seconds of burning; the rest of the fuel waits in its tank (tank.tanks()). Computing Ages adds this peripheral.
burner.heat()
The heat of the burner, with the names of Create's Blaze Burner: "smouldering" while no fuel burns (the blaze idles), "kindled" with a normal fuel (heated), "fading" when that fuel has under 6.25 seconds left, "seething" with a superheating fuel. The list of Create also has "none", an empty Blaze Burner: this one always has its blaze.
- string
- "smouldering", "fading", "kindled" or "seething"
local burner = peripheral.find("liquid_blaze_burner")
if burner.heat() == "seething" then
print("Superheated")
endSee also liquid_blaze_burner.burn_time()
burner.burn_time()
How long the burner keeps its heat with the fuel already taken, in seconds, without the fuel waiting in its tank. When a superheating fuel runs out, the burner goes on kindled for 250 seconds. 0 for a burner fed a Creative Blaze Cake, which burns for ever.
- number
- the seconds the fuel already in the heat store keeps the burner burning
local burner = peripheral.find("liquid_blaze_burner")
local fuel = burner.tanks()[1]
if burner.burn_time() < 60 and fuel.amount < 100 then
print("fuel runs out in " .. math.floor(burner.burn_time()) .. " s")
endExample: an accumulator kept charged
A complete little program for a power room: steam engines drive a Rotation Speed Controller, which turns an Alternator that charges an Accumulator. A Digital Adapter touches the controller on its north side, and a Display Link against the adapter shows its lines on a Display Board. The computer reaches the accumulator and the adapter by Data Cable.
Below half charge the alternator turns at full speed; above, slower and slower as the accumulator fills, and it stops when it is full, so the engines do not work for nothing.
local acc = peripheral.find("modular_accumulator")
local da = peripheral.find("digital_adapter")
local SIDE = "north" -- the Rotation Speed Controller, seen from the adapter
local TOP = da.kinetic_top_speed()
while true do
local pct = acc.percent()
-- full speed below 50 %, then down to 0 at 100 %
local rpm = math.floor(TOP * math.min(1, (100 - pct) / 50))
da.set_target_speed(SIDE, rpm)
da.clear()
da.set_line(1)
da.print("Accumulator " .. pct .. " %")
da.print(math.floor(acc.energy() / 1000) .. " / " .. math.floor(acc.capacity() / 1000) .. " kFE")
da.print("Alternator " .. rpm .. " RPM")
sleep(2)
end