Add betterbreeder, README
This commit is contained in:
parent
28822a9eae
commit
01f91f7ce6
5
README.md
Normal file
5
README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Salt's Minecraft Scripts
|
||||
|
||||
## Why?
|
||||
|
||||
After so many times rewriting the same goddamn scripts over and over again, you decide you should just plonk them in a git repo and call it good.
|
20
stoneblock-3-chicken-breeder/README.md
Normal file
20
stoneblock-3-chicken-breeder/README.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Stoneblock 3 Chicken Breeder
|
||||
|
||||
## Usage
|
||||
|
||||
Set up the turtle like so:
|
||||
|
||||
* Any tier mining turtle
|
||||
* Breeder on top
|
||||
* Chest in front
|
||||
* Chest on bottom
|
||||
* Seeds in inventory
|
||||
* Pair of chickens to 10/10/10 in inventory
|
||||
* Run betterbreeder.lua
|
||||
|
||||
The turtle will 10/10/10 a stack of chickens
|
||||
in the chest below, then stop.
|
||||
|
||||
## Compatibility
|
||||
|
||||
No clue. Try it on a pack that has the Chickens mod and see if it works.
|
93
stoneblock-3-chicken-breeder/betterbreeder.lua
Normal file
93
stoneblock-3-chicken-breeder/betterbreeder.lua
Normal file
@ -0,0 +1,93 @@
|
||||
-- See README for usage info
|
||||
function placeBreeder()
|
||||
print('Initializing breeder...')
|
||||
breeder = peripheral.wrap('top')
|
||||
-- Why are we discarding slot 2?
|
||||
-- Because, by design, it MUST be
|
||||
-- the trash chicken from the last
|
||||
-- generation.
|
||||
breeder.pushItems('bottom', 2)
|
||||
for i = 1, 16, 1 do
|
||||
turtle.select(i)
|
||||
turtle.suckUp()
|
||||
end
|
||||
turtle.digUp()
|
||||
selectItem('chickens:breeder')
|
||||
turtle.placeUp()
|
||||
selectItem('minecraft:wheat_seeds')
|
||||
turtle.dropUp()
|
||||
pushBestChickens()
|
||||
end
|
||||
|
||||
function selectItem(name)
|
||||
for i = 1, 16, 1 do
|
||||
if turtle.getItemDetail(i) then
|
||||
if turtle.getItemDetail(i).name == name then
|
||||
turtle.select(i)
|
||||
return i
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function pushBestChickens()
|
||||
print('Selecting best chickens...')
|
||||
chickens = 0
|
||||
index = nil
|
||||
for i = 16, 1, -1 do
|
||||
print('Checking index ' .. i)
|
||||
item = turtle.getItemDetail(i)
|
||||
if item then
|
||||
turtle.select(i)
|
||||
if not i == 1 then
|
||||
print('Discarding twin from breeding pair')
|
||||
turtle.dropDown(item.count - 1)
|
||||
end
|
||||
if item.name == 'chickens:chicken_item' then
|
||||
if item.count >= 16 then error('Done!') end
|
||||
for i = 1, item.count, 1 do
|
||||
if chickens == 0 then
|
||||
print('Inserting first chicken')
|
||||
turtle.dropUp(1)
|
||||
chickens = chickens + 1
|
||||
elseif chickens == 1 then
|
||||
print('Inserting second chicken')
|
||||
buffer = peripheral.wrap('front')
|
||||
turtle.drop(1)
|
||||
buffer.pushItems('top', 1, 16, 2)
|
||||
chickens = chickens + 1
|
||||
else
|
||||
print('Discarding chicken')
|
||||
turtle.dropDown()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function checkIfDone()
|
||||
output = peripheral.wrap('bottom')
|
||||
for i = 1, output.size(), 1 do
|
||||
if output.getItemDetail(i) then
|
||||
item = output.getItemDetail(i)
|
||||
if item.count == item.maxCount then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function main()
|
||||
print('Initializing...')
|
||||
while not checkIfDone() do
|
||||
print('Iterating...')
|
||||
placeBreeder()
|
||||
sleep()
|
||||
while peripheral.wrap('top').getItemDetail(4) == nil do sleep() end
|
||||
end
|
||||
print('Breeding complete')
|
||||
end
|
||||
|
||||
main()
|
Loading…
Reference in New Issue
Block a user