Skip to content

Instantly share code, notes, and snippets.

View AmariNoa's full-sized avatar

天鈴のあ AmariNoa

View GitHub Profile
@AmariNoa
AmariNoa / MasterServer.lua
Created July 13, 2022 14:01
Master server for ComputerCraft
-- MasterServer
-- Ver. 0.1
-- Include external lib
dofile("/lib/amari/string/StringUtil.lua")
local REDNET_SIDE = "back"
local REDNET_PROTOCOL = "MasterServer"
@AmariNoa
AmariNoa / FileClient.lua
Created July 13, 2022 14:00
File server and client for ComputerCraft
-- FileClient
-- Ver. 0.1
-- Include external lib
dofile("/lib/amari/string/StringUtil.lua")
local REDNET_SIDE = "left"
local REDNET_PROTOCOL_MASTER = "MasterServer"
@AmariNoa
AmariNoa / StringUtil.lua
Created July 13, 2022 13:47
StringUtils for ComputerCraft
function string.startsWith(str, start)
return (string.sub(str, 1, string.len(start)) == start)
end
-- https://symfoware.blog.fc2.com/blog-entry-455.html
function string.split(str, delim)
if string.find(str, delim) == nil then
return { str }
end
local MINING_X = 3
local MINING_Z = 3
local MINING_Y = -2
function inspectAndRefuelFront()
local success, result = turtle.inspect()
if success and result.name == "minecraft:lava" then
turtle.place()
turtle.refuel()
@AmariNoa
AmariNoa / AutoFelling.lua
Created July 7, 2022 16:18
Auto felling program for ComputerCraft
local resInspect, blkInfo = turtle.inspect()
local blkType = blkInfo.name
print(resInspect)
print(blkType)
if resInspect == false then
print("Front block is nil.")
return
end