asdf
🧩 Syntax:
local arg1, arg2 = ...
stripMiner = {
position = { 0, 0, 0 },
orientation = "n",
usableInventorySlots = 14,
lavaEChestSlot = 15,
outputEChestSlot = 16,
}
function stripMiner:new(x, y, z, orientation)
self.__index = self
sM = {
position = { x, y, z },
usableInventorySlots = 15,
eChestSlot = 16,
orientation = orientation,
}
return setmetatable(sM, self)
end
function stripMiner:forward()
if turtle.forward() ~= true then
return false
end
if self.orientation == "n" then
self.position[2] = self.position[2] - 1
elseif self.orientation == "o" then
self.position[0] = self.position[0] + 1
elseif self.orientation == "s" then
self.position[2] = self.position[2] + 1
elseif self.orientation == "w" then
self.position[0] = self.position[0] - 1
end
end
function stripMiner:turnLeft()
if turtle.turnLeft() ~= false then
return false
end
if self.orientation == "n" then
self.orientation = "w"
elseif self.orientation == "o" then
self.orientation = "n"
elseif self.orientation == "s" then
self.orientation = "o"
elseif self.orientation == "w" then
self.orientation = "s"
end
end
function stripMiner:turnRight()
if turtle.turnRight() ~= false then
return false
end
if self.orientation == "n" then
self.orientation = "o"
elseif self.orientation == "o" then
self.orientation = "s"
elseif self.orientation == "s" then
self.orientation = "w"
elseif self.orientation == "w" then
self.orientation = "n"
end
end
function stripMiner:Up()
if turtle.up() == true then
self.position[1] = self.position[1] + 1
return true
end
return false
end
function stripMiner:Down()
if turtle.down() == true then
self.position[1] = self.position[1] - 1
return true
end
return false
end
function stripMiner:refuelAll()
turtle.getFuelLimit()
for i = 1, self.usableInventorySlots, 1 do
turtle.select(i)
if turtle.refuel() ~= true then
return false
end
end
end
function stripMiner:placeLavaEChest()
turtle.select(self.lavaEChestSlot)
if turtle.detect then
turtle.dig()
end
turtle.place()
end
function stripMiner:pickUpLavaEChest()
turtle.dig()
for i = 1, self.usableInventorySlots, 1 do
if turtle.getItemDetail() ~= nil then
if turtle.getItemDetail().name == "enderstorage:ender_storage" then
turtle.transferTo(self.lavaEChestSlot)
return true
end
end
end
return false
end
function stripMiner:loadLavaFromLavaEChest()
for i = 1, self.usableInventorySlots, 1 do
turtle.select(i)
if turtle.suck() ~= true then
return false
end
end
end
function stripMiner:unLoadEBucketsToLavaEChest()
for i = 1, self.usableInventorySlots, 1 do
turtle.select(i)
if turtle.getItemDetail() ~= nil then
if turtle.getItemDetail().name == "minecraft:bucket" then
turtle.drop()
end
end
end
end
function stripMiner:unloadInventory()
for i = 1, self.usableInventorySlots, 1 do
turtle.select(i)
if turtle.getItemDetail() ~= nil then
while turtle.drop() ~= true do
sleep(5)
end
end
end
end
function stripMiner:placeOutputEChest()
turtle.select(self.outputEChestSlot)
if turtle.detect then
turtle.dig()
end
turtle.place()
end
function stripMiner:pickUpOutputEChest()
turtle.dig()
for i = 1, self.usableInventorySlots, 1 do
if turtle.getItemDetail() ~= nil then
if turtle.getItemDetail().name == "enderstorage:ender_storage" then
turtle.transferTo(self.outputEChestSlot)
return true
end
end
end
return false
end
function stripMiner:inventoryIsEmpty()
for i = 1, self.usableInventorySlots, 1 do
turtle.select(i)
if turtle.getItemCount() > 0 then
return false
end
end
end
function stripMiner:getFuelLevel()
return turtle.getFuelLevel()
end
function stripMiner:getFuelLimit()
return turtle.getFuelLimit()
end
function stripMiner:dig()
return turtle.dig()
end
function stripMiner:digUp()
return turtle.digUp()
end
function stripMiner:digDown()
return turtle.digDown()
end
function stripMiner:mineLoop()
while true do
if self:getFuelLevel() < 1000 then self:refuelAllEChest() end
if self:getEmptyInventorySlots() < 3 then self:unloadInventoryToEChest() end
self:tunnel(3)
self:turnRight()
self:tunnel(5)
self:turnRight()
self:turnRight()
for i = 1, 5, 1 do
self:forward()
end
self:tunnel(5)
self:turnRight()
self:turnRight()
for i = 1, 5, 1 do
self:forward()
end
self:turnLeft()
end
end
function stripMiner:tunnel(length)
for i = 1, length, 1 do
self:dig()
self:forward()
self:digUp()
end
end
function stripMiner:getEmptyInventorySlots()
local amnt = 0
for i = 1, self.usableInventorySlots, 1 do
turtle.select(i)
if turtle.getItemCount() == 0 then
amnt = amnt + 1
end
end
return amnt
end
function stripMiner:refuelAllEChest()
sm:placeLavaEChest()
sm:loadLavaFromLavaEChest()
sm:refuelAll()
sm:unLoadEBucketsToLavaEChest()
sm:pickUpLavaEChest()
end
function stripMiner:unloadInventoryToEChest()
sm:placeOutputEChest()
sm:unloadInventory()
sm:pickUpOutputEChest()
end
function main()
sm = stripMiner:new(arg1, arg2)
sm:mineLoop()
end
main()