📁 1
📄 bak.chest.lua
📄 bak.custom
--[[ laden mit os.loadAPI("custom") ]]
--[[function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
]]
--[[function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS-Koordinaten:")
print("X: " .. x .. " Y: " .. y .. " Z: " .. z)
gpsPos = {
x = x,
y = y,
z = z
}
turtle.forward()
local x2,y2,z2 = gps.locate(5)
if x2 > x then
richtung = "Osten"
print("Ich schaue nach " .. richtung)
elseif x2 < x then
richtung = "Westen"
print("Ich schaue nach " .. richtung)
elseif z2 > z then
richtung = "Sueden"
print("Ich schaue nach " .. richtung)
elseif z2 < z then
richtung = "Norden"
print("Ich schaue nach " .. richtung)
end
turtle.back()
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
]]
function gpsStart(richtungTest)
local x,y,z = gps.locate(5)
if x then
print("GPS-Koordinaten:")
print("X: " .. x .. " Y: " .. y .. " Z: " .. z)
gpsPos = {
x = x,
y = y,
z = z
}
if richtungTest then
if turtle.forward() then
local x2,y2,z2 = gps.locate(5)
if x2 > x then
richtung = "Osten"
elseif x2 < x then
richtung = "Westen"
elseif z2 > z then
richtung = "Sueden"
elseif z2 < z then
richtung = "Norden"
end
turtle.back()
else
turtle.back()
local x2,y2,z2 = gps.locate(5)
if x2 > x then
richtung = "Westen"
elseif x2 < x then
richtung = "Osten"
elseif z2 > z then
richtung = "Norden"
elseif z2 < z then
richtung = "Sueden"
end
turtle.forward()
end
print("Ich schaue nach " .. richtung)
end
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function detect(richtung)
local result = false
if richtung == "df" then
result = turtle.detect()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
end
return result
end
--[[function inspect(richtung)
local result = false
if richtung == "if" then
result = turtle.inspect()
elseif richtung == "ib" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.inspect()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "il" then
turtle.turnLeft()
result = turtle.inspect()
turtle.turnRight()
elseif richtung == "ir" then
turtle.turnRight()
result = turtle.inspect()
turtle.turnLeft()
elseif richtung == "iu" then
result = turtle.inspectUp()
elseif richtung == "id" then
result = turtle.inspectDown()
end
return result
end]]
function inspect(richtung)
local erkannt = false
local block = nil
if richtung == "if" then
erkannt, block = turtle.inspect()
elseif richtung == "ib" then
turtle.turnLeft()
turtle.turnLeft()
erkannt, block = turtle.inspect()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "il" then
turtle.turnLeft()
erkannt, block = turtle.inspect()
turtle.turnRight()
elseif richtung == "ir" then
turtle.turnRight()
erkannt, block = turtle.inspect()
turtle.turnLeft()
elseif richtung == "iu" then
erkannt, block = turtle.inspectUp()
elseif richtung == "id" then
erkannt, block = turtle.inspectDown()
end
return erkannt, block
end
function suck(richtung)
local result = false
if richtung == "sf" then
result = turtle.suck()
elseif richtung == "sb" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.suck()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "sl" then
turtle.turnLeft()
result = turtle.suck()
turtle.turnRight()
elseif richtung == "sr" then
turtle.turnRight()
result = turtle.suck()
turtle.turnLeft()
elseif richtung == "su" then
result = turtle.suckUp()
elseif richtung == "sd" then
result = turtle.suckDown()
end
return result
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pb" then
turtle.turnLeft()
turtle.turnLeft()
turtle.place()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
--[[
=================================================
SEITLICHE AKTIONEN
Universelle Drehfunktion.
left:
turnLeft()
Aktion
turnRight()
right:
turnRight()
Aktion
turnLeft()
back:
turnLeft()
turnLeft()
Aktion
turnRight()
turnRight()
Die Turtle endet immer wieder
in ihrer ursprünglichen Ausrichtung.
=================================================
]]
function side(richtung, aktion)
if richtung == "left" then
turtle.turnLeft()
aktion()
turtle.turnRight()
elseif richtung == "right" then
turtle.turnRight()
aktion()
turtle.turnLeft()
elseif richtung == "back" then
turtle.turnLeft()
turtle.turnLeft()
aktion()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "front" then
aktion()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
side("right", digForward)
elseif richtung == "dl" then
side("left", digForward)
elseif richtung == "db" then
side("back", digForward)
end
end
--[[function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
side("right", turtle.place)
elseif richtung == "pl" then
side("left", turtle.place)
end
end]]
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 bak.test.lua
local seite = "front"
local dateiname = "methoden_test.txt"
local datei = fs.open(dateiname, "w")
datei.writeLine("=== PERIPHERAL METHOD TEST ===")
datei.writeLine("")
datei.writeLine("Seite: " .. seite)
datei.writeLine("Typ: " .. tostring(peripheral.getType(seite)))
datei.writeLine("")
local methoden = peripheral.getMethods(seite)
for i = 1, #methoden do
local methode = methoden[i]
datei.writeLine("================================")
datei.writeLine("Methode: " .. methode)
datei.writeLine("================================")
local erfolg, a, b, c, d = pcall(
peripheral.call,
seite,
methode
)
if erfolg then
datei.writeLine("Aufruf erfolgreich.")
datei.writeLine("Wert 1: " .. tostring(a))
if b ~= nil then
datei.writeLine("Wert 2: " .. tostring(b))
end
if c ~= nil then
datei.writeLine("Wert 3: " .. tostring(c))
end
if d ~= nil then
datei.writeLine("Wert 4: " .. tostring(d))
end
else
datei.writeLine("Aufruf fehlgeschlagen:")
datei.writeLine(tostring(a))
end
datei.writeLine("")
end
datei.close()
print("Test abgeschlossen.")
print("Ergebnis: " .. dateiname)
📄 baum.lua
--[[local function chop()
turtle.select(2)
turtle.place()
turtle.select(3)
for i = 1,6 do turtle.place() end
turtle.select(1)
if turtle.compare(1) then turtle.dig() turtle.forward() end
while turtle.compareUp(1) do turtle.digUp() turtle.up() end
while not turtle.detectDown() do turtle.down() end
turtle.back()
end
for i = 1,10 do chop() end
]]
turtle.dig() --holz landet in slot(1)...
turtle.forward()
-- solange der block über dir identisch ist mit slot(1)...
while turtle.compareUp(1) do
turtle.digUp()
turtle.up()
end
while not turtle.detectDown() do
turtle.down()
end
turtle.back()
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 blocks2.lua
return {
{
name = "minecraft:grass",
},
{
name = "minecraft:log",
},
{
name = "minecraft:stone",
},
{
name = "minecraft:planks",
},
{
name = "minecraft:dirt",
},
{
name = "minecraft:chest",
},
{
name = "minecraft:gold_ingot",
},
{
name = "minecraft:iron_block",
},
{
name = "ThermalFoundation:material",
},
{
name = "TConstruct:materials",
},
{
name = "Thaumcraft:ItemResource",
},
{
name = "minecraft:diamond",
},
{
name = "Botania:flower",
},
{
name = "ThermalExpansion:material",
},
{
name = "minecraft:iron_ingot",
},
{
name = "ThermalExpansion:Frame",
},
{
name = "MineFactoryReloaded:rubberwood.log",
},
{
name = "minecraft:ladder",
},
{
name = "Natura:redwood",
},
{
name = "minecraft:arrow",
},
{
name = "minecraft:stick",
},
{
name = "minecraft:oak_stairs",
},
{
name = "minecraft:wooden_axe",
},
{
name = "minecraft:trapdoor",
},
{
name = "minecraft:wooden_door",
},
{
name = "minecraft:crafting_table",
},
{
name = "minecraft:wooden_slab",
},
{
name = "minecraft:egg",
},
{
name = "minecraft:wool",
},
{
name = "minecraft:quartz_stairs",
},
{
name = "minecraft:glowstone",
},
{
name = "minecraft:coal_ore",
},
{
name = "minecraft:leaves",
},
{
name = "minecraft:red_flower",
},
{
name = "minecraft:stone_shovel",
},
{
name = "minecraft:flowing_water",
},
{
name = "minecraft:flint",
},
{
name = "BiomesOPlenty:flowers",
},
{
name = "minecraft:lever",
},
{
name = "minecraft:glowstone_dust",
},
{
name = "red_flower",
},
{
name = "stone_shovel",
},
{
name = "glowstone",
},
{
name = "flowing_water",
},
{
name = "flint",
},
{
name = "flower",
},
{
name = "flowers",
},
{
name = "lever",
},
{
name = "glowstone_dust",
},
{
name = "leather",
},
{
name = "bone",
},
{
name = "string",
},
{
name = "feather",
},
{
name = "slime_ball",
},
{
name = "wheat",
},
{
name = "reeds",
},
{
name = "dye",
},
{
name = "rotten_flesh",
},
{
name = "poisonous_potato",
},
{
name = "yellow_flower",
},
{
name = "sapling",
},
{
name = "florasapling",
},
{
name = "wheat_seeds",
},
{
name = "waterlily",
},
{
name = "mushrooms",
},
{
name = "mushroom",
},
{
name = "confusingDust",
},
{
name = "apatite",
},
{
name = "itemTreetap",
},
{
name = "rubber.raw",
},
{
name = "BerryBush",
},
{
name = "barley.seed",
},
{
name = "berry",
},
{
name = "ItemShard",
},
{
name = "ItemZombieBrain",
},
{
name = "item.ItemMultiMaterial",
},
{
name = "garlic",
},
{
name = "seedsartichoke",
},
{
name = "seedsbelladonna",
},
{
name = "seedsmandrake",
},
{
name = "seedswolfsbane",
},
{
name = "ItemResource",
},
{
name = "plants",
},
{
name = "coral2",
},
{
name = "material",
},
{
name = "potion",
},
{
name = "skull",
},
{
name = "egg",
},
{
name = "carrot",
},
{
name = "cooked_chicken",
},
{
name = "chicken",
},
{
name = "baked_potato",
},
{
name = "brown_mushroom",
},
{
name = "potato",
},
{
name = "cooked_porkchop",
},
{
name = "apple",
},
{
name = "porkchop",
},
{
name = "coal_block",
},
{
name = "cobblestone",
},
{
name = "dirt",
},
{
name = "stone",
},
{
name = "stonebrick",
},
{
name = "stone_stairs",
},
{
name = "cobblestone_compressed",
},
{
name = "ExtraUtilities:generator",
},
{
name = "minecraft:cobblestone",
},
{
name = "ThermalExpansion:Cell",
},
{
name = "wool",
},
{
name = "item.buildcraftPipe.pipeitemsgold",
},
{
name = "microblock",
},
{
name = "chickenChunkLoader",
},
{
name = "golden_hoe",
},
{
name = "CC-Cable",
},
{
name = "engineBlock",
},
{
name = "log",
},
{
name = "Cell",
},
{
name = "item.buildcraftPipe.pipeitemswood",
},
{
name = "planks",
},
{
name = "CC-Computer",
},
{
name = "CC-Peripheral",
},
{
name = "slab",
},
{
name = "wooden_slab",
},
{
name = "gravel",
},
{
name = "water_bucket",
},
{
name = "furnace",
},
{
name = "water",
},
{
name = "marble",
},
{
name = "torch",
},
{
name = "ItemThaumonomicon",
},
{
name = "iron_ingot",
},
{
name = "gold_ingot",
},
{
name = "materials",
},
{
name = "BRIngot",
},
{
name = "projectred.core.part",
},
{
name = "itemIngot",
},
{
name = "emerald",
},
{
name = "redstone",
},
{
name = "diamond",
},
{
name = "dimensionalShardItem",
},
{
name = "flint_and_steel",
},
{
name = "enderFragment",
},
{
name = "ender_pearl",
},
{
name = "CraftedSoil",
},
{
name = "slime.gel",
},
{
name = "saddle",
},
{
name = "ItemHelmetCultistPlate",
},
{
name = "strangeFood",
},
{
name = "hay_block",
},
{
name = "ItemLeggingsCultistPlate",
},
{
name = "barleyFood",
},
{
name = "blockRubWood",
},
{
name = "Rare Tree",
},
{
name = "tree",
},
{
name = "projectred.exploration.stone",
},
{
name = "blockMagicalLog",
},
{
name = "natura.stick",
},
{
name = "spruce_stairs",
},
{
name = "log2",
},
{
name = "blockWoodenDevice",
},
{
name = "stair.sakura",
},
{
name = "magma_cream",
},
{
name = "Glowshroom",
},
{
name = "nether_wart",
},
{
name = "soul_sand",
},
{
name = "ingredient",
},
{
name = "ghast_tear",
},
{
name = "impmeat",
},
{
name = "misc",
},
{
name = "Dark Tree",
},
{
name = "Cloud",
},
{
name = "nether_brick",
},
{
name = "blaze_rod",
},
{
name = "grave",
},
{
name = "netherrack",
},
{
name = "bopBucket",
},
{
name = "book",
},
{
name = "ItemWispEssence",
},
{
name = "spider_eye",
},
{
name = "arrow",
},
{
name = "itemBrokenSpawner",
},
{
name = "obsidian",
},
{
name = "blockCosmeticSolid",
},
{
name = "unknownDimlet",
},
{
name = "tile.BlockSkyStone",
},
{
name = "sequencerBlock",
},
{
name = "itemAlloy",
},
{
name = "piston",
},
{
name = "track",
},
{
name = "machine.beta",
},
{
name = "machine.alpha",
},
{
name = "dimensionalBlankBlock",
},
{
name = "dimensionalCross2Block",
},
{
name = "redstone_lamp",
},
{
name = "part.rail",
},
{
name = "rail",
},
{
name = "tnt_minecart",
},
{
name = "concrete",
},
{
name = "brick",
},
{
name = "sand",
},
{
name = "clay_ball",
},
{
name = "stone_slab",
},
{
name = "broadsword",
},
{
name = "glass",
},
{
name = "coal",
},
{
name = "ore.berries.two",
},
{
name = "ore.berries.one",
},
{
name = "glass_pane",
},
{
name = "lava_bucket",
},
{
name = "CastingChannel",
},
{
name = "Smeltery",
},
{
name = "granite",
},
{
name = "cobblestone_wall",
},
{
name = "gold_ore",
},
{
name = "iron_ore",
},
{
name = "blockOreUran",
},
{
name = "Ore",
},
}
📄 bum.lua
local note1 = peripheral.wrap("front")
local note2 = peripheral.wrap("right")
note1.setPitch(12)
note2.setPitch(16)
for i = 1, 5 do
note1.triggerNote()
sleep(0.3)
note2.triggerNote()
sleep(0.3)
end
📄 chest_test.txt
Peripheral-Typ:
chest
Methoden:
getInventoryName
pullItem
expandStack
condenseItems
getStackInSlot
listSources
getInventorySize
swapStacks
destroyStack
pushItemIntoSlot
getAdvancedMethodsData
pullItemIntoSlot
listMethods
doc
pushItem
getAllStacks
Methoden mit Parametern:
condenseItems()
destroyStack(slotNumber)
doc(method)
expandStack(stack)
getAdvancedMethodsData(method?)
getAllStacks(proxy?)
getInventoryName()
getInventorySize()
getStackInSlot(slotNumber
proxy?)
listMethods(filterSource?)
listSources()
pullItem(direction
slot
maxAmount?
intoSlot?)
pullItemIntoSlot(direction
slot
maxAmount?
intoSlot?)
pushItem(direction
slot
maxAmount?
intoSlot?)
pushItemIntoSlot(direction
slot
maxAmount?
intoSlot?)
swapStacks(from
to
fromDirection?
fromDirection?)
📄 craft.lua
--[[turtle.select(1)
if turtle.craft() then
print("Holz wurde zu Planken verarbeitet.")
else
print("Crafting fehlgeschlagen.")
end
]]
local chest = peripheral.wrap(devices.chstfr.site)
chest.pushItems(peripheral.getName(turtle), 5, 32, 1)
📄 crystal_doc.txt
Peripheral-Typ:
crystal
Methoden:
================================
getInventoryName
================================
function():string -- Get the name of this inventory
================================
pullItem
================================
function(direction:string{DOWN,UP,NORTH,SOUTH,WEST,EAST,UNKNOWN},slot:number,maxAmount:number?,intoSlot:number?):number -- Pull an item from a slot in another inventory into a slot in this one. Returns the amount of items moved
================================
expandStack
================================
function(stack:{id:string,dmg:number?,qty:number?,...}):table -- Get full stack information from id and/or damage
================================
condenseItems
================================
function() -- Condense and tidy the stacks in an inventory
================================
getStackInSlot
================================
function(slotNumber:number,proxy:boolean?):object -- Get details of an item in a particular slot
================================
listSources
================================
function():table -- List all method sources
================================
getInventorySize
================================
function():number -- Get the size of this inventory
================================
swapStacks
================================
function(from:number,to:number,fromDirection:string{DOWN,UP,NORTH,SOUTH,WEST,EAST,UNKNOWN}?,fromDirection:string{DOWN,UP,NORTH,SOUTH,WEST,EAST,UNKNOWN}?) -- Swap two slots in the inventory
================================
destroyStack
================================
function(slotNumber:number) -- Destroy a stack
================================
pushItemIntoSlot
================================
function(direction:string{DOWN,UP,NORTH,SOUTH,WEST,EAST,UNKNOWN},slot:number,maxAmount:number?,intoSlot:number?):number -- Push an item from the current inventory into slot on the other one. Returns the amount of items moved
================================
getAdvancedMethodsData
================================
function(method:string?):table -- Get a complete table of information about all available methods
================================
pullItemIntoSlot
================================
function(direction:string{DOWN,UP,NORTH,SOUTH,WEST,EAST,UNKNOWN},slot:number,maxAmount:number?,intoSlot:number?):number -- Pull an item from a slot in another inventory into a slot in this one. Returns the amount of items moved
================================
listMethods
================================
function(filterSource:string?):string -- List all the methods available
================================
doc
================================
function(method:string):string -- Brief description of method
================================
pushItem
================================
function(direction:string{DOWN,UP,NORTH,SOUTH,WEST,EAST,UNKNOWN},slot:number,maxAmount:number?,intoSlot:number?):number -- Push an item from the current inventory into slot on the other one. Returns the amount of items moved
================================
getAllStacks
================================
function(proxy:boolean?):table -- Get a table with all the items of the chest
📄 crystal_test.txt
=== CRYSTAL CHEST TEST ===
Peripheral-Typ:
crystal
Inventargröße:
108
Slot 1:
table: 20b54f15
Methoden:
getInventoryName
pullItem
expandStack
condenseItems
getStackInSlot
listSources
getInventorySize
swapStacks
destroyStack
pushItemIntoSlot
getAdvancedMethodsData
pullItemIntoSlot
listMethods
doc
pushItem
getAllStacks
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
--[[function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
]]
--[[function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS-Koordinaten:")
print("X: " .. x .. " Y: " .. y .. " Z: " .. z)
gpsPos = {
x = x,
y = y,
z = z
}
turtle.forward()
local x2,y2,z2 = gps.locate(5)
if x2 > x then
richtung = "Osten"
print("Ich schaue nach " .. richtung)
elseif x2 < x then
richtung = "Westen"
print("Ich schaue nach " .. richtung)
elseif z2 > z then
richtung = "Sueden"
print("Ich schaue nach " .. richtung)
elseif z2 < z then
richtung = "Norden"
print("Ich schaue nach " .. richtung)
end
turtle.back()
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
]]
function gpsStart(richtungTest)
local x,y,z = gps.locate(5)
if x then
print("GPS-Koordinaten:")
print("X: " .. x .. " Y: " .. y .. " Z: " .. z)
gpsPos = {
x = x,
y = y,
z = z
}
if richtungTest then
if turtle.forward() then
local x2,y2,z2 = gps.locate(5)
if x2 > x then
richtung = "Osten"
elseif x2 < x then
richtung = "Westen"
elseif z2 > z then
richtung = "Sueden"
elseif z2 < z then
richtung = "Norden"
end
turtle.back()
else
turtle.back()
local x2,y2,z2 = gps.locate(5)
if x2 > x then
richtung = "Westen"
elseif x2 < x then
richtung = "Osten"
elseif z2 > z then
richtung = "Norden"
elseif z2 < z then
richtung = "Sueden"
end
turtle.forward()
end
print("Ich schaue nach " .. richtung)
end
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function detect(richtung)
local result = false
if richtung == "df" then
result = turtle.detect()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
end
return result
end
function inspect(richtung)
local erkannt = false
local block = nil
if richtung == "if" then
erkannt, block = turtle.inspect()
elseif richtung == "ib" then
turtle.turnLeft()
turtle.turnLeft()
erkannt, block = turtle.inspect()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "il" then
turtle.turnLeft()
erkannt, block = turtle.inspect()
turtle.turnRight()
elseif richtung == "ir" then
turtle.turnRight()
erkannt, block = turtle.inspect()
turtle.turnLeft()
elseif richtung == "iu" then
erkannt, block = turtle.inspectUp()
elseif richtung == "id" then
erkannt, block = turtle.inspectDown()
end
return erkannt, block
end
function suck(richtung)
local result = false
if richtung == "sf" then
result = turtle.suck()
elseif richtung == "sb" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.suck()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "sl" then
turtle.turnLeft()
result = turtle.suck()
turtle.turnRight()
elseif richtung == "sr" then
turtle.turnRight()
result = turtle.suck()
turtle.turnLeft()
elseif richtung == "su" then
result = turtle.suckUp()
elseif richtung == "sd" then
result = turtle.suckDown()
end
return result
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pb" then
turtle.turnLeft()
turtle.turnLeft()
turtle.place()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 doc.lua
local geraet = peripheral.wrap("front")
local typ = peripheral.getType("front")
local methoden = peripheral.getMethods("front")
local dateiname = typ .. "_doc.txt"
local datei = fs.open(dateiname, "w")
datei.write("Peripheral-Typ:\n")
datei.write(typ .. "\n\n")
datei.write("Methoden:\n\n")
for _, methode in ipairs(methoden) do
datei.write("================================\n")
datei.write(methode .. "\n")
datei.write("================================\n")
local dokumentation = geraet.doc(methode)
if dokumentation then
datei.write(dokumentation)
datei.write("\n\n")
else
datei.write("Keine Dokumentation vorhanden.\n\n")
end
end
datei.close()
print("Dokumentation gespeichert: " .. dateiname)
📄 equip.lua
local datei = fs.open("equip.txt", "w")
for name, value in pairs(turtle) do
datei.writeLine(name .. " -> " .. type(value))
end
datei.close()
print("Turtle-API wurde in equip.txt gespeichert.")
📄 equip.txt
detectDown -> function
inspect -> function
getSelectedSlot -> function
getFuelLimit -> function
native -> table
inspectUp -> function
placeDown -> function
back -> function
suckUp -> function
compareTo -> function
compareUp -> function
compareDown -> function
attackDown -> function
getItemSpace -> function
placeUp -> function
forward -> function
suckDown -> function
transferTo -> function
suck -> function
equipLeft -> function
detect -> function
dig -> function
getItemCount -> function
turnRight -> function
digUp -> function
dropDown -> function
getFuelLevel -> function
attackUp -> function
equipRight -> function
detectUp -> function
refuel -> function
attack -> function
dropUp -> function
getItemDetail -> function
digDown -> function
compare -> function
down -> function
inspectDown -> function
select -> function
place -> function
up -> function
turnLeft -> function
drop -> function
📄 erkannt1.lua
local dateiname = "blocks2.lua"
-- Prüfen, ob blocks2.lua existiert
if fs.exists(dateiname) then
blocks = dofile(dateiname)
else
blocks = {}
end
-- Turtle-Umgebung untersuchen
local richtungen = {
"if",
"ib",
"il",
"ir",
"iu",
"id"
}
for _, richtung in ipairs(richtungen) do
local erkannt, block = custom.inspect(richtung)
if erkannt then
local vorhanden = false
-- Prüfen, ob Block bereits vorhanden ist
for j = 1, #blocks do
if blocks[j].name == block.name then
vorhanden = true
break
end
end
if vorhanden then
print("Bereits vorhanden: " .. block.name)
else
blocks[#blocks + 1] = {
name = block.name
}
print("Neu erkannt: " .. block.name)
end
end
end
-- Tabelle speichern
local datei = fs.open(dateiname, "w")
datei.write("return ")
datei.write(textutils.serialize(blocks))
datei.close()
📄 erkannt2.lua
for i = 1,16 do
turtle.select(i)
turtle.suck()
end
local dateiname = "blocks2.lua"
-- Prüfen, ob blocks2.lua existiert
if fs.exists(dateiname) then
blocks = dofile(dateiname)
else
blocks = {}
end
-- Turtle-Inventar untersuchen
for i = 1, 16 do
local item = turtle.getItemDetail(i)
if item then
local vorhanden = false
-- Prüfen, ob Item bereits vorhanden ist
for j = 1, #blocks do
if blocks[j].name == item.name then
vorhanden = true
break
end
end
if vorhanden then
print("Bereits vorhanden: " .. item.name)
else
blocks[#blocks + 1] = {
name = item.name
}
print("Neu erkannt: " .. item.name)
end
end
end
-- Tabelle speichern
local datei = fs.open(dateiname, "w")
datei.write("return ")
datei.write(textutils.serialize(blocks))
datei.close()
for i = 1,16 do
turtle.select(i)
turtle.drop()
end
📄 erkannt3.lua
local peripheral = peripheral.wrap("front")
local dateiname = "blocks2.lua"
-- Prüfen, ob blocks2.lua existiert
if fs.exists(dateiname) then
blocks = dofile(dateiname)
else
blocks = {}
end
-- Peripheral-Inventar untersuchen
for i = 1, peripheral.getInventorySize() do
local item = peripheral.getStackInSlot(i)
if item then
local vorhanden = false
-- Prüfen, ob Item bereits vorhanden ist
for j = 1, #blocks do
if blocks[j].name == item.name then
vorhanden = true
break
end
end
if vorhanden then
print("Bereits vorhanden: " .. item.name)
else
blocks[#blocks + 1] = {
name = item.name
}
print("Neu erkannt: " .. item.name)
end
end
end
-- Tabelle speichern
local datei = fs.open(dateiname, "w")
datei.write("return ")
datei.write(textutils.serialize(blocks))
datei.close()
📄 furnace_test.txt
Peripheral-Typ:
furnace
Methoden:
getInventoryName
pullItem
expandStack
condenseItems
getStackInSlot
listSources
getCurrentItemBurnTime
getInventorySize
swapStacks
destroyStack
getBurnTime
pushItemIntoSlot
getAdvancedMethodsData
pullItemIntoSlot
listMethods
doc
pushItem
getAllStacks
getCookTime
isBurning
📄 generatorfurnace_test.txt
Peripheral-Typ:
generatorfurnace
Methoden:
getInventoryName
pullItem
getEnergyStored
expandStack
condenseItems
getStackInSlot
listSources
getInventorySize
swapStacks
destroyStack
pushItemIntoSlot
getAdvancedMethodsData
getMaxEnergyStored
pullItemIntoSlot
listMethods
doc
pushItem
getAllStacks
Methoden mit Parametern:
condenseItems()
destroyStack(slotNumber)
doc(method)
expandStack(stack)
getAdvancedMethodsData(method?)
getAllStacks(proxy?)
getEnergyStored(side?)
getInventoryName()
getInventorySize()
getMaxEnergyStored(side?)
getStackInSlot(slotNumber
proxy?)
listMethods(filterSource?)
listSources()
pullItem(direction
slot
maxAmount?
intoSlot?)
pullItemIntoSlot(direction
slot
maxAmount?
intoSlot?)
pushItem(direction
slot
maxAmount?
intoSlot?)
pushItemIntoSlot(direction
slot
maxAmount?
intoSlot?)
swapStacks(from
to
fromDirection?
fromDirection?)
📄 gpsstart.lua
custom.gpsStart(true)
📄 hw
function scan()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "chest" then
if site == "left" then
name = "chstL"
elseif site == "right" then
name = "chstR"
elseif site == "top" then
name = "chstT"
elseif site == "bottom" then
name = "chstBo"
elseif site == "back" then
name = "chstBa"
elseif site == "front" then
name = "chstfr"
end
elseif dtype == "furnace" then
if site == "left" then
name = "frncL"
elseif site == "right" then
name = "frncR"
elseif site == "top" then
name = "frncT"
elseif site == "bottom" then
name = "frncBo"
elseif site == "back" then
name = "frncBa"
elseif site == "front" then
name = "frncfr"
end
elseif dtype == "minecart" then
if site == "left" then
name = "mnctL"
elseif site == "right" then
name = "mnctR"
elseif site == "top" then
name = "mnctT"
elseif site == "bottom" then
name = "mnctBo"
elseif site == "back" then
name = "mnctBa"
elseif site == "front" then
name = "mnctfr"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
-- BUNDLED CABLE SCAN
--[[
local cableSites = {
"left",
"right",
"top",
"bottom",
"front",
"back"
}
for _, site in ipairs(cableSites) do
if redstone.getBundledInput(site) ~= nil then
local name = "cable"
if site == "left" then
name = "BCL"
elseif site == "right" then
name = "BCR"
elseif site == "top" then
name = "BCT"
elseif site == "bottom" then
name = "BCBO"
elseif site == "front" then
name = "BCF"
elseif site == "back" then
name = "BCBA"
end
devices[name] = {
site = site,
type = "network",
subtype = "bundled"
}
end
end
]]
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
return devices
end📄 hw.lua
local sites = peripheral.getNames()
for _, site in ipairs(sites) do
local device = peripheral.wrap(site)
print(site .. " -> angebunden")
end
📄 note.lua
--[[local note = peripheral.wrap("front")
note.setPitch(12)
print("Aktuelle Note: " .. note.getNote())
note.triggerNote()
=======================================================
local note = peripheral.wrap("front")
note.setPitch(12)
print("Aktuelle Note: " .. note.getNote())
note.triggerNote()]]
-- bisheriger Test
-- local note = peripheral.wrap("front")
-- note.setPitch(12)
-- print("Note: " .. note.getNote())
-- note.triggerNote()
-- sleep(1)
-- note.incrementPitch()
-- print("Note: " .. note.getNote())
-- note.triggerNote()
-- neuer Test
local note = peripheral.wrap("front")
note.setPitch(12)
for i = 1, 12 do
print("Pitch: " .. note.getNote())
note.triggerNote()
sleep(0.03)
note.incrementPitch()
end
print("Pitch: " .. note.getNote())
note.triggerNote()
📄 note_block_test.txt
Peripheral-Typ:
note_block
Methoden:
playSound
getAdvancedMethodsData
setPitch
listMethods
doc
incrementPitch
getNote
triggerNote
listSources
Methoden mit Parametern:
doc(method)
getAdvancedMethodsData(method?)
getNote()
incrementPitch()
listMethods(filterSource?)
listSources()
playSound(sound
pitch
volume
x?
y?
z?)
setPitch(note)
triggerNote()
📄 peripheral_test.txt
Peripheral-Typ:
chest
Methoden:
getInventoryName
pullItem
expandStack
condenseItems
getStackInSlot
listSources
getInventorySize
swapStacks
destroyStack
pushItemIntoSlot
getAdvancedMethodsData
pullItemIntoSlot
listMethods
doc
pushItem
getAllStacks
📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
os.loadAPI("hw")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw
custom.gpsStart()
hw.scan()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.gpsStart()
hw.scan()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📄 startup2.lua
-- startup.lua
-- DJAMBA Turtle Framework
print("DJAMBA Turtle Framework")
dofile("position.lua")
dofile("gps.lua")
dofile("custom.lua")
dofile("db.lua")
dofile("blocks.lua")
dofile("blueprint.lua")
print("Framework geladen")
GPS.update()
if fs.exists("main.lua") then
dofile("main.lua")
end
📁 t001
📁 .git
📄 COMMIT_EDITMSG
T001 automatic update 2026-08-24 02:52:34
📄 FETCH_HEAD
📄 HEAD
ref: refs/heads/main
📄 ORIG_HEAD
3a22e7aab2cc8ae9de76352123f0762590076d75
📁 branches
📄 config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@github-t001:djamba2k5/t001.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
remote = origin
merge = refs/heads/main
[user]
name = T001
email = t001@djamba.de
📄 description
Unnamed repository; edit this file 'description' to name the repository.
📁 hooks
📄 applypatch-msg.sample
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, rename this file to "applypatch-msg".
. git-sh-setup
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
:
📄 commit-msg.sample
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}
📄 fsmonitor-watchman.sample
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open2;
# An example hook script to integrate Watchman
# (https://facebook.github.io/watchman/) with git to speed up detecting
# new and modified files.
#
# The hook is passed a version (currently 2) and last update token
# formatted as a string and outputs to stdout a new update token and
# all files that have been modified since the update token. Paths must
# be relative to the root of the working tree and separated by a single NUL.
#
# To enable this hook, rename this file to "query-watchman" and set
# 'git config core.fsmonitor .git/hooks/query-watchman'
#
my ($version, $last_update_token) = @ARGV;
# Uncomment for debugging
# print STDERR "$0 $version $last_update_token\n";
# Check the hook interface version
if ($version ne 2) {
die "Unsupported query-fsmonitor hook version '$version'.\n" .
"Falling back to scanning...\n";
}
my $git_work_tree = get_working_dir();
my $retry = 1;
my $json_pkg;
eval {
require JSON::XS;
$json_pkg = "JSON::XS";
1;
} or do {
require JSON::PP;
$json_pkg = "JSON::PP";
};
launch_watchman();
sub launch_watchman {
my $o = watchman_query();
if (is_work_tree_watched($o)) {
output_result($o->{clock}, @{$o->{files}});
}
}
sub output_result {
my ($clockid, @files) = @_;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# binmode $fh, ":utf8";
# print $fh "$clockid\n@files\n";
# close $fh;
binmode STDOUT, ":utf8";
print $clockid;
print "\0";
local $, = "\0";
print @files;
}
sub watchman_clock {
my $response = qx/watchman clock "$git_work_tree"/;
die "Failed to get clock id on '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
return $json_pkg->new->utf8->decode($response);
}
sub watchman_query {
my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
or die "open2() failed: $!\n" .
"Falling back to scanning...\n";
# In the query expression below we're asking for names of files that
# changed since $last_update_token but not from the .git folder.
#
# To accomplish this, we're using the "since" generator to use the
# recency index to select candidate nodes and "fields" to limit the
# output to file names only. Then we're using the "expression" term to
# further constrain the results.
my $last_update_line = "";
if (substr($last_update_token, 0, 1) eq "c") {
$last_update_token = "\"$last_update_token\"";
$last_update_line = qq[\n"since": $last_update_token,];
}
my $query = <<" END";
["query", "$git_work_tree", {$last_update_line
"fields": ["name"],
"expression": ["not", ["dirname", ".git"]]
}]
END
# Uncomment for debugging the watchman query
# open (my $fh, ">", ".git/watchman-query.json");
# print $fh $query;
# close $fh;
print CHLD_IN $query;
close CHLD_IN;
my $response = do {local $/; <CHLD_OUT>};
# Uncomment for debugging the watch response
# open ($fh, ">", ".git/watchman-response.json");
# print $fh $response;
# close $fh;
die "Watchman: command returned no output.\n" .
"Falling back to scanning...\n" if $response eq "";
die "Watchman: command returned invalid output: $response\n" .
"Falling back to scanning...\n" unless $response =~ /^\{/;
return $json_pkg->new->utf8->decode($response);
}
sub is_work_tree_watched {
my ($output) = @_;
my $error = $output->{error};
if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
$retry--;
my $response = qx/watchman watch "$git_work_tree"/;
die "Failed to make watchman watch '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
$output = $json_pkg->new->utf8->decode($response);
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# close $fh;
# Watchman will always return all files on the first query so
# return the fast "everything is dirty" flag to git and do the
# Watchman query just to get it over with now so we won't pay
# the cost in git to look up each individual file.
my $o = watchman_clock();
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
output_result($o->{clock}, ("/"));
$last_update_token = $o->{clock};
eval { launch_watchman() };
return 0;
}
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
return 1;
}
sub get_working_dir {
my $working_dir;
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
$working_dir = Win32::GetCwd();
$working_dir =~ tr/\\/\//;
} else {
require Cwd;
$working_dir = Cwd::cwd();
}
return $working_dir;
}
📄 post-update.sample
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
exec git update-server-info
📄 pre-applypatch.sample
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-applypatch".
. git-sh-setup
precommit="$(git rev-parse --git-path hooks/pre-commit)"
test -x "$precommit" && exec "$precommit" ${1+"$@"}
:
📄 pre-commit.sample
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --type=bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff-index --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
📄 pre-merge-commit.sample
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git merge" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message to
# stderr if it wants to stop the merge commit.
#
# To enable this hook, rename this file to "pre-merge-commit".
. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
exec "$GIT_DIR/hooks/pre-commit"
:
📄 pre-push.sample
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local oid> <remote ref> <remote oid>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).
remote="$1"
url="$2"
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
while read local_ref local_oid remote_ref remote_oid
do
if test "$local_oid" = "$zero"
then
# Handle delete
:
else
if test "$remote_oid" = "$zero"
then
# New branch, examine all commits
range="$local_oid"
else
# Update to existing branch, examine new commits
range="$remote_oid..$local_oid"
fi
# Check for WIP commit
commit=$(git rev-list -n 1 --grep '^WIP' "$range")
if test -n "$commit"
then
echo >&2 "Found WIP commit in $local_ref, not pushing"
exit 1
fi
fi
done
exit 0
📄 pre-rebase.sample
#!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
#
# This sample shows how to prevent topic branches that are already
# merged to 'next' branch from getting rebased, because allowing it
# would result in rebasing already published history.
publish=next
basebranch="$1"
if test "$#" = 2
then
topic="refs/heads/$2"
else
topic=`git symbolic-ref HEAD` ||
exit 0 ;# we do not interrupt rebasing detached HEAD
fi
case "$topic" in
refs/heads/??/*)
;;
*)
exit 0 ;# we do not interrupt others.
;;
esac
# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?
# Does the topic really exist?
git show-ref -q "$topic" || {
echo >&2 "No such branch $topic"
exit 1
}
# Is topic fully merged to master?
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
echo >&2 "$topic is fully merged to master; better remove it."
exit 1 ;# we could allow it, but there is no point.
fi
# Is topic ever merged to next? If so you should not be rebasing it.
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
only_next_2=`git rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
not_in_topic=`git rev-list "^$topic" master`
if test -z "$not_in_topic"
then
echo >&2 "$topic is already up to date with master"
exit 1 ;# we could allow it, but there is no point.
else
exit 0
fi
else
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
/usr/bin/perl -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
/^([0-9a-f]+) /;
($1 => 1);
} split(/\n/, $ARGV[1]);
for my $elem (map {
/^([0-9a-f]+) (.*)$/;
[$1 => $2];
} split(/\n/, $ARGV[2])) {
if (!exists $not_in_next{$elem->[0]}) {
if ($msg) {
print STDERR $msg;
undef $msg;
}
print STDERR " $elem->[1]\n";
}
}
' "$topic" "$not_in_next" "$not_in_master"
exit 1
fi
<<\DOC_END
This sample hook safeguards topic branches that have been
published from being rewound.
The workflow assumed here is:
* Once a topic branch forks from "master", "master" is never
merged into it again (either directly or indirectly).
* Once a topic branch is fully cooked and merged into "master",
it is deleted. If you need to build on top of it to correct
earlier mistakes, a new topic branch is created by forking at
the tip of the "master". This is not strictly necessary, but
it makes it easier to keep your history simple.
* Whenever you need to test or publish your changes to topic
branches, merge them into "next" branch.
The script, being an example, hardcodes the publish branch name
to be "next", but it is trivial to make it configurable via
$GIT_DIR/config mechanism.
With this workflow, you would want to know:
(1) ... if a topic branch has ever been merged to "next". Young
topic branches can have stupid mistakes you would rather
clean up before publishing, and things that have not been
merged into other branches can be easily rebased without
affecting other people. But once it is published, you would
not want to rewind it.
(2) ... if a topic branch has been fully merged to "master".
Then you can delete it. More importantly, you should not
build on top of it -- other people may already want to
change things related to the topic as patches against your
"master", so if you need further changes, it is better to
fork the topic (perhaps with the same name) afresh from the
tip of "master".
Let's look at this example:
o---o---o---o---o---o---o---o---o---o "next"
/ / / /
/ a---a---b A / /
/ / / /
/ / c---c---c---c B /
/ / / \ /
/ / / b---b C \ /
/ / / / \ /
---o---o---o---o---o---o---o---o---o---o---o "master"
A, B and C are topic branches.
* A has one fix since it was merged up to "next".
* B has finished. It has been fully merged up to "master" and "next",
and is ready to be deleted.
* C has not merged to "next" at all.
We would want to allow C to be rebased, refuse A, and encourage
B to be deleted.
To compute (1):
git rev-list ^master ^topic next
git rev-list ^master next
if these match, topic has not merged in next at all.
To compute (2):
git rev-list master..topic
if this is empty, it is fully merged to "master".
DOC_END
📄 pre-receive.sample
#!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
if test -n "$GIT_PUSH_OPTION_COUNT"
then
i=0
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
do
eval "value=\$GIT_PUSH_OPTION_$i"
case "$value" in
echoback=*)
echo "echo from the pre-receive-hook: ${value#*=}" >&2
;;
reject)
exit 1
esac
i=$((i + 1))
done
fi
📄 prepare-commit-msg.sample
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
# This hook includes three examples. The first one removes the
# "# Please enter the commit message..." help message.
#
# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
# commented because it doesn't cope with --amend or with squashed
# commits.
#
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
# case "$COMMIT_SOURCE,$SHA1" in
# ,|template,)
# /usr/bin/perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
# *) ;;
# esac
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
# if test -z "$COMMIT_SOURCE"
# then
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
# fi
📄 push-to-checkout.sample
#!/bin/sh
# An example hook script to update a checked-out tree on a git push.
#
# This hook is invoked by git-receive-pack(1) when it reacts to git
# push and updates reference(s) in its repository, and when the push
# tries to update the branch that is currently checked out and the
# receive.denyCurrentBranch configuration variable is set to
# updateInstead.
#
# By default, such a push is refused if the working tree and the index
# of the remote repository has any difference from the currently
# checked out commit; when both the working tree and the index match
# the current commit, they are updated to match the newly pushed tip
# of the branch. This hook is to be used to override the default
# behaviour; however the code below reimplements the default behaviour
# as a starting point for convenient modification.
#
# The hook receives the commit with which the tip of the current
# branch is going to be updated:
commit=$1
# It can exit with a non-zero status to refuse the push (when it does
# so, it must not modify the index or the working tree).
die () {
echo >&2 "$*"
exit 1
}
# Or it can make any necessary changes to the working tree and to the
# index to bring them to the desired state when the tip of the current
# branch is updated to the new commit, and exit with a zero status.
#
# For example, the hook can simply run git read-tree -u -m HEAD "$1"
# in order to emulate git fetch that is run in the reverse direction
# with git push, as the two-tree form of git read-tree -u -m is
# essentially the same as git switch or git checkout that switches
# branches while keeping the local changes in the working tree that do
# not interfere with the difference between the branches.
# The below is a more-or-less exact translation to shell of the C code
# for the default behaviour for git's push-to-checkout hook defined in
# the push_to_deploy() function in builtin/receive-pack.c.
#
# Note that the hook will be executed from the repository directory,
# not from the working tree, so if you want to perform operations on
# the working tree, you will have to adapt your code accordingly, e.g.
# by adding "cd .." or using relative paths.
if ! git update-index -q --ignore-submodules --refresh
then
die "Up-to-date check failed"
fi
if ! git diff-files --quiet --ignore-submodules --
then
die "Working directory has unstaged changes"
fi
# This is a rough translation of:
#
# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
if git cat-file -e HEAD 2>/dev/null
then
head=HEAD
else
head=$(git hash-object -t tree --stdin </dev/null)
fi
if ! git diff-index --quiet --cached --ignore-submodules $head --
then
die "Working directory has staged changes"
fi
if ! git read-tree -u -m "$commit"
then
die "Could not update working tree to new HEAD"
fi
📄 sendemail-validate.sample
#!/bin/sh
# An example hook script to validate a patch (and/or patch series) before
# sending it via email.
#
# The hook should exit with non-zero status after issuing an appropriate
# message if it wants to prevent the email(s) from being sent.
#
# To enable this hook, rename this file to "sendemail-validate".
#
# By default, it will only check that the patch(es) can be applied on top of
# the default upstream branch without conflicts in a secondary worktree. After
# validation (successful or not) of the last patch of a series, the worktree
# will be deleted.
#
# The following config variables can be set to change the default remote and
# remote ref that are used to apply the patches against:
#
# sendemail.validateRemote (default: origin)
# sendemail.validateRemoteRef (default: HEAD)
#
# Replace the TODO placeholders with appropriate checks according to your
# needs.
validate_cover_letter () {
file="$1"
# TODO: Replace with appropriate checks (e.g. spell checking).
true
}
validate_patch () {
file="$1"
# Ensure that the patch applies without conflicts.
git am -3 "$file" || return
# TODO: Replace with appropriate checks for this patch
# (e.g. checkpatch.pl).
true
}
validate_series () {
# TODO: Replace with appropriate checks for the whole series
# (e.g. quick build, coding style checks, etc.).
true
}
# main -------------------------------------------------------------------------
if test "$GIT_SENDEMAIL_FILE_COUNTER" = 1
then
remote=$(git config --default origin --get sendemail.validateRemote) &&
ref=$(git config --default HEAD --get sendemail.validateRemoteRef) &&
worktree=$(mktemp --tmpdir -d sendemail-validate.XXXXXXX) &&
git worktree add -fd --checkout "$worktree" "refs/remotes/$remote/$ref" &&
git config --replace-all sendemail.validateWorktree "$worktree"
else
worktree=$(git config --get sendemail.validateWorktree)
fi || {
echo "sendemail-validate: error: failed to prepare worktree" >&2
exit 1
}
unset GIT_DIR GIT_WORK_TREE
cd "$worktree" &&
if grep -q "^diff --git " "$1"
then
validate_patch "$1"
else
validate_cover_letter "$1"
fi &&
if test "$GIT_SENDEMAIL_FILE_COUNTER" = "$GIT_SENDEMAIL_FILE_TOTAL"
then
git config --unset-all sendemail.validateWorktree &&
trap 'git worktree remove -ff "$worktree"' EXIT &&
validate_series
fi
📄 update.sample
#!/bin/sh
#
# An example hook script to block unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi
# --- Config
allowunannotated=$(git config --type=bool hooks.allowunannotated)
allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
;;
esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ "$allowdeletetag" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac
# --- Finished
exit 0
📄 index
DIRC j��@.��Xj��@.��X � @� �� � � �@|���|�tF�`��O<��r README.md j���;Y�j���;Y� � @� �� � � {����g�P�u��B�W�ץ command_test.lua j�����9j�����9 � @A �� � � b
s��P\�t��T���q��� commands.lua j�q�*���j�q�*��� � @ �� � � ����e���՞K���~ github_test.txt j��y:���j��y:��� � @\ �� � �
J��0B��C�8�%�
pull_test.txt j���)${�j���X3� � @f �� � � �;~dv�
F�~���P9�"�>�� t001_git_pull.sh j�s�'��.j�s�
� @8 �� � � ���lS�"�(�"@�|��� � t001_git_watch.sh j�u���j�u��� � @7 �� � � ��"a�9�,��`j��� watcher_test.txt j�z 18j�z 18 � @, �� � � )�����H�n�Q�p��� watcher_test2.txt TREE 9 0
����cE�9��N��WL���A��Do
(�Z>H$�📁 info
📄 exclude
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
📁 logs
📄 HEAD
0000000000000000000000000000000000000000 954f464e4d2738c09d48511b6faf6027467ad099 T001 <t001@djamba.de> 1787523527 +0200 commit (initial): T001 connection test
954f464e4d2738c09d48511b6faf6027467ad099 614554ca3e7a42f5e390b583e6e156102f546ded T001 <t001@djamba.de> 1787524752 +0200 commit: T001 automatic update 2026-08-24 00:39:12
614554ca3e7a42f5e390b583e6e156102f546ded 6de09c1ed5e8ddc7fce89980be12973c01a11eda T001 <t001@djamba.de> 1787525646 +0200 commit: T001 automatic update 2026-08-24 00:54:06
6de09c1ed5e8ddc7fce89980be12973c01a11eda e6c87be170d0740ef8159ef76666071225277ea0 T001 <t001@djamba.de> 1787525797 +0200 commit: T001 automatic update 2026-08-24 00:56:37
e6c87be170d0740ef8159ef76666071225277ea0 61a0b591d3a2d5ebe3880fb1c7a429eef5124787 T001 <t001@djamba.de> 1787525830 +0200 commit: T001 automatic update 2026-08-24 00:57:10
61a0b591d3a2d5ebe3880fb1c7a429eef5124787 11836378e4a54d5a55b342334859ca134482dabe T001 <t001@djamba.de> 1787525922 +0200 commit: T001 automatic update 2026-08-24 00:58:42
11836378e4a54d5a55b342334859ca134482dabe e6b5b1cd41043a54e9ffe95ef9d46dffbc4d8041 T001 <t001@djamba.de> 1787527096 +0200 commit: T001 automatic update 2026-08-24 01:18:16
e6b5b1cd41043a54e9ffe95ef9d46dffbc4d8041 6f63e622135211866796affb32cb80510c2657bf T001 <t001@djamba.de> 1787527635 +0200 commit: T001 automatic update 2026-08-24 01:27:15
6f63e622135211866796affb32cb80510c2657bf f9a1230de261298c527c8b811b01c6c57240ae5a T001 <t001@djamba.de> 1787527638 +0200 commit: T001 automatic update 2026-08-24 01:27:18
f9a1230de261298c527c8b811b01c6c57240ae5a e79c2669bcf8c64cc4c67bc0b0b0658f8e88e401 T001 <t001@djamba.de> 1787527640 +0200 commit: T001 automatic update 2026-08-24 01:27:20
e79c2669bcf8c64cc4c67bc0b0b0658f8e88e401 f3a90588db25d12ac4485625d858e47c690719bc T001 <t001@djamba.de> 1787527648 +0200 commit: T001 automatic update 2026-08-24 01:27:28
f3a90588db25d12ac4485625d858e47c690719bc d3150fd84921473d6e3477d463046fbf3c4576bc T001 <t001@djamba.de> 1787527801 +0200 commit: Pull watcher test
d3150fd84921473d6e3477d463046fbf3c4576bc d00b9c887269eca3ba6b581996c24546c618830d T001 <t001@djamba.de> 1787528023 +0200 pull: Fast-forward
d00b9c887269eca3ba6b581996c24546c618830d 950d5023f008bcfb9ed200b0d54a652cce95f2c9 T001 <t001@djamba.de> 1787528270 +0200 commit: T001 automatic update 2026-08-24 01:37:50
950d5023f008bcfb9ed200b0d54a652cce95f2c9 2fb7a2d56b1255c9227a8f45e1166854aab0399c T001 <t001@djamba.de> 1787528285 +0200 commit: T001 automatic update 2026-08-24 01:38:05
2fb7a2d56b1255c9227a8f45e1166854aab0399c 67889ce8ba254dddb873ecd4064fd373958059cc T001 <t001@djamba.de> 1787528643 +0200 commit: T001 automatic update 2026-08-24 01:44:03
67889ce8ba254dddb873ecd4064fd373958059cc 648c3d52177a7a0e9b00603ec999eb9fce40b154 T001 <t001@djamba.de> 1787530045 +0200 commit: T001 automatic update 2026-08-24 02:07:25
648c3d52177a7a0e9b00603ec999eb9fce40b154 964dafef1f89558d5cab3e9c18e71fd545af898f T001 <t001@djamba.de> 1787530046 +0200 commit: T001 automatic update 2026-08-24 02:07:26
964dafef1f89558d5cab3e9c18e71fd545af898f 17eac573ffb0320e10964499a8d5cc03cf5d27f2 T001 <t001@djamba.de> 1787530049 +0200 commit: T001 automatic update 2026-08-24 02:07:29
17eac573ffb0320e10964499a8d5cc03cf5d27f2 129bd065c3e99e89fd00113e7d4d57969a621cff T001 <t001@djamba.de> 1787530051 +0200 commit: T001 automatic update 2026-08-24 02:07:31
129bd065c3e99e89fd00113e7d4d57969a621cff 97e7d7b8c88b13b3ef74056a9f6ea16d392ae308 T001 <t001@djamba.de> 1787530475 +0200 commit: T001 automatic update 2026-08-24 02:14:35
97e7d7b8c88b13b3ef74056a9f6ea16d392ae308 f406880c46bc25dbcea377c5a5da510682a041dd T001 <t001@djamba.de> 1787530995 +0200 commit: T001 automatic update 2026-08-24 02:23:15
f406880c46bc25dbcea377c5a5da510682a041dd d3fd9e6ba16ef4aaa2ef35967bcd6244ef1f7146 T001 <t001@djamba.de> 1787531432 +0200 commit: T001 automatic update 2026-08-24 02:30:32
d3fd9e6ba16ef4aaa2ef35967bcd6244ef1f7146 3a22e7aab2cc8ae9de76352123f0762590076d75 T001 <t001@djamba.de> 1787532228 +0200 commit: T001 automatic update 2026-08-24 02:43:48
📁 refs
📁 heads
📄 main
0000000000000000000000000000000000000000 954f464e4d2738c09d48511b6faf6027467ad099 T001 <t001@djamba.de> 1787523527 +0200 commit (initial): T001 connection test
954f464e4d2738c09d48511b6faf6027467ad099 614554ca3e7a42f5e390b583e6e156102f546ded T001 <t001@djamba.de> 1787524752 +0200 commit: T001 automatic update 2026-08-24 00:39:12
614554ca3e7a42f5e390b583e6e156102f546ded 6de09c1ed5e8ddc7fce89980be12973c01a11eda T001 <t001@djamba.de> 1787525646 +0200 commit: T001 automatic update 2026-08-24 00:54:06
6de09c1ed5e8ddc7fce89980be12973c01a11eda e6c87be170d0740ef8159ef76666071225277ea0 T001 <t001@djamba.de> 1787525797 +0200 commit: T001 automatic update 2026-08-24 00:56:37
e6c87be170d0740ef8159ef76666071225277ea0 61a0b591d3a2d5ebe3880fb1c7a429eef5124787 T001 <t001@djamba.de> 1787525830 +0200 commit: T001 automatic update 2026-08-24 00:57:10
61a0b591d3a2d5ebe3880fb1c7a429eef5124787 11836378e4a54d5a55b342334859ca134482dabe T001 <t001@djamba.de> 1787525922 +0200 commit: T001 automatic update 2026-08-24 00:58:42
11836378e4a54d5a55b342334859ca134482dabe e6b5b1cd41043a54e9ffe95ef9d46dffbc4d8041 T001 <t001@djamba.de> 1787527096 +0200 commit: T001 automatic update 2026-08-24 01:18:16
e6b5b1cd41043a54e9ffe95ef9d46dffbc4d8041 6f63e622135211866796affb32cb80510c2657bf T001 <t001@djamba.de> 1787527635 +0200 commit: T001 automatic update 2026-08-24 01:27:15
6f63e622135211866796affb32cb80510c2657bf f9a1230de261298c527c8b811b01c6c57240ae5a T001 <t001@djamba.de> 1787527638 +0200 commit: T001 automatic update 2026-08-24 01:27:18
f9a1230de261298c527c8b811b01c6c57240ae5a e79c2669bcf8c64cc4c67bc0b0b0658f8e88e401 T001 <t001@djamba.de> 1787527640 +0200 commit: T001 automatic update 2026-08-24 01:27:20
e79c2669bcf8c64cc4c67bc0b0b0658f8e88e401 f3a90588db25d12ac4485625d858e47c690719bc T001 <t001@djamba.de> 1787527648 +0200 commit: T001 automatic update 2026-08-24 01:27:28
f3a90588db25d12ac4485625d858e47c690719bc d3150fd84921473d6e3477d463046fbf3c4576bc T001 <t001@djamba.de> 1787527801 +0200 commit: Pull watcher test
d3150fd84921473d6e3477d463046fbf3c4576bc d00b9c887269eca3ba6b581996c24546c618830d T001 <t001@djamba.de> 1787528023 +0200 pull: Fast-forward
d00b9c887269eca3ba6b581996c24546c618830d 950d5023f008bcfb9ed200b0d54a652cce95f2c9 T001 <t001@djamba.de> 1787528270 +0200 commit: T001 automatic update 2026-08-24 01:37:50
950d5023f008bcfb9ed200b0d54a652cce95f2c9 2fb7a2d56b1255c9227a8f45e1166854aab0399c T001 <t001@djamba.de> 1787528285 +0200 commit: T001 automatic update 2026-08-24 01:38:05
2fb7a2d56b1255c9227a8f45e1166854aab0399c 67889ce8ba254dddb873ecd4064fd373958059cc T001 <t001@djamba.de> 1787528643 +0200 commit: T001 automatic update 2026-08-24 01:44:03
67889ce8ba254dddb873ecd4064fd373958059cc 648c3d52177a7a0e9b00603ec999eb9fce40b154 T001 <t001@djamba.de> 1787530045 +0200 commit: T001 automatic update 2026-08-24 02:07:25
648c3d52177a7a0e9b00603ec999eb9fce40b154 964dafef1f89558d5cab3e9c18e71fd545af898f T001 <t001@djamba.de> 1787530046 +0200 commit: T001 automatic update 2026-08-24 02:07:26
964dafef1f89558d5cab3e9c18e71fd545af898f 17eac573ffb0320e10964499a8d5cc03cf5d27f2 T001 <t001@djamba.de> 1787530049 +0200 commit: T001 automatic update 2026-08-24 02:07:29
17eac573ffb0320e10964499a8d5cc03cf5d27f2 129bd065c3e99e89fd00113e7d4d57969a621cff T001 <t001@djamba.de> 1787530051 +0200 commit: T001 automatic update 2026-08-24 02:07:31
129bd065c3e99e89fd00113e7d4d57969a621cff 97e7d7b8c88b13b3ef74056a9f6ea16d392ae308 T001 <t001@djamba.de> 1787530475 +0200 commit: T001 automatic update 2026-08-24 02:14:35
97e7d7b8c88b13b3ef74056a9f6ea16d392ae308 f406880c46bc25dbcea377c5a5da510682a041dd T001 <t001@djamba.de> 1787530995 +0200 commit: T001 automatic update 2026-08-24 02:23:15
f406880c46bc25dbcea377c5a5da510682a041dd d3fd9e6ba16ef4aaa2ef35967bcd6244ef1f7146 T001 <t001@djamba.de> 1787531432 +0200 commit: T001 automatic update 2026-08-24 02:30:32
d3fd9e6ba16ef4aaa2ef35967bcd6244ef1f7146 3a22e7aab2cc8ae9de76352123f0762590076d75 T001 <t001@djamba.de> 1787532228 +0200 commit: T001 automatic update 2026-08-24 02:43:48
📁 remotes
📁 origin
📄 main
0000000000000000000000000000000000000000 954f464e4d2738c09d48511b6faf6027467ad099 T001 <t001@djamba.de> 1787523555 +0200 update by push
954f464e4d2738c09d48511b6faf6027467ad099 614554ca3e7a42f5e390b583e6e156102f546ded T001 <t001@djamba.de> 1787524917 +0200 update by push
614554ca3e7a42f5e390b583e6e156102f546ded 6de09c1ed5e8ddc7fce89980be12973c01a11eda T001 <t001@djamba.de> 1787525647 +0200 update by push
6de09c1ed5e8ddc7fce89980be12973c01a11eda e6c87be170d0740ef8159ef76666071225277ea0 T001 <t001@djamba.de> 1787525798 +0200 update by push
e6c87be170d0740ef8159ef76666071225277ea0 61a0b591d3a2d5ebe3880fb1c7a429eef5124787 T001 <t001@djamba.de> 1787525832 +0200 update by push
61a0b591d3a2d5ebe3880fb1c7a429eef5124787 11836378e4a54d5a55b342334859ca134482dabe T001 <t001@djamba.de> 1787525924 +0200 update by push
11836378e4a54d5a55b342334859ca134482dabe e6b5b1cd41043a54e9ffe95ef9d46dffbc4d8041 T001 <t001@djamba.de> 1787527098 +0200 update by push
e6b5b1cd41043a54e9ffe95ef9d46dffbc4d8041 6f63e622135211866796affb32cb80510c2657bf T001 <t001@djamba.de> 1787527637 +0200 update by push
6f63e622135211866796affb32cb80510c2657bf f9a1230de261298c527c8b811b01c6c57240ae5a T001 <t001@djamba.de> 1787527640 +0200 update by push
f9a1230de261298c527c8b811b01c6c57240ae5a e79c2669bcf8c64cc4c67bc0b0b0658f8e88e401 T001 <t001@djamba.de> 1787527641 +0200 update by push
e79c2669bcf8c64cc4c67bc0b0b0658f8e88e401 f3a90588db25d12ac4485625d858e47c690719bc T001 <t001@djamba.de> 1787527650 +0200 update by push
f3a90588db25d12ac4485625d858e47c690719bc d3150fd84921473d6e3477d463046fbf3c4576bc T001 <t001@djamba.de> 1787527804 +0200 update by push
d3150fd84921473d6e3477d463046fbf3c4576bc d00b9c887269eca3ba6b581996c24546c618830d T001 <t001@djamba.de> 1787528023 +0200 pull: fast-forward
d00b9c887269eca3ba6b581996c24546c618830d 950d5023f008bcfb9ed200b0d54a652cce95f2c9 T001 <t001@djamba.de> 1787528272 +0200 update by push
950d5023f008bcfb9ed200b0d54a652cce95f2c9 2fb7a2d56b1255c9227a8f45e1166854aab0399c T001 <t001@djamba.de> 1787528287 +0200 update by push
2fb7a2d56b1255c9227a8f45e1166854aab0399c 67889ce8ba254dddb873ecd4064fd373958059cc T001 <t001@djamba.de> 1787528644 +0200 update by push
67889ce8ba254dddb873ecd4064fd373958059cc 648c3d52177a7a0e9b00603ec999eb9fce40b154 T001 <t001@djamba.de> 1787530046 +0200 update by push
648c3d52177a7a0e9b00603ec999eb9fce40b154 964dafef1f89558d5cab3e9c18e71fd545af898f T001 <t001@djamba.de> 1787530048 +0200 update by push
964dafef1f89558d5cab3e9c18e71fd545af898f 17eac573ffb0320e10964499a8d5cc03cf5d27f2 T001 <t001@djamba.de> 1787530051 +0200 update by push
17eac573ffb0320e10964499a8d5cc03cf5d27f2 129bd065c3e99e89fd00113e7d4d57969a621cff T001 <t001@djamba.de> 1787530052 +0200 update by push
129bd065c3e99e89fd00113e7d4d57969a621cff 97e7d7b8c88b13b3ef74056a9f6ea16d392ae308 T001 <t001@djamba.de> 1787530477 +0200 update by push
97e7d7b8c88b13b3ef74056a9f6ea16d392ae308 f406880c46bc25dbcea377c5a5da510682a041dd T001 <t001@djamba.de> 1787530996 +0200 update by push
f406880c46bc25dbcea377c5a5da510682a041dd d3fd9e6ba16ef4aaa2ef35967bcd6244ef1f7146 T001 <t001@djamba.de> 1787531434 +0200 update by push
d3fd9e6ba16ef4aaa2ef35967bcd6244ef1f7146 3a22e7aab2cc8ae9de76352123f0762590076d75 T001 <t001@djamba.de> 1787532230 +0200 update by push
📁 objects
📁 0b
📄 1a963db3c73be471432a7d705ba079a6cdfef9
xK��OR06e(J-)-�S���R ����ļ[��Ԃ��%^�Z Y�
📁 0d
📄 73af9150175caf74aea354cfebdb7186aa1cad
xK��OR��`(J-)-�S���R ����ļ[��Ԃ��%^�Z^.^.��2�R�K�t �dy��y #2�@�dh
📁 11
📄 836378e4a54d5a55b342334859ca134482dabe
x��An�0{�+xR��h�AQ�� )Q���5��\����u[�e G��;H��u�p�Lb�l���d�� �=<u��)��Ԣr7��`7�Y��]�S.9�k�l;< �Ƒ�����g�o��!,33\�C=o
��!�VK�׳�p`���� oRn��?ٽB�📁 12
📄 9bd065c3e99e89fd00113e7d4d57969a621cff
x��K�0DY��#�c��Tq.�8� �����8���{3�.˳[$<�]�"S)!9�
�Z֊�]�Vv2�����w}w뒲�D� u���9�T���P154��u�w g/}䭾x)|�z�)���fu��`~�!Y�O���rw � �z8C�ə/�B�📁 17
📄 eac573ffb0320e10964499a8d5cc03cf5d27f2
x��Kn�0D��)�RPԏ�"��(�B]�u`(���d3���7m[�e���d��>0�NAc��JnU��=�X5"���&H�]�
?XR➚�`�<[�hx8}͟m����y��Z���7��%�(pABt�5�m��Çd[u.
^ϮӀ���J�nXn$�,�C3
📁 1e
📄 ddca22619539e99e2ca208b8606a01ffae1db5
xK��OR02dO,I�H-RH+��.����L-*� �J
=
📁 1f
📄 c1888881026345c53985c64e8b071fa2571c4c
x+)JMU0�0f040031Qrut�u��Map�9,�0��H��DŽ?��m�̹XU�������_�Z\��S�Ȱ�e��W��t�Nb�?|�j���x��O�Y_�nq��Vɬ��K�,�(M�YRQ°U�<�䊞ԍG�t]��m��:f�҂Ҝ�B��g
���9?��8'�ϧ:
����T���0hp<H�^q�u]J�+^��u��]����n�t��%� ����V��)��\�af��=��. �I-B8B��)�ĩ�/��,�ؑ����V,j��@^Ӕ� ������/�� ���
📁 25
📄 63232ec780ed7f36c126e711f37dce4151381e
xK��OR0402aH2�K��W��3a@��8R�s�Q��r�ʌ,���cS����몗��MrTl4FC��!�n W
�
📁 29
📄 1a9014fcd01dfcdb48fd6ee7519f708f1df0e8
xK��OR02`HM�(I-R(O,I� �%��%\ �� �
📄 4641d481a4f9fddf0e94e065f3cb7bc80df876
x+)JMU024g040031QH���M�K)��)Mdx!P���l���Y>��{lH��K�,�(M�/I-.�+�(a�*|�YrEO�ƣ�����6�j3P����B���a<P}|ybIr�^qö�9����f
h,Wr�Yspj�!��`5�E���RJ�j�r��"� Y����n��
M� ".����7�y�~�/ �Y+📁 2a
📄 3bb571a4f033f9ed2e416ed6b2da1c85b9c26e
x+)JMU06�d040031Qrut�u��Map�9,�0��H��DŽ?��m�̹XU�������R��S���8B��+sن5�L��|le�ؐU��Y�Q�_�Z\�WRQ°U�<�䊞ԍG�t]��m��:f�҂Ҝ�B��g
���9?��8'�ϧ:
����T���0hp<H�^q�u]J�+^��u��]����n�t��%� ����V��)��\�af��=��. �I-B8B��)�ĩ�/��,�ؑ����V,j��^Ӕ� ������/�� �чZ
📁 2f
📄 b7a2d56b1255c9227a8f45e1166854aab0399c
x��Aj1E��)�/ �,��PB�Ȳ��0�08��� ����o���P��q��Rc����0[����,��� ��M[����T�.HiE,��V�b�%O �y���}��~�b��1�����
1�,T�|�䃽o
�7��9�o:��G��@H� ˉ0^R���0/A�
📁 3a
📄 22e7aab2cc8ae9de76352123f0762590076d75
x��KnAD��Sx��l��3��x�n�HàQs&��ZԮ^Uٺ,��kl�@ݨ���s�d)N5Y�3�ʩ����n~�bo��Y){Ue�1M���2�x�^Hr��]7�"���?�O�Y��_�J-)2s�2b��������������t8����'�'���BV📁 3b
📄 7e6476ea0d46bb7ebae6d15039dc22f03e9998
x-�A
�@E]�qt�i-�("��68�i�LSt�Q��s�����
Β�`4$S5dtg6��Z��5SyѴ�5w���N��9d�<;gnj
_��p��$IR����.pW���;7�j),�q':���>o�ᡣ\�8���D�[�B~V�)��V�QB�Pz�8�(�~�9�I�
���?�📁 3e
📄 d5e2695898b8b24d1d2d18b2f14f46baa00976
x+)JMU061a040031Q�rut�u��M�+./`PMV�;�����s�ϵ�-�*��ss�R��rJG�e.۰Ɵ�wւ���Ҡ��3K2J��KR�K�J*J�
�g�\ѓ��蟮��M�Z�UZP���P����|�6����T�����*��
���+�`��K){�붻n׳��w�>�͜���<�$9�x����Jr34�+9̬98����`5�EG��=��8���<�E;����݊E��k�RD�\��s��o����^ 3��📁 40
📄 7cc31c80967cc47446f160fcff4f3ce49cd172
x]�MN�@�Y�),e
j+q (]!�t���52�<U܇�p1���'}~?C*�w�w�}ǒ�fУ������]�'���
�=�%g�K}H�]�|���}Z�!%(������/g-+[,B�2A�8�--,B_ t��q�W̩V��J�"���Է��q���z��潷mt�ڪeRΙ��x7 ��W�
📁 42
📄 b8f356eb8929d75cebed2b921d39518d7419e2
xK��OR0402aH2�K��W��3a@�.q2�d%�&%�c��Y��Ǧ09?771/�X/��S��0*6�!@� �D�
📁 44
📄 75c4f73d33cea777260abab332b1ede3a304ca
x+)JMU023d040031QH���M�K)��)Mdx!P���l���Y>��{lH��K�,�(M�/I-.�+�(a�*|�YrEO�ƣ�����6�j3P����B���a<P}|AiN�^q�u]J�+^��u��]����n�t��%� ����V��)��\�af��=��n �I-B8B��)�ĩ�/��,�ؑ����V,j��.֔� ������/�� j�j�📁 46
📄 363c5eae1f4f6afdf89c38a36f3ffda04a13dc
x+)JMU046b040031QH�,�(M�/I-.�+�(a�*|�YrEO�ƣ�����6�j3P����B���a<P}|ybIr�^qö�9����f
h,Wr�Yspj�!��`5�E���RJ�j�r��"� Y����n \�6
📁 4a
📄 adcd30429f118643e11f0f38ce120f0e259603
xK��OR04`(��QI-.� 5!�
📁 52
📄 76ac69d20c254fecfb5ee4f63d781d85f4667e
x+)JMU0�0f040031Qrut�u��Map�9,�0��H��DŽ?��m�̹XU�������_�Z\��S�Ȱ�e��W��t�Nb�?|�j���G�e.۰Ɵ�wւ���Ҡ��3K2J� F�T�0l>�,��'u��?]W�yo�v�����4'��k�Y���m��-� ��N)475U(100�ҡW��`]�R���mwݮg,�(}��9]mybIrH�9����f
h,Wr�Yspj�!��jR����{J)q���y:�8v$d1�_'��Z#=��4�&��� ������e?� �.�📁 5f
📄 c6bf1fc8273215bb02b818b74ba3c925310eee
x+)JMU024g040031QH���M�K)��)Md����kF��3��W&�
/9if�U��Y�Q�_�Z\�WRQ°U�<�䊞ԍG�t]��m��:f�RsSS��x����Ē����m�s�W+���X��0�����CPs�jR���=��8���<�E;����݊E���RD�\��s��o����^ pY�
📁 61
📄 4554ca3e7a42f5e390b583e6e156102f546ded
x���m1�V�(�GIF��4@K$� �3r�9�?v��}[��bz��;��r_�<��Z���s5��a(�y�t��&�EBT\�ې��|հP�"Zl`k��g��1��<�k��z��័K-�8!!���5�e =�ɶڼux܇MB�3�3 ^�]2��B�
📄 a0b591d3a2d5ebe3880fb1c7a429eef5124787
x��Qn�0C��S��@)��ðC��-c����� �~���Ǿ��"/�t��Ի��YS̮�7a]yi
K����N��ݜ
3�pZ'!OAY$���=�q���>���7{k�A�E����^!@��[�]O�9v�J�{��$�|A�H$����Ak📁 64
📄 8c3d52177a7a0e9b00603ec999eb9fce40b154
x��KnA��Sx����E�Cp��V�44j��lޮ��n�z�@����&Ĝ�Rc��4G�%y�A4���-�8p���?�6�P�f�pK����a��^KW
��W�?���u�o�3�ƭ$�\��}k��@x�_�m�ySx�M�!�#�2 �����'B&
📁 65
📄 2761e1094e54b99eb6a26fdd78ee8fa4fe50b1
xK��OR0402aH2�K��W��3a@3�s2�d%�&%�c��Y��Ǧ���0>=�$��4'G�8��Q��
�� ��
📁 67
📄 46e86efeb5faa1a0e77c532fd86b5b52d97eb2
x+)JMU024g040031QH���M�K)��)Mdx6���M�9{wk�+��q�IO�D���̒�Ҥ�����������%W�n<����<�mӮ�1����*���Ǘ'�$g�g0l۟�ZIn���r%��5��0��V�Z�0X��)�ĩ�/��,�ؑ����V,j���Д� ������/�� n�[v📄 889ce8ba254dddb873ecd4064fd373958059cc
x��A�1��W��X�N�$�}p����A�����K_Z��m[�� ��5v3膾&�%K�,��%Hj�P��[��'�ԤܣT�[aN���H$Ǡ�@)��s�n;\ �c�O�ӵ�w�P�)�z8 #���5�c����d[u�<]�#�� �B8�w/
:A�
📁 69
📄 1912a65c544c723e4ea44594449c52377cab9a
x+)JMU060b040031QH���M�K)��)MdXc�,��_��/!��f�
Pu�%�I�%��%z%%[��3K��I�x�O��y�ۦ]�c�*-(��A(�Z{�i�`��Cy~�sB�|��@
�MMJ�ǃt�g0Xץ���u�]���� �;J�f�@W[�X��R�mN�j%��˕f����p����"�#��RJ�j�r��"� Y����nŢ��5M� ".����7�y�~�/ 9Zv�📁 6a
📄 2f813803d23a478c4eb9698cbac16d599ebe22
x+)JMU0�0d040031Q�rut�u��M�+./`PMV�;�����s�ϵ�-�*�
j�4L�9R�1���'s.A%���&���&2<�(��\�a�?��[�=6�Aեg�d�&ŗ���T�0l>�,��'u��?]W�yo�v�����4'��k�Y���m��-� ��N)475U(100�ҡW��`]�R���mwݮg,�(}��9]mybIrH�9����f
h,Wr�Yspj�!��jR����{J)q���y:�8v$d1�_'��Z#��4�&��� ������e?� ���📁 6d
📄 e09c1ed5e8ddc7fce89980be12973c01a11eda
x��An�0{�+x/�I�A�� %�H
��1�^����l��>�3�=�2{-ds�e���" e)��P�\"����7�HT�y�Ʌ�<cՒÂ��J�GO��m�D��q�w������h*���|"#���5��@z�m�qo�|t�l','@��\��1%A�📁 6f
📄 63e622135211866796affb32cb80510c2657bf
x��K�1g�Sx��n;4B�$��a��F�p'`�vU�l[��^�k��`�;��Mɩp�ؒ�=���V4c���'xl�Ⱥ�RU���E}�.���LzF�P�w��H�3_{�um���(夜�p@F��5�c �ůȶ�y3x�{�����,�t�t"
O3C📁 85
📄 ae908eb7433398adbe2f0952cba3da13b7ffd4
x+)JMU01f040031QH�,�(M�/I-.�+�(a�*|�YrEO�ƣ�����6�j3 �'_
📁 91
📄 b680f568813ce64762c8d4925d13a4c936344f
xK��OR0�d(J-)-�S���R �������T[%�Ĝ�|�C%^�Z N
-
📁 95
📄 0d5023f008bcfb9ed200b0d54a652cce95f2c9
x��Aj1E��)�)�l�r(%��dYCS�N��w� ����m]�(���ݡ��Ѻ{g+��:s�̱/uh�yI�Cw��0{3�J��4u�^$��F�d6�" G���v�!F���^ǯ�]?�C�R U�b��o�%>"۪�n�|���g�3e�xI�R0�MmA�📄 4f464e4d2738c09d48511b6faf6027467ad099
x��A! =��ML��@b���J\ ٭�����mf��}U�W:�&ѳ$���BD)r��&�Jf�l)���b�������M|�7�̗*w�!�Ȼ gt����s��C��s�ʮ��11
📄 574f21f6226788d62e17fd1ff645660364b0b1
x+)JMU0�0f040031Qrut�u��Map�9,�0��H��DŽ?��m�̹XU�������_�Z\��S���l�ٛ.^s���\Wu�Г��j���G�e.۰Ɵ�wւ���Ҡ��3K2J� F�T�0l>�,��'u��?]W�yo�v�����4'��k�Y���m��-� ��N)475U(100�ҡW��`]�R���mwݮg,�(}��9]mybIrH�9����f
h,Wr�Yspj�!��jR����{J)q���y:�8v$d1�_'��Z#=��4�&��� ������e?� ��📁 96
📄 4dafef1f89558d5cab3e9c18e71fd545af898f
x��K
1D]����������Ƒ!���)j��U[�1��ƪJN{P�%�k������&�'�PR4oY�5(��\lS�$�R������LM=�
��gܗ�n�����ڟ2W9v��M9�H{0`���п��$�,�����2���>!�8�/t^B📁 97
📄 e7d7b8c88b13b3ef74056a9f6ea16d392ae308
x��A
1E]�ً��mڊ����&E�qd��w�n���m��� ����S�L]�%��F�+�.!���0�D�]W{
.����˥+"���Ac*R�0��]�����m��<����S=�]�RN�cH�Ȉ��n
�p��M��u<|�Z�#�� �(�|t_�As📁 9b
📄 301cbeeb6c53957d20434661b86f7da574f3e1
x+)JMU061g040031Q�K���M�K)��)M�+./`p��9�u���o�'�Z��H>�*FV˰Ơ;�/X̧�ޣ�_B��t���3K2J��KR�K�J*J�
�g�\ѓ��蟮��M�Z�UZP���P����|�6����T�����*��
���+�`��K){�붻n׳��w�>�͜���<�$9�x����Jr34�+9̬98����`5�EG��=��8���<�E;����݊E��k�RD�\��s��o����^ o���📁 ac
📄 308b6d0e53164c86ff2ee2b7f4543183362d20
xK��OR03`(J-)-�S���R �������T[%�Ĝ�|�C]����$��Ҝ����%^�Z^. ��k
📁 ae
📄 42c53e46a84dd4ca6f485f01735ec96f3558d9
x+)JMU0�0f040031Qrut�u��Map�9,�0��H��DŽ?��m�̹XU�������_�Z\��S�Ȱ�e��W��t�Nb�?|�j��긥��n>n���Y�� zA岳�~Bեg�d�&A�,�(a�*|�YrEO�ƣ�����6�j3TiAiNB��ڳN�ۜ��[���S�Rhnj�Pb``48�C�8���.�����]�.X�Q�`7s���Ē���m�s�W+���X��0�����CP�դ!!w��R�T˗�tq�H�b��Nv+�Fz �iJM�sA��m��y����~x mH��
📁 b5
📄 13cf0319a88c65b1c5fc8ad59e4bb696d57e03
xK��OR0�`100Tp�,�(MRH���KM.���S(I-.� ʳ�
📁 b6
📄 04af99ea67d7fa508a759207e642bf57a3d7a5
x-�;�0���;X���s.`��#����73K��ƏO>p���%%ʡ�r~��f?b����a�t(��r���s��k��t�l
\{�Q��W�s��.(^📄 bf6c53ab221e991028a72240997cc1958c00c2
x=P�J1����]�h�.B�ÖbU�ē�&�nt�,٬�У�����Lm�\�����T���&�O�NE������>.�Q;CB���P��P'�Q\ߊ�S9���r^
�L��!ϋ�1� I�C�
ЗP0F�v�,#f:��&k��@!90������M����0:q�'����m�:Е�5��O:`C��HP�b�e���*�2���G�XE��k ��ֆ8�@Nw�t'�����^�x�Ϸ_��-�oUL�?�.�W��)���|�=�.��M���+g��"�}�
📁 b7
📄 b38c54c415e68afc9247176eabe47d7e980616
xK��OR0402aH2�K��W��3a@��8R�s�Q��r�ʌ,���cS����몗��MrTl4FC��! �
A
📁 c5
📄 e32e27b8c4e01e192d60b74a86e72cb65c9580
x+)JMU023c040031Q�+100�O�,�/(���+��+./`HUO|���sE�w+�/���!9?771/�X/�4��q�@�W�
k��~g-����!
�hdFiR|Ijq�^IE �V��̒+zR7��uu���iW똁J�MM�N(O,I: �a����Jr34�+9̬98����\���"��rwO)%N�|9Ogǎ�,��d�bQkv����?d�����<p~A�� ��m
📁 c8
📄 9884f4d6e020ec45b4ddbfc995aae0c59ccec9
x+)JMU023d040031QH���M�K)��)Mdx!P���l���Y>��{lH��K�,�(M�/I-.�+�(a�*|�YrEO�ƣ�����6�j3Ti���a<P}|AiN�^q�u]J�+^��u��]����n��ZsSS���Ē���m�s�W+���X��0�����CP��jR����{J)q���y:�8v$d1�_'��Z#��5�&��� ������e?� h�j�📁 cd
📄 7ef74ff17546e77404697a4b217913dd0356fa
x+)JMU024g040031QH���M�K)��)Md��^��~O�@?u���xoG�<���̒�Ҥ�����������%W�n<����<�mӮ�1����*���Ǘ'�$g�g0l۟�ZIn���r%��5��0��V�Z�0X��)�ĩ�/��,�ؑ����V,j���Д� ������/�� �V�
📁 d0
📄 0b9c887269eca3ba6b581996c24546c618830d
xu��ΣV���)���.\��5�����a��͌�`�>�DʪS�ґ�tꔾ�k�r��Lc�3�a#��yc�r)L#y!�1�r��GD�i;��cx:KD�Y".R"�@�����3.�<�1�Sэ yD�=b+|����w]^�MT���0HD<+�H��i�~lN����w��ƴ��?�r*���}�,s�篒�������ޔܛ���� �s˒$+�d˶1��4Ga"�3+jI��kgK��k���)()�׀R��]��z�^�o�1u���s�{ඹ��������s
�t�c.���S�;xǯ6V+RjZ����|�B���!��=�.�R;?���I�.O�t��w�@�ͻAua6rv�J�75ŷ�fn�����jL�3j�yZ��� ���\|�y@��T�*.N��pUE7���A��Es�h�͍�1��=��Hi�ۮG){��syV��RJ�8e���d�gꤼ�!~�O���(�K�����#c� ��XAl��*N�LZ������7�h��_�{{!7ʷ3}�8���~:��V�ny�� ̙A�Eʄ@�٨{�G�e���j�Jmuq<#2>�Z��万ҋ�^���5_.E ���pR�č*�q�o扲^�x"C�k���]Er�[])�R��
����#:��h����/w[T��V��'���e[���w�z%ieW�Jk��t�F* 0xK�X��裲YE=��L߽�/[��k���>��g�ܯy��v��y��$�� +ݬ%ٝ^���A������cDĿLh��{"�[�DS
~q���[=G�Mq📁 d3
📄 150fd84921473d6e3477d463046fbf3c4576bc
x��A
�0E]��2I��D<�/�L�T�V��o�n>>/�|S�v���&0TtI(S
����8����v��̫��T;%C$j���|�(��Irʀ.W6e�iY��٣�=�{�k949Y���#u�`�wK��\���~���#���/%<�📄 fd9e6ba16ef4aaa2ef35967bcd6244ef1f7146
x��A�19��#���I@��>b?�=��A���.}iUWۺ,�T�0��`2)�U;��i��ˌ� �Թ�t���n�7`f���q���'-����J�;R���5n����ƞ?��eҳ�7�֛�̅���}k��@z�u�q7x=]G !��1 ]^��)B�
📁 d9
📄 a08f31a5dac0db79264f933947d80aee582db9
xK��OR0402aH2�K��W��3a@3�s2�d%�&%�c��Y��Ǧ���0>=�$��4'G�8��Q��
��@(�� ��"
📁 da
📄 28831b619e17c41a653e9cf22f262f97431f0f
x+)JMU061a040031Q�rut�u��M�+./`ؾ�'�賮?����V?����&U�������R��S���8B��+sن5�L��|le�ؐU��Y�Q�_�Z\�WRQ°U�<�䊞ԍG�t]��m��:f�҂Ҝ�B��g
���9?��8'�ϧ:
����T���0hp<H�^q�u]J�+^��u��]����n�t��%� ����V��)��\�af��=��. �I-B8B��)�ĩ�/��,�ؑ����V,j��^Ӕ� ������/�� �w��
📁 de
📄 03b716e89864826f2619736467c310ab03bccd
x+)JMU060b040031QH���M�K)��)Mdx!P���l���Y>��{lH��K�,�(M�/I-.�+�(a�*|�YrEO�ƣ�����6�j3TiAiNB��ڳN�ۜ��[���S�Rhnj�Pb``48�C�8���.�����]�.X�Q�`7s���Ē���m�s�W+���X��0�����CP�դ!!w��R�T˗�tq�H�b��Nv+�F`�iJM�sA��m��y����~x �xx📁 df
📄 4b277b0c47de2a302f65b3323f177e0d88769e
xEȱ �0P�@v���.��\ ���6�+�"mA����f�ڎ#��x[�λ���=�P��뼪Z�J6�*w��Ũa�=&�!W
📁 e3
📄 581077f50376b0ac4f02fb6aa0f1850748b066
xK��OR03b(J-)-�S���R ����ļ[�������T%�LIjE H�#1''_!��P��� �oQ
📁 e6
📄 32ab8169c5f79f24da3b0141348db441e928e3
x+)JMU047g040031QH�,�(M�/I-.�+�(a�*|�YrEO�ƣ�����6�j3P����B���a<P}|ybIr�^qö�9����f
h,Wr�Yspj�!��`5�E���RJ�j�r��"� Y����n��
M� ".����7�y�~�/ T�Ib
📄 9de29bb2d1d6434b8b29ae775ad8c2e48c5391
xK��OR0` ��
📄 b5b1cd41043a54e9ffe95ef9d46dffbc4d8041
x��AN19���Ev�$�
!����4�j��?�}��uu�ط� ���w������l�l�7v,y��k�6��p��I*���f��9��1%�܆Rb�h�=�c}�|!��3?�G��o�@Uj�[�W��a<������sd�t�<�뼃�\P.��Jr�� g9A�
📄 c87be170d0740ef8159ef76666071225277ea0
x��A�09��#��8��|��]RiU����\����m�4�:P�C_� �%YN6Z���4���S�5��Jn��>���M�e��c�\J�j�
��^�ފ��?���}ϻ�e�rV���̑"�#�k�[��ox�̓�W�mQ���N�Ot�!�!���C�
📁 e7
📄 9c2669bcf8c64cc4c67bc0b0b0658f8e88e401
x��K�0Y�ޣ"�ͷB�Cp�qE�J�*�?UO������2�S���6U��Sr��A�P��j-����g�lV���`�l�Ǫ,�$�����-h%���ճώ�
^����g��\�V�6�x��!\-9���
��,3�I`_+7B
���(��6�B�
📁 ee
📄 010cf61b65a81c05067c8f1be4db2691f8d413
x+)JMU023c040031Q�+100�O�,�/(���+��+./`����p��+�'[���z���!9?771/�X/�4��q�@�W�
k��~g-����!
�hdFiR|Ijq�^IE �V��̒+zR7��uu���iW똁J�MM�N(O,I: �a����Jr34�+9̬98����\���"��rwO)%N�|9Ogǎ�,��d�bQkv����?d�����<p~A�� \lc
📁 f3
📄 a90588db25d12ac4485625d858e47c690719bc
x��Qj1D��S�?$Ȳ�RB)=D/ �Z��v��ܿKN���_��>�
��29�Rz)&"Tњ�R���Q� ���m�7 ��T��^ٝ�Jsl{ꤳ�j0�d�q[7�E��5���[��{|C����� 1��ֈ����%�b���zv�TO�'b�|%����C📁 f4
📄 06880c46bc25dbcea377c5a5da510682a041dd
x��An!E���GS6DQ�C���J���;� �����oۺ�'P��y�A"am\:a���Q�Y�d�s�Y��z�cB�.5���5ؐ���6��C!����s�n� z��s����U?�}��,)`) .H���nM{p/��V��Ͻ�4 $^0/�J��XB�📁 f9
📄 a1230de261298c527c8b811b01c6c57240ae5a
x��K�0Y�ޣ"�i!�!�@>� �U�8�ٽyS�y~v`χ����&�%$��%m�m��e��u$�>i�wi�M��&R�8Ij-{.Y1�.�ssi�e�;"����W�s:U�E���x�#2�+��n�O��,s��ۧ�n��2�<ҙ��}7�A�📁 info
📁 pack
📁 refs
📁 heads
📄 main
3a22e7aab2cc8ae9de76352123f0762590076d75
📁 remotes
📁 origin
📄 main
3a22e7aab2cc8ae9de76352123f0762590076d75
📁 tags
📄 README.md
# T001
ComputerCraft Turtle Projekt
## Dateien
- commands.lua
- t001_test.lua
## Aktueller Stand
- Git Synchronisation eingerichtet
- commands.lua kann geladen werden
- Befehlsstruktur begonnen
## Nächster Schritt
T001 Hauptprogramm erstellen
📄 command_test.lua
local cmd = dofile("commands.lua")
print("T001 gestartet")
if cmd.command == "message" then
print(cmd.text)
end
📄 commands.lua
return {
command = "report"
}
return {
command = "inspect",
direction = "if"
}
📄 github_test.txt
T001 GitHub connection test
📄 pull_test.txt
Pull Test
📄 t001_git_pull.sh
#!/bin/bash
DIR="/home/djamba/Games/FTB/1.7/DJAMBARAMA/computer/1/t001"
echo "T001 Git-Pull-Watcher gestartet"
echo "Überwache: $DIR"
cd "$DIR" || exit 1
while true
do
git pull
sleep 60
done
📄 t001_git_watch.sh
#!/bin/bash
DIR="/home/djamba/Games/FTB/1.7/DJAMBARAMA/computer/1/t001"
cd "$DIR" || exit 1
echo "T001 Git-Watcher gestartet"
echo "Überwache: $DIR"
inotifywait -m -r -e close_write,create,delete,move "$DIR" |
while read path action file
do
echo "Änderung erkannt: $action $path$file"
git add -A
git commit -m "T001 automatic update $(date '+%Y-%m-%d %H:%M:%S')"
git push
done
📄 watcher_test.txt
Watcher funktioniert
📄 watcher_test2.txt
echter watcher test
📄 t001.lua
local reportFile = "t001_report.txt"
local cmd = dofile("t001/commands.lua")
local function writeSource(file, filename)
file.writeLine("")
file.writeLine("========================================")
file.writeLine("SOURCE: " .. filename)
file.writeLine("========================================")
local source = fs.open(filename, "r")
if not source then
file.writeLine("FEHLER: DATEI NICHT LESBAR")
return
end
while true do
local line = source.readLine()
if not line then
break
end
file.writeLine(line)
end
source.close()
end
local function createReport()
local file = fs.open(reportFile, "w")
if not file then
print("REPORT FEHLER")
return
end
file.writeLine("========================================")
file.writeLine("T001")
file.writeLine("========================================")
file.writeLine("POSITION = {")
file.writeLine(" [x] = 732")
file.writeLine(" [y] = 336")
file.writeLine(" [z] = 102")
file.writeLine("}")
file.writeLine("RICHTUNG = NORD")
local erkannt
local block
erkannt, block = custom.inspect("if")
file.writeLine("FRONT_ERKANNT = " .. tostring(erkannt))
if block then
file.writeLine("FRONT_BLOCK = {")
for k, v in pairs(block) do
file.writeLine(" [" .. tostring(k) .. "] = " .. tostring(v))
end
file.writeLine("}")
else
file.writeLine("FRONT_BLOCK = No block")
end
file.writeLine("")
file.writeLine("========================================")
file.writeLine("T001 QUELLCODE")
file.writeLine("========================================")
writeSource(file, "custom")
file.writeLine("")
file.writeLine("========================================")
file.writeLine("T001 ENDE")
file.writeLine("========================================")
file.close()
print("T001 REPORT ERSTELLT")
end
if cmd.command == "report" then
print("Report Befehl erhalten")
createReport()
end
if cmd.command == "inspect" then
local erkannt, block = custom.inspect(cmd.direction)
print("Erkannt:", erkannt)
if block then
print(block.name)
end
end
📄 t001_report.txt
========================================
T001
========================================
POSITION = {
[x] = 732
[y] = 336
[z] = 102
}
RICHTUNG = NORD
FRONT_ERKANNT = true
FRONT_BLOCK = {
[name] = minecraft:grass
[metadata] = 0
}
========================================
T001 QUELLCODE
========================================
========================================
SOURCE: custom
========================================
--[[ laden mit os.loadAPI("custom") ]]
--[[function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
]]
--[[function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS-Koordinaten:")
print("X: " .. x .. " Y: " .. y .. " Z: " .. z)
gpsPos = {
x = x,
y = y,
z = z
}
turtle.forward()
local x2,y2,z2 = gps.locate(5)
if x2 > x then
richtung = "Osten"
print("Ich schaue nach " .. richtung)
elseif x2 < x then
richtung = "Westen"
print("Ich schaue nach " .. richtung)
elseif z2 > z then
richtung = "Sueden"
print("Ich schaue nach " .. richtung)
elseif z2 < z then
richtung = "Norden"
print("Ich schaue nach " .. richtung)
end
turtle.back()
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
]]
function gpsStart(richtungTest)
local x,y,z = gps.locate(5)
if x then
print("GPS-Koordinaten:")
print("X: " .. x .. " Y: " .. y .. " Z: " .. z)
gpsPos = {
x = x,
y = y,
z = z
}
if richtungTest then
if turtle.forward() then
local x2,y2,z2 = gps.locate(5)
if x2 > x then
richtung = "Osten"
elseif x2 < x then
richtung = "Westen"
elseif z2 > z then
richtung = "Sueden"
elseif z2 < z then
richtung = "Norden"
end
turtle.back()
else
turtle.back()
local x2,y2,z2 = gps.locate(5)
if x2 > x then
richtung = "Westen"
elseif x2 < x then
richtung = "Osten"
elseif z2 > z then
richtung = "Norden"
elseif z2 < z then
richtung = "Sueden"
end
turtle.forward()
end
print("Ich schaue nach " .. richtung)
end
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function detect(richtung)
local result = false
if richtung == "df" then
result = turtle.detect()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
end
return result
end
function inspect(richtung)
local erkannt = false
local block = nil
if richtung == "if" then
erkannt, block = turtle.inspect()
elseif richtung == "ib" then
turtle.turnLeft()
turtle.turnLeft()
erkannt, block = turtle.inspect()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "il" then
turtle.turnLeft()
erkannt, block = turtle.inspect()
turtle.turnRight()
elseif richtung == "ir" then
turtle.turnRight()
erkannt, block = turtle.inspect()
turtle.turnLeft()
elseif richtung == "iu" then
erkannt, block = turtle.inspectUp()
elseif richtung == "id" then
erkannt, block = turtle.inspectDown()
end
return erkannt, block
end
function suck(richtung)
local result = false
if richtung == "sf" then
result = turtle.suck()
elseif richtung == "sb" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.suck()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "sl" then
turtle.turnLeft()
result = turtle.suck()
turtle.turnRight()
elseif richtung == "sr" then
turtle.turnRight()
result = turtle.suck()
turtle.turnLeft()
elseif richtung == "su" then
result = turtle.suckUp()
elseif richtung == "sd" then
result = turtle.suckDown()
end
return result
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pb" then
turtle.turnLeft()
turtle.turnLeft()
turtle.place()
turtle.turnRight()
turtle.turnRight()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end
========================================
T001 ENDE
========================================
📄 test.lua
--[[print("START")
local datei = fs.open(peripheral.getType("front") .. "_test.txt", "w")
print("DATEI GEÖFFNET")
datei.writeLine("Peripheral-Typ:")
datei.writeLine(peripheral.getType("front"))
datei.writeLine("")
datei.writeLine("Methoden:")
datei.writeLine("")
datei.writeLine(peripheral.call("front", "listMethods"))
local methoden = peripheral.getMethods("front")
for _, methode in ipairs(methoden) do
datei.writeLine(methode)
end
datei.close()
print("es wurde erkannt: " .. peripheral.getType("front"))
print("FERTIG")
=======================================================================================
print("START")
local datei = fs.open(peripheral.getType("front") .. "_test.txt", "w")
print("DATEI GEÖFFNET")
datei.writeLine("Peripheral-Typ:")
datei.writeLine(peripheral.getType("front"))
datei.writeLine("")
datei.writeLine("Methoden:")
datei.writeLine("")
local methoden = peripheral.getMethods("front")
for _, methode in ipairs(methoden) do
datei.writeLine(methode)
end
datei.writeLine("")
datei.writeLine("Methoden mit Parametern:")
datei.writeLine("")
local callmethoden = peripheral.call("front", "listMethods")
for methode in string.gmatch(callmethoden, "([^,]+)") do
datei.writeLine(methode)
end
datei.close()
print("es wurde erkannt: " .. peripheral.getType("front"))
print("FERTIG")]]
print("START")
local dateiname = peripheral.getType("front") .. "_test.txt"
if fs.exists(dateiname) then
print("Bereits vorhanden: " .. dateiname)
else
local datei = fs.open(dateiname, "w")
print("DATEI GEÖFFNET")
datei.writeLine("Peripheral-Typ:")
datei.writeLine(peripheral.getType("front"))
datei.writeLine("")
datei.writeLine("Methoden:")
datei.writeLine("")
local methoden = peripheral.getMethods("front")
for _, methode in ipairs(methoden) do
datei.writeLine(methode)
end
datei.writeLine("")
datei.writeLine("Methoden mit Parametern:")
datei.writeLine("")
local callmethoden = peripheral.call("front", "listMethods")
for methode in string.gmatch(callmethoden, "([^,]+)") do
datei.writeLine(methode)
end
datei.close()
end
print("es wurde erkannt: " .. peripheral.getType("front"))
print("FERTIG")
📄 tile_thermalexpansion_cell_resonant_name_test.txt
Peripheral-Typ:
tile_thermalexpansion_cell_resonant_name
Methoden:
hasWork
resetSides
setSide
expandStack
condenseItems
decrSide
canPlayerAccess
swapStacks
destroyStack
setRedstoneControl
pushItemIntoSlot
getNumConfig
getAdvancedMethodsData
getMaxEnergyStored
pushItem
getAllStacks
getOwnerName
getInventoryName
getAccess
pullItem
getEnergyStored
getRedstoneControl
getStackInSlot
allowYAxisFacing
listSources
incrSide
getInventorySize
rotateBlock
pullItemIntoSlot
listMethods
doc
getFacing
setFacing
Methoden mit Parametern:
allowYAxisFacing()
canPlayerAccess(username)
condenseItems()
decrSide(side)
destroyStack(slotNumber)
doc(method)
expandStack(stack)
getAccess()
getAdvancedMethodsData(method?)
getAllStacks(proxy?)
getEnergyStored(side?)
getFacing()
getInventoryName()
getInventorySize()
getMaxEnergyStored(side?)
getNumConfig(side)
getOwnerName()
getRedstoneControl()
getStackInSlot(slotNumber
proxy?)
hasWork()
incrSide(side)
listMethods(filterSource?)
listSources()
pullItem(direction
slot
maxAmount?
intoSlot?)
pullItemIntoSlot(direction
slot
maxAmount?
intoSlot?)
pushItem(direction
slot
maxAmount?
intoSlot?)
pushItemIntoSlot(direction
slot
maxAmount?
intoSlot?)
resetSides()
rotateBlock()
setFacing(side)
setRedstoneControl(control)
setSide(side
config)
swapStacks(from
to
fromDirection?
fromDirection?)
📄 time.lua
--[[local note = peripheral.wrap("front")
note.setPitch(12)
local start = os.clock()
for i = 1, 12 do
note.triggerNote()
note.incrementPitch()
sleep(0.03)
end
local ende = os.clock()
print("Dauer: " .. (ende - start))]]
-- erster Note Block
local note1 = peripheral.wrap("front")
-- zweiter Note Block
local note2 = peripheral.wrap("right")
note1.setPitch(12)
note2.setPitch(16)
note1.triggerNote()
note2.triggerNote()
📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 turtle_test.txt
Peripheral-Typ:
turtle
Methoden:
turnOn
shutdown
reboot
getID
isOn
Methoden mit Parametern:
📄 vergleich
--[[ --einfache erkennung und ausgabe
local erkannt, block = turtle.inspect()
if erkannt then
print("Block erkannt:")
print(block.name)
else
print("Kein Block vor der Turtle.")
end
]]
--[[ -- wenn bestimmter block, dann dig
local erkannt, block = turtle.inspect()
if erkannt then
if block.name == "minecraft:grass" then
turtle.dig()
end
end
]]
--[[ -- wenn NICHT bestimmter block, dann dig
local erkannt, block = turtle.inspect()
if erkannt then
if block.name ~= "minecraft:grass" then
turtle.dig()
end
end
]]
--[[-- direkter vergleich turtle-slot(1) gg minecraft:gold_ingot
-- und ausgabe
turtle.select(1)
local item = turtle.getItemDetail()
if item and item.name == "minecraft:gold_ingot" then
print("Goldbarren gefunden")
end]]
-- TURTLE ITEMS GG ERSTEN SLOT EINER KISTE ABGLEICHEN UND BEI UEBEREINSTIMMUNG EINLAGERN
-- Slot 1 muss leer sein
turtle.select(1)
-- Item aus der Kiste aufnehmen
turtle.suck()
-- Item aus Slot 1 ermitteln
local item = turtle.getItemDetail(1)
if item then
local itemname = item.name
local eingelagert = {}
print("Gesuchtes Item: " .. itemname)
-- Slots 2 bis 16 vergleichen
for i = 2, 16 do
local slotitem = turtle.getItemDetail(i)
if slotitem and slotitem.name == itemname then
-- Slot auswählen und Item zurück in die Kiste legen
turtle.select(i)
turtle.drop()
-- Slot zur Liste hinzufügen
eingelagert[#eingelagert + 1] = i
end
end
-- Ergebnis ausgeben
if #eingelagert > 0 then
print(itemname .. " aus Slot 1 wurde eingelagert.")
print("Betroffene Slots:")
for i = 1, #eingelagert do
print("Slot " .. eingelagert[i])
end
else
print("Keine passenden Slots für " .. itemname .. " gefunden.")
end
else
print("Slot 1 ist leer. Kein Item aus der Kiste erhalten.")
end
turtle.select(1)
turtle.drop()
📁 10
📄 2er.lua
function zwh() do
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
end
function zwv() do
custom.dig("dd",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dd",1)
end
zwv()
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 k1.lua
--[[local function bsp()
custom.dig("du",1)
custom.dig("df",1)
custom.dig("dd",1)
custom.dig("db",1)
custom.dig("dl",1)
custom.dig("dr",1)
end]]
--custom.dig("db",1)
--custom.dig("df",1)
--custom.dig("du",1)
--custom.dig("dd",1)
--custom.dig("df",1)
--custom.dig("db",1)
turtle.select(1)
local gleich = turtle.compare()
if gleich then
print("Gleicher Block")
else
print("Anderer Block")
end
📄 k2
--[[Vorne:
vor
vor-links
vor-rechts
vor-links-oben
vor-rechts-oben
vor-links-unten
vor-rechts-unten
Seite:
links
rechts
Hinten:
hinten
hinten-links
hinten-rechts
hinten-links-oben
hinten-rechts-oben
hinten-links-unten
hinten-rechts-unten
Oben:
oben
Unten:
unten]]
turtle.select(1)
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
📄 maria_scan.lua
-- maria_scan.lua
local modem = "left"
rednet.open(modem)
print("[T001] Suche Geräte...")
rednet.broadcast(
"MariaGPT T001 sucht C1000",
"maria"
)
local start = os.clock()
while os.clock() - start < 5 do
local id, msg, protocol =
rednet.receive("maria", 1)
if id then
print(
"Gerät gefunden:",
id
)
print(
"Antwort:",
msg
)
end
end
print("[T001] Suche beendet.")
📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw
custom.gpsStart()
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.gpsStart()
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📄 startup2.lua
-- startup.lua
-- DJAMBA Turtle Framework
print("DJAMBA Turtle Framework")
dofile("position.lua")
dofile("gps.lua")
dofile("custom.lua")
dofile("db.lua")
dofile("blocks.lua")
dofile("blueprint.lua")
print("Framework geladen")
GPS.update()
if fs.exists("main.lua") then
dofile("main.lua")
end
📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 1000
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📁 cprog
📄 hardware.lua
local sites = peripheral.getNames()
local devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
for name, device in pairs(devices) do
print(name .. " -> " .. device.site .. " (" .. device.type .. ")")
end
📄 lampe.lua
--redstone.setBundledOutput("right", 1)
--sleep(1.0)
--redstone.setBundledOutput("right", 0)
redstone.setBundledOutput("left", 2)
sleep(2.0)
redstone.setBundledOutput("left", 0)
--[[redstone.setOutput("right", true)
sleep(0.5)
redstone.setOutput("right", false)]]
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 redirect.lua
--term.redirect()
--term.restore()
local monL = peripheral.wrap("left")
local monR = peripheral.wrap("right")
term.redirect(monL)
print("Das erscheint links")
term.redirect(monR)
print("Das erscheint rechts")
📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 1001
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📁 cprog
📄 hardware.lua
local sites = peripheral.getNames()
local devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
for name, device in pairs(devices) do
print(name .. " -> " .. device.site .. " (" .. device.type .. ")")
end
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 1002
📄 1002
1002
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📁 cprog
📄 hardware.lua
local sites = peripheral.getNames()
local devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
for name, device in pairs(devices) do
print(name .. " -> " .. device.site .. " (" .. device.type .. ")")
end
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 1003
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📁 cprog
📄 hardware.lua
local sites = peripheral.getNames()
local devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
for name, device in pairs(devices) do
print(name .. " -> " .. device.site .. " (" .. device.type .. ")")
end
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 1004
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📁 cprog
📄 hardware.lua
local sites = peripheral.getNames()
local devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
for name, device in pairs(devices) do
print(name .. " -> " .. device.site .. " (" .. device.type .. ")")
end
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 1005
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📁 cprog
📄 hardware.lua
local sites = peripheral.getNames()
local devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
for name, device in pairs(devices) do
print(name .. " -> " .. device.site .. " (" .. device.type .. ")")
end
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 11
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 1100
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📁 cprog
📄 hardware.lua
local sites = peripheral.getNames()
local devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
for name, device in pairs(devices) do
print(name .. " -> " .. device.site .. " (" .. device.type .. ")")
end
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 12
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 1200
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📁 cprog
📄 hardware.lua
local sites = peripheral.getNames()
local devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
for name, device in pairs(devices) do
print(name .. " -> " .. device.site .. " (" .. device.type .. ")")
end
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 13
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 1300
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📁 cprog
📄 hardware.lua
local sites = peripheral.getNames()
local devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
for name, device in pairs(devices) do
print(name .. " -> " .. device.site .. " (" .. device.type .. ")")
end
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 14
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 1400
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📁 cprog
📄 hardware.lua
local sites = peripheral.getNames()
local devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
for name, device in pairs(devices) do
print(name .. " -> " .. device.site .. " (" .. device.type .. ")")
end
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 15
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 16
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 17
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 18
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 19
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 2
📄 2er.lua
function zwh() do
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
end
function zwv() do
custom.dig("dd",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dd",1)
end
zwv()
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 k1.lua
--[[local function bsp()
custom.dig("du",1)
custom.dig("df",1)
custom.dig("dd",1)
custom.dig("db",1)
custom.dig("dl",1)
custom.dig("dr",1)
end]]
--custom.dig("db",1)
--custom.dig("df",1)
--custom.dig("du",1)
--custom.dig("dd",1)
--custom.dig("df",1)
--custom.dig("db",1)
turtle.select(1)
local gleich = turtle.compare()
if gleich then
print("Gleicher Block")
else
print("Anderer Block")
end
📄 k2
--[[Vorne:
vor
vor-links
vor-rechts
vor-links-oben
vor-rechts-oben
vor-links-unten
vor-rechts-unten
Seite:
links
rechts
Hinten:
hinten
hinten-links
hinten-rechts
hinten-links-oben
hinten-rechts-oben
hinten-links-unten
hinten-rechts-unten
Oben:
oben
Unten:
unten]]
turtle.select(1)
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
📄 maria_scan.lua
-- maria_scan.lua
local modem = "left"
rednet.open(modem)
print("[T001] Suche Geräte...")
rednet.broadcast(
"MariaGPT T001 sucht C1000",
"maria"
)
local start = os.clock()
while os.clock() - start < 5 do
local id, msg, protocol =
rednet.receive("maria", 1)
if id then
print(
"Gerät gefunden:",
id
)
print(
"Antwort:",
msg
)
end
end
print("[T001] Suche beendet.")
📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw
custom.gpsStart()
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.gpsStart()
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📄 startup2.lua
-- startup.lua
-- DJAMBA Turtle Framework
print("DJAMBA Turtle Framework")
dofile("position.lua")
dofile("gps.lua")
dofile("custom.lua")
dofile("db.lua")
dofile("blocks.lua")
dofile("blueprint.lua")
print("Framework geladen")
GPS.update()
if fs.exists("main.lua") then
dofile("main.lua")
end
📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 20
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 200
📄 2er.lua
function zwh() do
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
end
function zwv() do
custom.dig("dd",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dd",1)
end
zwv()
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 k1.lua
--[[local function bsp()
custom.dig("du",1)
custom.dig("df",1)
custom.dig("dd",1)
custom.dig("db",1)
custom.dig("dl",1)
custom.dig("dr",1)
end]]
--custom.dig("db",1)
--custom.dig("df",1)
--custom.dig("du",1)
--custom.dig("dd",1)
--custom.dig("df",1)
--custom.dig("db",1)
turtle.select(1)
local gleich = turtle.compare()
if gleich then
print("Gleicher Block")
else
print("Anderer Block")
end
📄 k2
--[[Vorne:
vor
vor-links
vor-rechts
vor-links-oben
vor-rechts-oben
vor-links-unten
vor-rechts-unten
Seite:
links
rechts
Hinten:
hinten
hinten-links
hinten-rechts
hinten-links-oben
hinten-rechts-oben
hinten-links-unten
hinten-rechts-unten
Oben:
oben
Unten:
unten]]
turtle.select(1)
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
📄 maria_scan.lua
-- maria_scan.lua
local modem = "left"
rednet.open(modem)
print("[T001] Suche Geräte...")
rednet.broadcast(
"MariaGPT T001 sucht C1000",
"maria"
)
local start = os.clock()
while os.clock() - start < 5 do
local id, msg, protocol =
rednet.receive("maria", 1)
if id then
print(
"Gerät gefunden:",
id
)
print(
"Antwort:",
msg
)
end
end
print("[T001] Suche beendet.")
📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw
custom.gpsStart()
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.gpsStart()
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📄 startup2.lua
-- startup.lua
-- DJAMBA Turtle Framework
print("DJAMBA Turtle Framework")
dofile("position.lua")
dofile("gps.lua")
dofile("custom.lua")
dofile("db.lua")
dofile("blocks.lua")
dofile("blueprint.lua")
print("Framework geladen")
GPS.update()
if fs.exists("main.lua") then
dofile("main.lua")
end
📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 21
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 22
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 23
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 24
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 25
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 26
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 27
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 3
📄 2er.lua
function zwh() do
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
end
function zwv() do
custom.dig("dd",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dd",1)
end
zwv()
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 k1.lua
--[[local function bsp()
custom.dig("du",1)
custom.dig("df",1)
custom.dig("dd",1)
custom.dig("db",1)
custom.dig("dl",1)
custom.dig("dr",1)
end]]
--custom.dig("db",1)
--custom.dig("df",1)
--custom.dig("du",1)
--custom.dig("dd",1)
--custom.dig("df",1)
--custom.dig("db",1)
turtle.select(1)
local gleich = turtle.compare()
if gleich then
print("Gleicher Block")
else
print("Anderer Block")
end
📄 k2
--[[Vorne:
vor
vor-links
vor-rechts
vor-links-oben
vor-rechts-oben
vor-links-unten
vor-rechts-unten
Seite:
links
rechts
Hinten:
hinten
hinten-links
hinten-rechts
hinten-links-oben
hinten-rechts-oben
hinten-links-unten
hinten-rechts-unten
Oben:
oben
Unten:
unten]]
turtle.select(1)
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
📄 maria_scan.lua
-- maria_scan.lua
local modem = "left"
rednet.open(modem)
print("[T001] Suche Geräte...")
rednet.broadcast(
"MariaGPT T001 sucht C1000",
"maria"
)
local start = os.clock()
while os.clock() - start < 5 do
local id, msg, protocol =
rednet.receive("maria", 1)
if id then
print(
"Gerät gefunden:",
id
)
print(
"Antwort:",
msg
)
end
end
print("[T001] Suche beendet.")
📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw
custom.gpsStart()
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.gpsStart()
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📄 startup2.lua
-- startup.lua
-- DJAMBA Turtle Framework
print("DJAMBA Turtle Framework")
dofile("position.lua")
dofile("gps.lua")
dofile("custom.lua")
dofile("db.lua")
dofile("blocks.lua")
dofile("blueprint.lua")
print("Framework geladen")
GPS.update()
if fs.exists("main.lua") then
dofile("main.lua")
end
📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 4
📄 2er.lua
function zwh() do
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
end
function zwv() do
custom.dig("dd",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dd",1)
end
zwv()
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 k1.lua
--[[local function bsp()
custom.dig("du",1)
custom.dig("df",1)
custom.dig("dd",1)
custom.dig("db",1)
custom.dig("dl",1)
custom.dig("dr",1)
end]]
--custom.dig("db",1)
--custom.dig("df",1)
--custom.dig("du",1)
--custom.dig("dd",1)
--custom.dig("df",1)
--custom.dig("db",1)
turtle.select(1)
local gleich = turtle.compare()
if gleich then
print("Gleicher Block")
else
print("Anderer Block")
end
📄 k2
--[[Vorne:
vor
vor-links
vor-rechts
vor-links-oben
vor-rechts-oben
vor-links-unten
vor-rechts-unten
Seite:
links
rechts
Hinten:
hinten
hinten-links
hinten-rechts
hinten-links-oben
hinten-rechts-oben
hinten-links-unten
hinten-rechts-unten
Oben:
oben
Unten:
unten]]
turtle.select(1)
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
📄 maria_scan.lua
-- maria_scan.lua
local modem = "left"
rednet.open(modem)
print("[T001] Suche Geräte...")
rednet.broadcast(
"MariaGPT T001 sucht C1000",
"maria"
)
local start = os.clock()
while os.clock() - start < 5 do
local id, msg, protocol =
rednet.receive("maria", 1)
if id then
print(
"Gerät gefunden:",
id
)
print(
"Antwort:",
msg
)
end
end
print("[T001] Suche beendet.")
📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw
custom.gpsStart()
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.gpsStart()
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📄 startup2.lua
-- startup.lua
-- DJAMBA Turtle Framework
print("DJAMBA Turtle Framework")
dofile("position.lua")
dofile("gps.lua")
dofile("custom.lua")
dofile("db.lua")
dofile("blocks.lua")
dofile("blueprint.lua")
print("Framework geladen")
GPS.update()
if fs.exists("main.lua") then
dofile("main.lua")
end
📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 5
📄 2er.lua
function zwh() do
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
end
function zwv() do
custom.dig("dd",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dd",1)
end
zwv()
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 k1.lua
--[[local function bsp()
custom.dig("du",1)
custom.dig("df",1)
custom.dig("dd",1)
custom.dig("db",1)
custom.dig("dl",1)
custom.dig("dr",1)
end]]
--custom.dig("db",1)
--custom.dig("df",1)
--custom.dig("du",1)
--custom.dig("dd",1)
--custom.dig("df",1)
--custom.dig("db",1)
turtle.select(1)
local gleich = turtle.compare()
if gleich then
print("Gleicher Block")
else
print("Anderer Block")
end
📄 k2
--[[Vorne:
vor
vor-links
vor-rechts
vor-links-oben
vor-rechts-oben
vor-links-unten
vor-rechts-unten
Seite:
links
rechts
Hinten:
hinten
hinten-links
hinten-rechts
hinten-links-oben
hinten-rechts-oben
hinten-links-unten
hinten-rechts-unten
Oben:
oben
Unten:
unten]]
turtle.select(1)
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
📄 maria_scan.lua
-- maria_scan.lua
local modem = "left"
rednet.open(modem)
print("[T001] Suche Geräte...")
rednet.broadcast(
"MariaGPT T001 sucht C1000",
"maria"
)
local start = os.clock()
while os.clock() - start < 5 do
local id, msg, protocol =
rednet.receive("maria", 1)
if id then
print(
"Gerät gefunden:",
id
)
print(
"Antwort:",
msg
)
end
end
print("[T001] Suche beendet.")
📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw
custom.gpsStart()
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.gpsStart()
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📄 startup2.lua
-- startup.lua
-- DJAMBA Turtle Framework
print("DJAMBA Turtle Framework")
dofile("position.lua")
dofile("gps.lua")
dofile("custom.lua")
dofile("db.lua")
dofile("blocks.lua")
dofile("blueprint.lua")
print("Framework geladen")
GPS.update()
if fs.exists("main.lua") then
dofile("main.lua")
end
📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 6
📄 2er.lua
function zwh() do
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
end
function zwv() do
custom.dig("dd",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dd",1)
end
zwv()
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 k1.lua
--[[local function bsp()
custom.dig("du",1)
custom.dig("df",1)
custom.dig("dd",1)
custom.dig("db",1)
custom.dig("dl",1)
custom.dig("dr",1)
end]]
--custom.dig("db",1)
--custom.dig("df",1)
--custom.dig("du",1)
--custom.dig("dd",1)
--custom.dig("df",1)
--custom.dig("db",1)
turtle.select(1)
local gleich = turtle.compare()
if gleich then
print("Gleicher Block")
else
print("Anderer Block")
end
📄 k2
--[[Vorne:
vor
vor-links
vor-rechts
vor-links-oben
vor-rechts-oben
vor-links-unten
vor-rechts-unten
Seite:
links
rechts
Hinten:
hinten
hinten-links
hinten-rechts
hinten-links-oben
hinten-rechts-oben
hinten-links-unten
hinten-rechts-unten
Oben:
oben
Unten:
unten]]
turtle.select(1)
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
📄 maria_scan.lua
-- maria_scan.lua
local modem = "left"
rednet.open(modem)
print("[T001] Suche Geräte...")
rednet.broadcast(
"MariaGPT T001 sucht C1000",
"maria"
)
local start = os.clock()
while os.clock() - start < 5 do
local id, msg, protocol =
rednet.receive("maria", 1)
if id then
print(
"Gerät gefunden:",
id
)
print(
"Antwort:",
msg
)
end
end
print("[T001] Suche beendet.")
📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw
custom.gpsStart()
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.gpsStart()
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📄 startup2.lua
-- startup.lua
-- DJAMBA Turtle Framework
print("DJAMBA Turtle Framework")
dofile("position.lua")
dofile("gps.lua")
dofile("custom.lua")
dofile("db.lua")
dofile("blocks.lua")
dofile("blueprint.lua")
print("Framework geladen")
GPS.update()
if fs.exists("main.lua") then
dofile("main.lua")
end
📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 7
📄 2er.lua
function zwh() do
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
end
function zwv() do
custom.dig("dd",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dd",1)
end
zwv()
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 k1.lua
--[[local function bsp()
custom.dig("du",1)
custom.dig("df",1)
custom.dig("dd",1)
custom.dig("db",1)
custom.dig("dl",1)
custom.dig("dr",1)
end]]
--custom.dig("db",1)
--custom.dig("df",1)
--custom.dig("du",1)
--custom.dig("dd",1)
--custom.dig("df",1)
--custom.dig("db",1)
turtle.select(1)
local gleich = turtle.compare()
if gleich then
print("Gleicher Block")
else
print("Anderer Block")
end
📄 k2
--[[Vorne:
vor
vor-links
vor-rechts
vor-links-oben
vor-rechts-oben
vor-links-unten
vor-rechts-unten
Seite:
links
rechts
Hinten:
hinten
hinten-links
hinten-rechts
hinten-links-oben
hinten-rechts-oben
hinten-links-unten
hinten-rechts-unten
Oben:
oben
Unten:
unten]]
turtle.select(1)
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
📄 maria_scan.lua
-- maria_scan.lua
local modem = "left"
rednet.open(modem)
print("[T001] Suche Geräte...")
rednet.broadcast(
"MariaGPT T001 sucht C1000",
"maria"
)
local start = os.clock()
while os.clock() - start < 5 do
local id, msg, protocol =
rednet.receive("maria", 1)
if id then
print(
"Gerät gefunden:",
id
)
print(
"Antwort:",
msg
)
end
end
print("[T001] Suche beendet.")
📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw
custom.gpsStart()
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.gpsStart()
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📄 startup2.lua
-- startup.lua
-- DJAMBA Turtle Framework
print("DJAMBA Turtle Framework")
dofile("position.lua")
dofile("gps.lua")
dofile("custom.lua")
dofile("db.lua")
dofile("blocks.lua")
dofile("blueprint.lua")
print("Framework geladen")
GPS.update()
if fs.exists("main.lua") then
dofile("main.lua")
end
📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 8
📄 2er.lua
function zwh() do
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
end
function zwv() do
custom.dig("dd",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dd",1)
end
zwv()
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 k1.lua
--[[local function bsp()
custom.dig("du",1)
custom.dig("df",1)
custom.dig("dd",1)
custom.dig("db",1)
custom.dig("dl",1)
custom.dig("dr",1)
end]]
--custom.dig("db",1)
--custom.dig("df",1)
--custom.dig("du",1)
--custom.dig("dd",1)
--custom.dig("df",1)
--custom.dig("db",1)
turtle.select(1)
local gleich = turtle.compare()
if gleich then
print("Gleicher Block")
else
print("Anderer Block")
end
📄 k2
--[[Vorne:
vor
vor-links
vor-rechts
vor-links-oben
vor-rechts-oben
vor-links-unten
vor-rechts-unten
Seite:
links
rechts
Hinten:
hinten
hinten-links
hinten-rechts
hinten-links-oben
hinten-rechts-oben
hinten-links-unten
hinten-rechts-unten
Oben:
oben
Unten:
unten]]
turtle.select(1)
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
📄 maria_scan.lua
-- maria_scan.lua
local modem = "left"
rednet.open(modem)
print("[T001] Suche Geräte...")
rednet.broadcast(
"MariaGPT T001 sucht C1000",
"maria"
)
local start = os.clock()
while os.clock() - start < 5 do
local id, msg, protocol =
rednet.receive("maria", 1)
if id then
print(
"Gerät gefunden:",
id
)
print(
"Antwort:",
msg
)
end
end
print("[T001] Suche beendet.")
📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw
custom.gpsStart()
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.gpsStart()
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📄 startup2.lua
-- startup.lua
-- DJAMBA Turtle Framework
print("DJAMBA Turtle Framework")
dofile("position.lua")
dofile("gps.lua")
dofile("custom.lua")
dofile("db.lua")
dofile("blocks.lua")
dofile("blueprint.lua")
print("Framework geladen")
GPS.update()
if fs.exists("main.lua") then
dofile("main.lua")
end
📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 9
📄 2er.lua
function zwh() do
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
end
function zwv() do
custom.dig("dd",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dd",1)
end
zwv()
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function gpsStart()
local x,y,z = gps.locate(5)
if x then
print("GPS erkannt:")
print("X:",x)
print("Y:",y)
print("Z:",z)
gpsPos = {
x = x,
y = y,
z = z
}
return gpsPos
else
print("Kein GPS Signal")
return nil
end
end
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function digU()
turtle.digUp()
while turtle.detectUp() do
turtle.digUp()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
digU()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "pf" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 k1.lua
--[[local function bsp()
custom.dig("du",1)
custom.dig("df",1)
custom.dig("dd",1)
custom.dig("db",1)
custom.dig("dl",1)
custom.dig("dr",1)
end]]
--custom.dig("db",1)
--custom.dig("df",1)
--custom.dig("du",1)
--custom.dig("dd",1)
--custom.dig("df",1)
--custom.dig("db",1)
turtle.select(1)
local gleich = turtle.compare()
if gleich then
print("Gleicher Block")
else
print("Anderer Block")
end
📄 k2
--[[Vorne:
vor
vor-links
vor-rechts
vor-links-oben
vor-rechts-oben
vor-links-unten
vor-rechts-unten
Seite:
links
rechts
Hinten:
hinten
hinten-links
hinten-rechts
hinten-links-oben
hinten-rechts-oben
hinten-links-unten
hinten-rechts-unten
Oben:
oben
Unten:
unten]]
turtle.select(1)
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
for i = 1,7 do
turtle.forward()
turtle.digDown()
turtle.placeDown()
end
📄 maria_scan.lua
-- maria_scan.lua
local modem = "left"
rednet.open(modem)
print("[T001] Suche Geräte...")
rednet.broadcast(
"MariaGPT T001 sucht C1000",
"maria"
)
local start = os.clock()
while os.clock() - start < 5 do
local id, msg, protocol =
rednet.receive("maria", 1)
if id then
print(
"Gerät gefunden:",
id
)
print(
"Antwort:",
msg
)
end
end
print("[T001] Suche beendet.")
📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw
custom.gpsStart()
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.gpsStart()
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📄 startup2.lua
-- startup.lua
-- DJAMBA Turtle Framework
print("DJAMBA Turtle Framework")
dofile("position.lua")
dofile("gps.lua")
dofile("custom.lua")
dofile("db.lua")
dofile("blocks.lua")
dofile("blueprint.lua")
print("Framework geladen")
GPS.update()
if fs.exists("main.lua") then
dofile("main.lua")
end
📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📁 999
📄 350.lua
while true do
commands.exec("time set 2500")
sleep(350)
end
📄 blocks.lua
return {
[1] = {
[0] = "Stone",
},
[2] = {
[0] = "Grass Block",
},
[3] = {
[0] = "Dirt",
},
[4] = {
[0] = "Cobblestone",
},
[5] = {
[0] = "Oak Planks",
[1] = "Spruce Planks",
[2] = "Birch Planks",
[3] = "Jungle Planks",
},
[6] = {
[0] = "Oak Sapling",
},
[7] = {
[0] = "Bedrock",
},
[8] = {
[0] = "Water",
},
[9] = {
[0] = "Stationary Water",
},
[10] = {
[0] = "Lava",
},
[11] = {
[0] = "Stationary Lava",
},
[12] = {
[0] = "Sand",
[1] = "Red Sand",
},
[13] = {
[0] = "Gravel",
},
[14] = {
[0] = "Gold Ore",
},
[15] = {
[0] = "Iron Ore",
},
[16] = {
[0] = "Coal Ore",
},
[17] = {
[0] = "Oak Log",
[1] = "Spruce Log",
[2] = "Birch Log",
[3] = "Jungle Log",
},
[18] = {
[0] = "Oak Leaves",
[1] = "Spruce Leaves",
[2] = "Birch Leaves",
[3] = "Jungle Leaves",
},
[19] = {
[0] = "Sponge",
},
[20] = {
[0] = "Glass",
},
[21] = {
[0] = "Lapis Lazuli Ore",
},
[22] = {
[0] = "Lapis Lazuli Block",
},
[23] = {
[0] = "Dispenser",
},
[24] = {
[0] = "Sandstone",
[1] = "Chiseled Sandstone",
[2] = "Smooth Sandstone",
},
[25] = {
[0] = "Note Block",
},
[26] = {
[0] = "Bed",
},
[27] = {
[0] = "Powered Rail",
},
[28] = {
[0] = "Detector Rail",
},
[29] = {
[0] = "Sticky Piston",
},
[30] = {
[0] = "Cobweb",
},
[31] = {
[0] = "Dead Shrub",
[1] = "Grass",
[2] = "Fern",
},
[32] = {
[0] = "Dead Bush",
},
[33] = {
[0] = "Piston",
},
[35] = {
[0] = "White Wool",
[1] = "Orange Wool",
[2] = "Magenta Wool",
[3] = "Light Blue Wool",
[4] = "Yellow Wool",
[5] = "Lime Wool",
[6] = "Pink Wool",
[7] = "Gray Wool",
[8] = "Light Gray Wool",
[9] = "Cyan Wool",
[10] = "Purple Wool",
[11] = "Blue Wool",
[12] = "Brown Wool",
[13] = "Green Wool",
[14] = "Red Wool",
[15] = "Black Wool",
},
[37] = {
[0] = "Dandelion",
},
[38] = {
[0] = "Poppy",
},
[39] = {
[0] = "Brown Mushroom",
},
[40] = {
[0] = "Red Mushroom",
},
[41] = {
[0] = "Gold Block",
},
[42] = {
[0] = "Iron Block",
},
[43] = {
[0] = "Double Stone Slab",
},
[44] = {
[0] = "Stone Slab",
},
[45] = {
[0] = "Brick Block",
},
[46] = {
[0] = "TNT",
},
[47] = {
[0] = "Bookshelf",
},
[48] = {
[0] = "Moss Stone",
},
[49] = {
[0] = "Obsidian",
},
[50] = {
[0] = "Torch",
},
[51] = {
[0] = "Fire",
},
[52] = {
[0] = "Monster Spawner",
},
[53] = {
[0] = "Oak Wood Stairs",
},
[54] = {
[0] = "Chest",
},
[56] = {
[0] = "Diamond Ore",
},
[57] = {
[0] = "Diamond Block",
},
[58] = {
[0] = "Crafting Table",
},
[59] = {
[0] = "Wheat Crops",
},
[60] = {
[0] = "Farmland",
},
[61] = {
[0] = "Furnace",
},
[62] = {
[0] = "Burning Furnace",
},
[63] = {
[0] = "Standing Sign",
},
[64] = {
[0] = "Wooden Door",
},
[65] = {
[0] = "Ladder",
},
[66] = {
[0] = "Rail",
},
[67] = {
[0] = "Cobblestone Stairs",
},
[68] = {
[0] = "Wall Sign",
},
[69] = {
[0] = "Lever",
},
[70] = {
[0] = "Stone Pressure Plate",
},
[71] = {
[0] = "Iron Door",
},
[72] = {
[0] = "Wooden Pressure Plate",
},
[73] = {
[0] = "Redstone Ore",
},
[74] = {
[0] = "Glowing Redstone Ore",
},
[75] = {
[0] = "Redstone Torch",
},
[76] = {
[0] = "Lit Redstone Torch",
},
[77] = {
[0] = "Stone Button",
},
[78] = {
[0] = "Snow Layer",
},
[79] = {
[0] = "Ice",
},
[80] = {
[0] = "Snow Block",
},
[81] = {
[0] = "Cactus",
},
[82] = {
[0] = "Clay",
},
[83] = {
[0] = "Sugar Cane",
},
[84] = {
[0] = "Jukebox",
},
[85] = {
[0] = "Fence",
},
[86] = {
[0] = "Pumpkin",
},
[87] = {
[0] = "Netherrack",
},
[88] = {
[0] = "Soul Sand",
},
[89] = {
[0] = "Glowstone",
},
[90] = {
[0] = "Nether Portal",
},
[91] = {
[0] = "Jack O Lantern",
},
[92] = {
[0] = "Cake",
},
[93] = {
[0] = "Repeater",
},
[94] = {
[0] = "Powered Repeater",
},
[95] = {
[0] = "Stained Glass",
},
[96] = {
[0] = "Trapdoor",
},
[97] = {
[0] = "Monster Egg",
},
[98] = {
[0] = "Stone Bricks",
},
[99] = {
[0] = "Brown Mushroom Block",
},
[100] = {
[0] = "Red Mushroom Block",
},
[101] = {
[0] = "Iron Bars",
},
[102] = {
[0] = "Glass Pane",
},
[103] = {
[0] = "Melon Block",
},
[104] = {
[0] = "Pumpkin Stem",
},
[105] = {
[0] = "Melon Stem",
},
[106] = {
[0] = "Vines",
},
[107] = {
[0] = "Fence Gate",
},
[108] = {
[0] = "Brick Stairs",
},
[109] = {
[0] = "Stone Brick Stairs",
},
[110] = {
[0] = "Mycelium",
},
[111] = {
[0] = "Lily Pad",
},
[112] = {
[0] = "Nether Brick",
},
[113] = {
[0] = "Nether Brick Fence",
},
[114] = {
[0] = "Nether Brick Stairs",
},
[115] = {
[0] = "Nether Wart",
},
[116] = {
[0] = "Enchantment Table",
},
[117] = {
[0] = "Brewing Stand",
},
[118] = {
[0] = "Cauldron",
},
[119] = {
[0] = "End Portal",
},
[120] = {
[0] = "End Portal Frame",
},
[121] = {
[0] = "End Stone",
},
[122] = {
[0] = "Dragon Egg",
},
[123] = {
[0] = "Redstone Lamp",
},
[124] = {
[0] = "Lit Redstone Lamp",
},
[125] = {
[0] = "Double Wood Slab",
},
[126] = {
[0] = "Wood Slab",
},
[127] = {
[0] = "Cocoa Plant",
},
[128] = {
[0] = "Sandstone Stairs",
},
[129] = {
[0] = "Emerald Ore",
},
[130] = {
[0] = "Ender Chest",
},
[131] = {
[0] = "Tripwire Hook",
},
[132] = {
[0] = "Tripwire",
},
[133] = {
[0] = "Emerald Block",
},
[134] = {
[0] = "Spruce Wood Stairs",
},
[135] = {
[0] = "Birch Wood Stairs",
},
[136] = {
[0] = "Jungle Wood Stairs",
},
[137] = {
[0] = "Command Block",
},
[138] = {
[0] = "Beacon",
},
[139] = {
[0] = "Cobblestone Wall",
},
[140] = {
[0] = "Flower Pot",
},
[141] = {
[0] = "Carrots",
},
[142] = {
[0] = "Potatoes",
},
[143] = {
[0] = "Wooden Button",
},
[144] = {
[0] = "Skull",
},
[145] = {
[0] = "Anvil",
},
[146] = {
[0] = "Trapped Chest",
},
[147] = {
[0] = "Light Weighted Pressure Plate",
},
[148] = {
[0] = "Heavy Weighted Pressure Plate",
},
[149] = {
[0] = "Comparator",
},
[150] = {
[0] = "Powered Comparator",
},
[151] = {
[0] = "Daylight Sensor",
},
[152] = {
[0] = "Redstone Block",
},
[153] = {
[0] = "Nether Quartz Ore",
},
[154] = {
[0] = "Hopper",
},
[155] = {
[0] = "Quartz Block",
},
[156] = {
[0] = "Quartz Stairs",
},
[157] = {
[0] = "Activator Rail",
},
[158] = {
[0] = "Dropper",
},
[159] = {
[0] = "White Stained Clay",
},
[160] = {
[0] = "Stained Glass Pane",
},
[161] = {
[0] = "Acacia Leaves",
},
[162] = {
[0] = "Acacia Log",
},
[163] = {
[0] = "Acacia Stairs",
},
[164] = {
[0] = "Dark Oak Stairs",
},
[165] = {
[0] = "Slime Block",
},
}
📁 cprog
📄 hardware.lua
local sites = peripheral.getNames()
local devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
for name, device in pairs(devices) do
print(name .. " -> " .. device.site .. " (" .. device.type .. ")")
end
📄 custom
--[[ laden mit os.loadAPI("custom") ]]
function hw()
local sites = peripheral.getNames()
devices = {}
for _, site in ipairs(sites) do
local dtype = peripheral.getType(site)
local name = "unknown"
if dtype == "monitor" then
if site == "left" then
name = "monL"
elseif site == "right" then
name = "monR"
elseif site == "top" then
name = "monT"
elseif site == "bottom" then
name = "monBo"
elseif site == "back" then
name = "monBa"
end
elseif dtype == "modem" then
local modem = peripheral.wrap(site)
if modem.isWireless() then
if site == "left" then
name = "wmodL"
elseif site == "right" then
name = "wmodR"
elseif site == "top" then
name = "wmodT"
elseif site == "bottom" then
name = "wmodBo"
elseif site == "back" then
name = "wmodBa"
end
else
if site == "left" then
name = "modL"
elseif site == "right" then
name = "modR"
elseif site == "top" then
name = "modT"
elseif site == "bottom" then
name = "modBo"
elseif site == "back" then
name = "modBa"
end
end
elseif dtype == "printer" then
if site == "left" then
name = "printL"
elseif site == "right" then
name = "printR"
elseif site == "top" then
name = "printT"
elseif site == "bottom" then
name = "printBo"
elseif site == "back" then
name = "printBa"
end
elseif dtype == "drive" then
if site == "left" then
name = "diskL"
elseif site == "right" then
name = "diskR"
elseif site == "top" then
name = "diskT"
elseif site == "bottom" then
name = "diskBo"
elseif site == "back" then
name = "diskBa"
end
end
devices[name] = {
site = site,
type = dtype
}
end
print("Folgende Geraete wurden erkannt:")
for name, device in pairs(devices) do
print(device.type .. " -> " .. device.site)
end
end
if turtle then
function move(richtung, anzahl)
for i = 1, anzahl do
if richtung == "mf" then
turtle.forward()
elseif richtung == "mb" then
turtle.back()
elseif richtung == "mu" then
turtle.up()
elseif richtung == "md" then
turtle.down()
elseif richtung == "ml" then
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
elseif richtung == "mr" then
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
end
end
function harvest(richtung)
if richtung == "df" then
turtle.dig()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
turtle.dig()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
end
end
function digForward()
turtle.dig()
while turtle.detect() do
turtle.dig()
end
end
function dig(richtung)
if richtung == "df" then
digForward()
elseif richtung == "du" then
turtle.digUp()
elseif richtung == "dd" then
turtle.digDown()
elseif richtung == "dr" then
turtle.turnRight()
digForward()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
digForward()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
digForward()
turtle.turnRight()
turtle.turnRight()
end
end
function place(richtung)
if richtung == "p" then
turtle.place()
elseif richtung == "pu" then
turtle.placeUp()
elseif richtung == "pd" then
turtle.placeDown()
elseif richtung == "pr" then
turtle.turnRight()
turtle.place()
turtle.turnLeft()
elseif richtung == "pl" then
turtle.turnLeft()
turtle.place()
turtle.turnRight()
end
end
function detect(richtung)
local result = false
if richtung == "d" then
result = turtle.detect()
elseif richtung == "du" then
result = turtle.detectUp()
elseif richtung == "dd" then
result = turtle.detectDown()
elseif richtung == "dr" then
turtle.turnRight()
result = turtle.detect()
turtle.turnLeft()
elseif richtung == "dl" then
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
elseif richtung == "db" then
turtle.turnLeft()
turtle.turnLeft()
result = turtle.detect()
turtle.turnRight()
turtle.turnRight()
end
return result
end
else
--[[
COMPUTER CODE
Hier kommt später die Computer-Sektion:
- Monitore
- Rednet
- Hardware-Erkennung
- Steuerung
]]
end📄 startup
function start()
if turtle then
print("Hallo, ich bin eine Turtle")
else
print("Hallo, ich bin ein Computer")
end
local id = os.getComputerID()
local label = os.getComputerLabel()
if os.getComputerLabel() == nil then
if turtle then
os.setComputerLabel(string.format("T%03d", id))
else
os.setComputerLabel(string.format("C%03d", id))
end
os.reboot()
end
print("ID: " .. id)
print("Label: " .. tostring(label))
os.loadAPI("custom")
blocks = dofile("blocks.lua")
end
function turtleStart()
-- Turtle-spezifischer Start
-- GPS
-- Rednet
-- Aufträge
-- usw.
custom.hw()
end
function computerStart()
-- Computer-spezifischer Start
-- hardware.lua
-- Monitore
-- Rednet
-- Steuerung
custom.hw()
end
start()
if turtle then
turtleStart()
else
computerStart()
end📁 tprog
📄 blueprint.lua
return {
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
{name="minecraft:air", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
me="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:log", meta=0},
},
{
{name="minecraft:air", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
{name="minecraft:dirt", meta=0},
},
{
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
{name="minecraft:log", meta=0},
},
}
📁 farm
📄 auki
local mask = {
"wwwwwwwwwwwww",
"wxxxxxxxxxxxw",
"waaaaaaaaaaaw",
"wxxxxxxxxxxxw",
"wwwwwwwwwwwww"
}
local blocks = {
w = "minecraft:log 0", -- Oak log
x = "minecraft:dirt",
a = "minecraft:water"
}
local startX, startY, startZ = commands.getBlockPosition()
startY = startY - 1
for z = 1, #mask do
local row = mask[z]
for x = 1, #row do
local symbol = row:sub(x, x)
local block = blocks[symbol]
if block then
commands.exec(string.format(
"setblock %d %d %d %s",
startX + x - 1,
startY,
startZ + z - 1,
block
))
end
end
end
print("Farm complete.")📄 beet
local file = fs.open("blueprint.lua", "w")
file.write("return {\n")
local rows = 7
local cols = 9
for z = 1, rows do
file.write(" {\n")
for x = 1, cols do
local ok, block = turtle.inspectDown()
if ok then
file.write(string.format(
' {name="%s", meta=%d},\n',
block.name,
block.metadata
))
else
file.write(
' {name="minecraft:air", meta=0},\n'
)
end
turtle.forward()
end
file.write(" },\n")
if z < rows then
if z % 2 == 1 then
-- am rechten Rand
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
-- am linken Rand
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
end
file.write("}\n")
file.close()
print("Blueprint erstellt!")📄 beet2
local blueprint = dofile("blueprint.lua")
local WATER = "minecraft:water"
local function selectMaterial(block)
if block.name == "minecraft:log0"
or block.name == "minecraft:log" then
turtle.select(1)
return true
elseif block.name == "minecraft:dirt" then
turtle.select(2)
return true
elseif block.name == WATER then
turtle.select(3)
return true
end
return false
end
local function place(block)
if selectMaterial(block) then
turtle.placeDown()
end
end
local function buildRow(row, skipWater)
local width = #blueprint[row]
local start
local finish
local step
if row % 2 == 1 then
start = 1
finish = width
step = 1
else
start = width
finish = 1
step = -1
end
local x = start
while true do
local block = blueprint[row][x]
if not skipWater or block.name ~= WATER then
place(block)
end
if x == finish then
break
end
turtle.forward()
x = x + step
end
end
local function nextRow(row)
if row % 2 == 1 then
turtle.turnRight()
turtle.forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
local rows = #blueprint
-- Durchlauf 1: Holz und Dirt
for row = 1, rows do
buildRow(row, true)
if row < rows then
nextRow(row)
end
end
print("Grundstruktur fertig")
-- Rückkehr zum Startpunkt muss danach ergänzt werden,
-- bevor Wasser gesetzt wird.
print("Fertig")📄 farm
--[[baue ein beet und pflanze an]]
turtle.select(1)
local function rahmen()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,5 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,8 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
custom.dig("dd")
custom.place("pd")
turtle.turnRight()
turtle.forward()
for i = 1,4 do
custom.dig("dd")
custom.place("pd")
custom.move("f",1)
end
end
rahmen()📄 mathe.lua
print("lass uns mathe testen")
print("gib den durchmesser des tunnels an")
local D = tonumber(read())
local R = (D-1)/2
print("Der Radius betraegt " .. R .. " Bloecke")
📄 mine_strs.lua
function strs()
custom.dig("d",1)
custom.move("f",1)
custom.dig("dl",1)
custom.dig("dr",1)
for i = 1,3 do
custom.dig("dd",1)
custom.move("d",1)
custom.dig("dl",1)
custom.dig("dr",1)
end
custom.move("u",2)
end
for i = 1,3 do
strs()
end
📄 newmine.lua
print("gib den durchmesser des tunnels an")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local LL = R
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)
📄 stairway.lua
turtle.select(16)
local function stairs()
for i = 1,5 do
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
turtle.turnRight()
custom.dig("df",1)
custom.move("mf",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("md",1)
custom.dig("dd",1)
custom.move("mb",1)
turtle.turnLeft()
custom.move("md",1)
end
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mu",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("du",1)
custom.move("mu",1)
custom.dig("dr",1)
custom.dig("df",1)
custom.move("mf",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.dig("dd",1)
custom.move("md",1)
custom.dig("dr",1)
custom.move("mb",1)
turtle.place()
turtle.turnLeft()
end
stairs()
stairs()
stairs()
📄 strpdwn.lua
print("Wie tief soll ich graben?")
local tiefe = tonumber(read())
function shaft()
for i = 1, tiefe do
custom.dig("dd", 1)
custom.move("md", 1)
end
end
while not turtle.detectDown() do
turtle.down()
end
shaft()
custom.move("mu",tiefe)
📁 table
📄 test
📄 tunnel.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
end
tnl(laenge)
📄 tunnel2.lua
print("Wie lang soll der tunnel werden?")
local laenge = tonumber(read())
function tnl(laenge)
for i = 1, laenge do
custom.dig("df",1) -- 1 nach vorn graben
custom.move("mf",1) -- 1 nach vorn gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dl",1) -- 1 nach links graben
custom.dig("dr",1) -- 1 nach rechts graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
turtle.turnRight() -- nach rechts drehen
custom.move("mf",2) -- 2 nach vorn gehen
turtle.turnLeft() -- nach links drehen
custom.dig("du",1) -- 1 nach oben graben
custom.dig("dd",1) -- 1 nach unten graben
custom.move("ml",1) -- 1 nach links gehen
end
custom.move("mb", laenge)
end
tnl(laenge)
📄 tunnel3.lua
print("gib den durchmesser des tunnels an, ")
print("der wert muss ungerade sein")
local D = tonumber(read())
local R = (D-1)/2
print("Wie lang soll der tunnel werden?")
local L = tonumber(read())
local function spalte()
for i = 1, R do
custom.dig("du", 1)
custom.move("mu", 1)
end
custom.move("md", R)
for j = 1, R do
custom.dig("dd", 1)
custom.move("md", 1)
end
custom.move("mu", R)
end
local function tnl()
custom.dig("df", 1)
custom.move("mf", 1)
spalte()
end
for a = 1, L do
tnl()
turtle.turnLeft()
for f = 1, R do
tnl()
end
custom.move("mb", R)
turtle.turnRight()
turtle.turnRight()
for g = 1, LL do
tnl()
end
custom.move("mb", R)
turtle.turnLeft()
end
custom.move("mb", L)