Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- =============================================
- -- bMobFarm Optimized v2.1 - Full Featured
- -- For ComputerCraft 1.12.2
- -- =============================================
- local VERSION = "v2.1"
- -- ====================== CONFIG ======================
- local DROP_SHAFT_HEIGHT = 23
- local LADDER_ENABLED = true -- will use slot 14 for ladders + balcony
- local CHEST_BEHIND = false -- detected automatically
- -- Slot layout (same as original for compatibility)
- local SLOT = {
- mainBlock = 1, -- cobble / obsidian
- earlyBlock = 2, -- sometimes different
- spawnBlock = 6, -- inner spawning floor
- water1 = 12,
- water2 = 13,
- ladder = 14,
- special = 15, -- extra for ladders or decoration
- torch = 16,
- faceMouth = 10, -- for emoji (cobble replacement)
- faceEyes = 11 -- for emoji
- }
- -- ====================== HELPER FUNCTIONS ======================
- local function tryForward() while not turtle.forward() do turtle.dig() end end
- local function tryUp() while not turtle.up() do turtle.digUp() end end
- local function tryDown() while not turtle.down() do turtle.digDown() end end
- local function tryBack() while not turtle.back() do turtle.dig() end end
- local function select(slot) turtle.select(slot) end
- local function place() turtle.place() end
- local function placeDown() turtle.placeDown() end
- local function placeUp() turtle.placeUp() end
- local function dig() turtle.dig() end
- local function turnLeft() turtle.turnLeft() end
- local function turnRight() turtle.turnRight() end
- local function turnAround()
- turnRight(); turnRight()
- end
- local function go(n, dir)
- for i = 1, n do
- if dir == "forward" then tryForward()
- elseif dir == "back" then tryBack()
- elseif dir == "up" then tryUp()
- elseif dir == "down" then tryDown()
- end
- end
- end
- local function refillFromChest()
- if not CHEST_BEHIND then return end
- print("Refilling from chest behind...")
- turnAround()
- for slot = 1, 16 do
- if turtle.getItemCount(slot) == 0 or turtle.getItemCount(slot) < 32 then
- select(slot)
- while turtle.suck() do end
- end
- end
- turnAround()
- print("Refill complete.")
- end
- -- ====================== SETUP PHASE ======================
- local function checkMaterials()
- term.clear()
- print("=== bMobFarm " .. VERSION .. " - Material Check ===")
- print("Required slots (minimum stacks):")
- print(" 1-9 : Main blocks (cobble/obsidian) - ~8 stacks")
- print(" 10-11: Face blocks (optional)")
- print(" 12-13: Water buckets")
- print(" 14 : Ladders (if enabled)")
- print(" 15 : Extra blocks / ladders")
- print(" 16 : Torches (~64)")
- print("")
- local missing = false
- for slot = 1, 16 do
- local count = turtle.getItemCount(slot)
- if slot <= 9 and count < 32 then
- print("Slot " .. slot .. ": only " .. count .. " (need ~32+)")
- missing = true
- elseif slot == 16 and count < 16 then
- print("Slot 16 (torches): only " .. count .. " (need 16+)")
- missing = true
- end
- end
- if missing then
- print("\nSome slots are low. Top up now or continue anyway?")
- end
- print("\nIs a chest placed directly behind the turtle for refilling? (y/n)")
- local ans = read():lower()
- CHEST_BEHIND = (ans == "y")
- if CHEST_BEHIND then
- refillFromChest()
- end
- print("\nPress ENTER to START build")
- print("or type 'abort' to cancel now")
- local input = read():lower()
- if input == "abort" then
- print("Build aborted by user.")
- return false
- end
- return true
- end
- -- ====================== ROOF EMOJI MENU ======================
- local function chooseRoofEmoji()
- term.clear()
- print("=== Roof Emoji Options (top popular designs) ===")
- print("These fit perfectly on the 9x9 roof:")
- print(" 0. Plain roof (no emoji)")
- print(" 1. Creeper Face (classic)")
- print(" 2. Smiley Face :)")
- print(" 3. Evil Grin >:)")
- print(" 4. Heart <3")
- print(" 5. Skull")
- print(" 6. Star")
- print(" 7. Peace Sign")
- print(" 8. Diamond")
- print(" 9. TNT")
- print(" 10. Steve Face")
- print("\n(Only 1-4 are fully implemented with custom blocks.")
- print("Higher numbers will use Creeper style with your face blocks.)")
- print("Enter number (0-10): ")
- local choice = tonumber(read()) or 0
- if choice < 0 or choice > 10 then choice = 0 end
- print("Selected: " .. (choice == 0 and "Plain roof" or "Emoji #" .. choice))
- return choice
- end
- local function buildRoofEmoji(choice)
- print("Building roof + emoji #" .. choice)
- -- Flat 9x9 roof base
- select(SLOT.mainBlock)
- for _ = 1, 4 do
- for i = 1, 8 do tryForward(); place() end
- turnRight()
- end
- -- Place torches on roof edges to prevent spawning
- select(SLOT.torch)
- turnAround()
- for i = 1, 8 do tryForward() end
- for side = 1, 4 do
- for i = 1, 8 do
- placeUp()
- tryForward()
- end
- turnRight()
- end
- turnAround() -- back to center-ish
- -- Emoji drawing (simple patterns using face slots)
- if choice == 0 then
- -- plain, already done
- return
- end
- select(choice <= 4 and SLOT.faceEyes or SLOT.faceMouth)
- if choice == 1 or choice >= 5 then -- Creeper / default
- -- Classic creeper face (eyes + mouth)
- go(3, "forward"); turnLeft()
- go(3, "forward")
- place(); tryForward(); place()
- go(2, "back"); turnRight(); turnRight()
- go(3, "forward")
- place(); tryForward(); place() -- eyes
- go(2, "back"); turnRight()
- go(4, "forward")
- select(SLOT.faceMouth)
- for i = 1, 3 do place(); tryForward() end -- mouth
- elseif choice == 2 then -- Smiley :)
- go(3, "forward"); turnLeft(); go(2, "forward")
- place(); tryForward(); place() -- eyes
- go(3, "back"); turnRight(); go(3, "forward")
- select(SLOT.faceMouth)
- place(); tryForward(); place(); tryForward(); place() -- curved mouth
- elseif choice == 3 then -- Evil Grin
- go(3, "forward"); turnLeft(); go(2, "forward")
- place(); tryForward(); place() -- eyes
- go(3, "back"); turnRight(); go(4, "forward")
- select(SLOT.faceMouth)
- place(); tryForward(); place(); tryForward(); place()
- elseif choice == 4 then -- Heart
- go(3, "forward"); turnLeft(); go(2, "forward")
- place(); tryForward(); place()
- go(1, "forward"); turnRight(); place()
- turnRight(); place(); tryForward(); place()
- end
- print("Roof + emoji complete with torches!")
- end
- -- ====================== LADDER + BALCONY SYSTEM ======================
- local function buildLadderAndBalcony()
- if not LADDER_ENABLED then return end
- print("Building ladder column + roof balcony...")
- -- Move to side position for ladder column
- turnLeft()
- go(5, "forward") -- outside the main 9x9
- turnRight()
- -- Build vertical ladder all the way up (we're at top, so go down placing)
- select(SLOT.ladder)
- for i = 1, DROP_SHAFT_HEIGHT + 8 do -- extra for safety
- tryDown()
- placeDown()
- end
- -- Build small balcony at roof level
- turnLeft()
- go(2, "forward")
- select(SLOT.mainBlock)
- for i = 1, 3 do
- placeDown()
- tryForward()
- end
- turnRight()
- for i = 1, 3 do
- placeDown()
- tryForward()
- end
- print("Ladder column + balcony complete!")
- -- Return turtle to safe spot
- turnAround()
- go(6, "forward")
- turnLeft()
- end
- -- ====================== MAIN BUILDING FUNCTIONS ======================
- local function buildDropShaft()
- print("=== Building Drop Shaft (" .. DROP_SHAFT_HEIGHT .. " layers) ===")
- for layer = 1, DROP_SHAFT_HEIGHT do
- print("Drop shaft layer " .. layer .. "/" .. DROP_SHAFT_HEIGHT)
- turnAround()
- local slot = (layer <= 2) and SLOT.earlyBlock or SLOT.mainBlock
- select(slot)
- -- 9x9 layer with walls (optimized loop)
- for _ = 1, 4 do
- for i = 1, 8 do
- tryForward()
- place()
- end
- turnRight()
- end
- -- Water on very first layer
- if layer == 1 then
- select(SLOT.water1)
- go(4, "forward")
- turnLeft()
- place()
- turnAround()
- select(SLOT.water2)
- place()
- go(4, "forward")
- end
- -- Occasional torch inside shaft
- if layer % 6 == 0 then
- select(SLOT.torch)
- placeUp()
- end
- if layer < DROP_SHAFT_HEIGHT then tryUp() end
- refillFromChest() -- occasional top-up
- end
- print("Drop shaft finished!")
- end
- local function buildSpawnArea(lowerHalf)
- local layers = lowerHalf and 4 or 3
- print("=== Building " .. (lowerHalf and "Lower" or "Upper") .. " Spawn Area (" .. layers .. " layers) ===")
- for i = 1, layers do
- print("Spawn layer " .. i)
- select(SLOT.mainBlock)
- -- Outer 9x9 platform
- for _ = 1, 4 do
- for j = 1, 8 do tryForward(); place() end
- turnRight()
- end
- -- Inner 7x7 spawning floor
- go(1, "forward"); turnRight(); go(1, "forward")
- select(SLOT.spawnBlock)
- for _ = 1, 4 do
- for j = 1, 6 do tryForward(); place() end
- turnRight()
- end
- if i < layers then tryUp() end
- refillFromChest()
- end
- end
- -- ====================== MAIN PROGRAM ======================
- term.clear()
- print("=== bMobFarm Optimized " .. VERSION .. " by Grok ===")
- print("Mob farm tower builder with all your requested features")
- if not checkMaterials() then return end
- -- Build sequence
- buildDropShaft()
- -- Reposition for spawn areas
- turnAround()
- go(8, "back")
- go(DROP_SHAFT_HEIGHT, "up")
- go(8, "back")
- buildSpawnArea(true) -- lower half
- buildSpawnArea(false) -- upper half
- -- Roof
- local emojiChoice = chooseRoofEmoji()
- buildRoofEmoji(emojiChoice)
- -- Access system
- buildLadderAndBalcony()
- print("\n=== BUILD COMPLETE! ===")
- print("Tower, drop shaft, spawn platforms, roof emoji, torches, ladder + balcony done.")
- print("You can now add the killing chamber below the drop shaft.")
- print("Enjoy your mob farm! :)")
Add Comment
Please, Sign In to add comment