Edit2: Setup is much easier now with version 3. I believe turtle.dig() didn't used to auto pick up REC, which was fixed recently. I think I tried to use dig when I first wrote this, and it didn't work, but I might be wrong. Too lazy to check… If this doesn't work for you with and old TE, use version 2, or upgrade TE.
code:
http://pastebin.com/pkB1fNh7
or:
Spoiler
function TryPlace()
if not turtle.suckUp() then
return false
end
if not turtle.place() then
turtle.dropUp()
return false
end
return true
end
function TryBreak()
if not turtle.dig() then
return false
end
if not turtle.dropDown() then
return false
end
return true
end
args = {...}
if #args < 1 then
print("Usage: RECCharger in or RECCharger out")
return
end
s = tostring(args[1])
sleep(10)
while true do
if peripheral.call("right", "get")["Full Energy"] == nil then
TryPlace()
else
if (s == "in" and peripheral.call("right", "get")["Full Energy"] == true) or (s == "out" and peripheral.call("right", "get")["No Energy"] == true) then
TryBreak()
end
end
sleep(5)
end
This is a program I wrote to transport MJ over long distances/dimensions, using Redstone Energy Cells (REC), Gate Reader Engineering Turtles and two pairs of enderchests.
Mod requirements:
- Misc Peripherals
- Thermal Expansion
- Enderchest
The program involves at least 2 Gate Reader Engineering Turtles and 2 pairs of enderchests. You'll probably want at least 2 Redstone Energy Cells, but the system works with only 1. You start the program with a parameter (either "in" or "out"), which tells the turtle if it's working at a REC charging or discharging station respectively. At the charging station, the turtle dismantles any full REC in front of it, and places the REC into an (ender)chest under itself. At the discharging side it does the same with the empty cells. If there is no cell in front of it for any reason (the player can also manually remove cells, it shouldn't break the program), it tries to suck one down from an (ender)chest above, and place it in front.
The setup is really easy. You can make Gate Reader Engineering Turtles by crafting a normal turtle with a Gate Reader, to get a Gate Reader Turtle, then combine that with a Crescent Hammer.
I.) (Ender)Chest above the turtle, containing only REC. The turtles pull from here, so ideally you want empty cells at the recharging side, and full cells at the discharging side, but the program should be able to handle anything as long as there are only REC in those chests. An empty chest is also OK.
II.) (Ender)Chest bellow the turtle, containing only REC. You'll want to place the same colored enderchest here as the one above the turtle on the opposite side.
III.) REC always in front of the turtle. More than one REC next to the turtle may interfere
The turtle doesn't move, so no fuel is necessary.
Protips:
1: Make the turtles run this program on startup. The program shouldn't be able to break…
2: You can manually put in or take out your REC from the enderchests.
3: You can create multiple charging and recharging stations. The only reason I can think of which would cause problems is if an enderchest would get completly filled with RECs, so as long as you watch out for the total number of REC in the whole system, you can expand it as much as you want.
Why is my way better than…
…using only 1 set of enderchest?
The turtle has no good way of telling from a REC in item form if it's full or empty. So if you want to use only a single colored enderchest, you'll either have to do some sorting or at least introducing some constraints into your system. For me this makes things needlessly more complicated just to save on 8 blazerods and 2 enderpearls.
…using a single turtle with a turtle teleporter? (Direwolf20: Season 5 - Episode 24)
No fuel cost on any distance. Simultaneous charging and recharging. Program doesn't break if you quit at the wrong time. Program doesn't break in non-chunkloaded areas (it won't run obviously, unless you're there).
…using Thermal Expansions Tesseract?
Turtles have a 0% energy loss. Tesseracts have 25% by default.
Old version:
Spoiler
code:http://pastebin.com/mjFcUaR6
or:
Spoiler
function TryPlace()
if not turtle.suckDown() then
return false
end
if not turtle.place() then
turtle.dropDown()
return false
end
return true
end
function TryBreak()
if not turtle.attack() then
return false
end
redstone.setOutput("left", true)
sleep(0.3)
redstone.setOutput("left", false)
return true
end
args = {...}
if #args < 1 then
print("Usage: RECCharger in or RECCharger out")
return
end
s = tostring(args[1])
sleep(10)
while true do
if peripheral.call("right", "get")["Full Energy"] == nil then
TryPlace()
else
if s == "in" and peripheral.call("right", "get")["Full Energy"] == true then
TryBreak()
elseif s == "out" and peripheral.call("right", "get")["No Energy"] == true then
TryBreak()
end
end
sleep(5)
end
This is a program I wrote to transport MJ over long distances/dimensions, using Redstone Energy Cells (REC), Gate Reader Engineering Turtles and two pairs of enderchests.
There is a slight difficulty doing this, since the turtle can't automaticly pick up REC. Possibly a bug…
Mod requirements:
- Misc Peripherals
- Thermal Expansion
- Enderchest
- Redpower 2 is recommended
The new version is called RECCharger. It involves at least 2 Gate Reader Engineering Turtles, 2 pairs of enderchests and at least 2 Redstone Energy Cells. You start the program with a parameter (either "in" or "out"), which tells the turtle if he's working at the REC charging station, or the discharging station respectively. At the charging station, the turtle always tries to dismantle a full REC in front of him. At the discharging side he does the same with the empty cells. If there is no cell in front of him for any reason (the player can also manually remove cells, it shouldn't break the program), he tries to suck one up from a (ender)chest bellow him, and place it. If there is a cell that is neither full, nor empty (or empty at a charge station, or full at discharge station), the turtle waits for 5 seconds, then checks again.
The setup is really easy. You can make Gate Reader Engineering Turtles by crafting a normal turtle with a Gate Reader, to get a Gate Reader Turtle, then combine that with a Crescent Hammer.
I.) (Ender)Chest under the turtle, containing only REC. Ideally you want only empty cells at the recharging side, and full cells at the discharging side, but the program should be able to handle anything as long as there are only REC in those chests. An empty chest is also OK.
II.) REC always in front of the turtle. More than one REC next to the turtle may interfere
III.) The player is responsible for the (automatic) transportation of the dismantled REC from one location, to the chest under the turtle at the other location. The turtle help the player doing this by emitting a short redstone pulse from his left side, when he dismantles a REC.
Here is a very simple Charging and Recharging station:
There is a Redpower2 Transposer right under the REC, and jacketed wire connecting to it from the left side of the turtle. The redstone pulse activates the transposer right as the REC drops as an item. This makes the transposer collect the REC item 100% of the time, and puts it right into an enderchest under it. This enderchest is connected to the enderchest under the turtle at the other station.
The turtle doesn't move, so no fuel is necessary.
Protips:
1: Make the turtles run this program on startup. There is a 10 second delay after starting the program to avoid item (REC) loss in case the turtle dismantles a REC while your game still loading.
2: You can manually put in or take out your REC from the enderchests.
3: You can create multiple charging and recharging stations. The only reason I can think of which would cause problems is if an enderchest would get completly filled with RECs, so as long as you watch out for the total number of REC in the whole system, you can expand it as much as you want.
Old old version:
Spoiler
http://pastebin.com/kYzwB3T5Spoiler
function SwitchREC()if not turtle.attack() then
print "Couldn't dismantle the Redstone Energy Cell"
return false
end
sleep(1)
if not turtle.place() then
print "Couldn't place a Redstone Energy Cell"
return false
end
tries = 0
while not turtle.suckDown() do
sleep(1)
tries = tries + 1
if tries>10 then
print "Couldn't get the Redstone Energy Cell from the inventory under me"
return false
end
end
return true
end
function CheckRefuel()
if turtle.getFuelLevel() < 1000 then
print "Refueling"
turtle.select(2)
if not turtle.suckUp() then
print "Couldn't find any (fuel)items in the inventory above me"
return false
end
if not turtle.refuel() then
print "Couldn't use the items I got from the inventory above me to refuel"
return false
end
turtle.select(1)
end
return true
end
function Tele()
if not peripheral.call("back", "teleport") then
print "Teleporting failed"
return false
end
sleep(1)
return true
end
function WaitUntilFull()
print "Waiting for a full Redstone Energy Cell"
while not peripheral.call("right", "get")["Full Energy"] do
sleep(5)
end
end
function WaitUntilEmpty()
print "Waiting for an empty Redstone Energy Cell"
while not peripheral.call("right", "get")["No Energy"] do
sleep(5)
end
end
while true do
WaitUntilFull()
if not SwitchREC() then
break
end
if not CheckRefuel() then
break
end
if not Tele() then
break
end
WaitUntilEmpty()
if not SwitchREC() then
break
end
if not Tele() then
break
end
end
This is a program I wrote to transport MJ over long distances/dimensions, using Redstone Energy Cells (REC), a Gate Reader Engineering Turtle and a pair of Turtle Teleporters.
There is a slight difficulty doing this, since the turtle can't automaticly pick up REC. Possibly a bug…
Mod requirements:
- Misc Peripherals
- Thermal Expansion
- Redpower 2 is recommended
Turtle needs to be a Gate Reader Engineering Turtle. You can make those by crafting a normal turtle with a Gate Reader, to get a Gate Reader Turtle, then combine that with a Crescent Hammer.
Setup in both location needs to be the following:
1: Turtle teleporters behind the turtle, facing the turtle. Don't forget to link the teleporters both way with a redstone repeater in hand.
2: Redstone Energy Cells on the opposite side of the turte. Turtle is always facing the REC.
3: Empty Chests under the turtle.
4: The player is responsible for making the dropped REC get into this chest within 10 seconds. The easiest way of doing this is to have a Redpower Transposer directly under the REC, facing upwards. Then connect the undersides of the Transposer and the Chest with Pneumatic Tube. Provided that you enclose the whole system, the dropped REC item can't bounce anywhere except onto the Transposer, so you don't need to provide a redstone pulse.
5: Only at the charging side, there needs to be a Chest above the turtle containing only fuel.
6: Turtle starts at the charging side, having an empty REC in its inventory slot 1.
Details:
The turtle waits for a Redstone Energy Cell (REC) to charge fully at location A, while also having an empty one in its inventry (slot 1). When the REC is full, it breaks it, and places an empty one in its place. Then it waits for max 10 seconds for the dropped REC to appear in a chest bellow. It sucks it up, then teleports to location B. At location B, it waits until the 3rd REC (that's already placed) runs empty, then it replaces it with the one from its inventory and teleports back. And the loop starts over again.
This method minimizes the number of teleport uses by always waiting for a cell to completly fill/empty. Of course you need to have a 3rd REC to do this.
Refueling:
Only at the location A (where the REC is charging), from a chest above it. Only have fuel in that chest. It refuels with a whole stack once it gets bellow 5000 fuel. The turtle uses twice the distance between the teleporters as fuel. Depending on how long the distance is, this can be a LOT. 1000 block distance would mean 4000 fuel usage on one round (transporting 600.000 MJ). 4000 fuel is 50 coal, which would be 80.000 MJ in a sterling engine (if I calculate correctly), so decide it yourself if this is worth it or not. I'm planning to make a second edition of this, transporting multiple REC in one go, thus increasing efficiency.
Edit:
I just realised that you don't actually need to teleport the turtle! You could have 2 turtles, 1 in each end, just for dismantling and placing the Energy Cells. Then you could use an enderchest to transport them… Why don't I ever think of the cheap and easy way first???