SHOW:
|
|
- or go back to the newest paste.
| 1 | os.setComputerLabel("farmer")
| |
| 2 | function farm() | |
| 3 | shell.run("clear")
| |
| 4 | print("Farm Programm by M3veronMast3r")
| |
| 5 | print("------------------------------")
| |
| 6 | print(" !!!-WORK IN PROGRESS-!!!")
| |
| 7 | - | print("Sent all Fails to +491748274510")
|
| 7 | + | print("Sent all Fails to https://everding.com/")
|
| 8 | end | |
| 9 | ||
| 10 | - | -- Settings -- |
| 10 | + | -- Default Settings -- (gets updated back to original as long as updater is on) |
| 11 | -- Use setup (remove chest from inv & reboot) to change value or turn off updater | |
| 12 | - | x= 9 |
| 12 | + | |
| 13 | x= 12 | |
| 14 | - | z= 10 |
| 14 | + | |
| 15 | z= 12 | |
| 16 | ||
| 17 | -- functions -- | |
| 18 | ||
| 19 | function setup() | |
| 20 | if fs.exists("farm_save") then
| |
| 21 | file=fs.open(farm_save") | |
| 22 | x=file.readLine() | |
| 23 | y=file.readLine() | |
| 24 | file.close() | |
| 25 | else | |
| 26 | file=fs.open("farm_save")
| |
| 27 | file.writeLine(x) | |
| 28 | file.writeLine(y) | |
| 29 | file.close() | |
| 30 | end | |
| 31 | - | while turtle.getItemCount(16) < 1 do |
| 31 | + | if turtle.getItemCount(16) < 1 then |
| 32 | shell.run("clear")
| |
| 33 | - | print("Need Chest in Slot 16")
|
| 33 | + | print("want to change default lenght:12 and default width:12?")
|
| 34 | print("write Y for yes or anything else for No")
| |
| 35 | write(">>: ")
| |
| 36 | text=read() | |
| 37 | if #tArgs(text) == 1 then | |
| 38 | if text == "Y" then | |
| 39 | print("x: ")
| |
| 40 | yx = tonumber(io.read) | |
| 41 | print("y: ")
| |
| 42 | yy = tonumber(io.read) | |
| 43 | print("Your set X="..yx.." and your set Y="..yy..". Is that Correct?")
| |
| 44 | print("write Y for yes or anything else for No")
| |
| 45 | write(">>: ")
| |
| 46 | text=read() | |
| 47 | if #tArgs(text) == 1 then | |
| 48 | if text == "Y" then | |
| 49 | y = yy | |
| 50 | x = yx | |
| 51 | file=fs.open("farm_save","w")
| |
| 52 | file.writeLine(x) | |
| 53 | file.writeLine(y) | |
| 54 | file.close() | |
| 55 | else | |
| 56 | setup() | |
| 57 | end | |
| 58 | else | |
| 59 | setup() | |
| 60 | end | |
| 61 | end | |
| 62 | end | |
| 63 | end | |
| 64 | end | |
| 65 | ||
| 66 | function forward() | |
| 67 | while not turtle.forward() do | |
| 68 | sleep(1) | |
| 69 | end | |
| 70 | end | |
| 71 | ||
| 72 | function back() | |
| 73 | while not turtle.back() do | |
| 74 | sleep(1) | |
| 75 | end | |
| 76 | end | |
| 77 | ||
| 78 | function reboot() | |
| 79 | if turtle.getItemCount(16) < 1 then | |
| 80 | setup() | |
| 81 | while turtle.getItemCount(16) < 1 do | |
| 82 | shell.run("clear")
| |
| 83 | print("Need Chest in Slot 16")
| |
| 84 | sleep(1) | |
| 85 | end | |
| 86 | end | |
| 87 | shell.run("clear")
| |
| 88 | print("starting Farm Programm..")
| |
| 89 | turtle.select(16) | |
| 90 | while not turtle.compare() do | |
| 91 | while not turtle.detect() do | |
| 92 | forward() | |
| 93 | end | |
| 94 | if turtle.compare() then | |
| 95 | else | |
| 96 | turtle.turnRight() | |
| 97 | end | |
| 98 | end | |
| 99 | turtle.turnRight() | |
| 100 | farm() | |
| 101 | end | |
| 102 | ||
| 103 | function check() | |
| 104 | if turtle.getItemCount(e) < 1 then | |
| 105 | while turtle.getItemCount(e) < 1 do | |
| 106 | e=e+1 | |
| 107 | if e > 15 then | |
| 108 | e=1 | |
| 109 | turtle.select(e) | |
| 110 | return | |
| 111 | end | |
| 112 | end | |
| 113 | end | |
| 114 | turtle.select(e) | |
| 115 | end | |
| 116 | ||
| 117 | function drop() | |
| 118 | for i=5,15 do | |
| 119 | turtle.select(i) | |
| 120 | turtle.drop() | |
| 121 | end | |
| 122 | end | |
| 123 | -- functions end -- | |
| 124 | reboot() | |
| 125 | e=1 | |
| 126 | r=0 | |
| 127 | r2=0 | |
| 128 | f=0 | |
| 129 | check() | |
| 130 | if turtle.getItemCount(e) < 1 then | |
| 131 | if not fs.exists("farmfirststart") then
| |
| 132 | shell.run("clear")
| |
| 133 | print("Need some Potatoes or Carrots for first start. Continue if you inserted some or planted")
| |
| 134 | print("")
| |
| 135 | write("Press ENTER to continue")
| |
| 136 | read() | |
| 137 | fs.open("farmfirststart","w")
| |
| 138 | farm() | |
| 139 | end | |
| 140 | end | |
| 141 | while true do | |
| 142 | while z > 0 do | |
| 143 | while x > 0 do | |
| 144 | check() | |
| 145 | if turtle.detectDown() then | |
| 146 | local success, block = turtle.inspectDown() | |
| 147 | if block.name == "minecraft:potatoes" then | |
| 148 | if block.state.age > 6 then | |
| 149 | turtle.digDown("left")
| |
| 150 | turtle.placeDown() | |
| 151 | end | |
| 152 | elseif block.name == "minecraft:carrots" then | |
| 153 | if block.state.age > 6 then | |
| 154 | turtle.digDown("left")
| |
| 155 | turtle.placeDown() | |
| 156 | end | |
| 157 | end | |
| 158 | else | |
| 159 | turtle.digDown("left")
| |
| 160 | turtle.placeDown() | |
| 161 | end | |
| 162 | if x > 1 then | |
| 163 | forward() | |
| 164 | end | |
| 165 | x=x-1 | |
| 166 | r2=r2+1 | |
| 167 | end | |
| 168 | while r2 > 0 do | |
| 169 | x=x+1 | |
| 170 | r2=r2-1 | |
| 171 | end | |
| 172 | r=r+1 | |
| 173 | z=z-1 | |
| 174 | if z > 0 then | |
| 175 | if f < 1 then | |
| 176 | turtle.turnRight() | |
| 177 | forward() | |
| 178 | turtle.turnRight() | |
| 179 | f=1 | |
| 180 | elseif f > 0 then | |
| 181 | turtle.turnLeft() | |
| 182 | forward() | |
| 183 | turtle.turnLeft() | |
| 184 | f=0 | |
| 185 | end | |
| 186 | end | |
| 187 | end | |
| 188 | turtle.turnRight() | |
| 189 | while r > 0 do | |
| 190 | if r > 1 then | |
| 191 | forward() | |
| 192 | end | |
| 193 | r=r-1 | |
| 194 | z=z+1 | |
| 195 | end | |
| 196 | drop() | |
| 197 | turtle.turnRight() | |
| 198 | f=0 | |
| 199 | sleep(3300) | |
| 200 | end | |
| 201 |