Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- List of Minecraft log types
- local logTypes = {
- "minecraft:oak_log",
- "minecraft:spruce_log",
- "minecraft:birch_log",
- "minecraft:jungle_log",
- "minecraft:acacia_log",
- "minecraft:dark_oak_log",
- "biomesoplenty:fir_log",
- "biomesoplenty:redwood_log",
- "biomesoplenty:cherry_log",
- "biomesoplenty:mahogany_log",
- "biomesoplenty:jacaranda_log",
- "biomesoplenty:palm_log",
- "biomesoplenty:willow_log",
- "biomesoplenty:dead_log",
- "biomesoplenty:magic_log",
- "biomesoplenty:umbran_log",
- "biomesoplenty:hellbark_log"
- }
- -- List of Create casing types
- local casingTypes = {
- "create:brass_casing",
- "create:andesite_casing",
- "create:copper_casing"
- }
- -- Function to check if the block matches any of the specified casing types
- local function isCasingTypeInList(casingType)
- for _, type in ipairs(casingTypes) do
- if casingType == type then
- return true
- end
- end
- return false
- end
- -- Check for turtle inventory for logs
- function checkInventoryForLogs()
- for slot = 1, 16 do
- local item = turtle.getItemDetail(slot)
- if item and isLog(item.name) then
- return slot
- end
- end
- return nil
- end
- -- Check if a given item name is a log
- function isLog(itemName)
- for _, logType in ipairs(logTypes) do
- if itemName == logType then
- return true
- end
- end
- return false
- end
- -- Check if the block in front of the turtle is a casing and break it
- function checkAndBreakBlock()
- local success, block = turtle.inspect()
- if success and isCasingTypeInList(block.name) then
- turtle.dig()
- while turtle.detect() do
- sleep(0.1)
- end
- end
- end
- -- Place a log in front of the turtle
- function placeLog()
- local slot = checkInventoryForLogs()
- if slot then
- turtle.select(slot)
- turtle.place()
- sleep(0.1)
- end
- end
- -- Print instructions to the player and clear the screen
- function printInstructions()
- term.clear()
- term.setCursorPos(1, 1)
- print("Instructions:")
- print("")
- print("1. Fill the turtle's inventory with your logs of choice.")
- print("")
- print("2. Hold Brass, Copper, or Andesite alloy in offhand and an axe in main hand.")
- print("")
- print("3. Just hold right-click to make casings.")
- end
- -- Print instructions once
- printInstructions()
- -- Main loop
- while true do
- placeLog()
- checkAndBreakBlock()
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement