Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------
- -- Hypno's Blood Magic Code BETA ;-) --
- -- --
- -- Minecraft HermitCraft FTB Infinity Episode TBA --
- -- https://www.youtube.com/watch?v=TBA --
- -- --
- -- YouTube Channel http://youtube.com/hypnotizd --
- ----------------------------------------------------------
- -- BACK: Blood Altar
- -- FRONT: Redstone signal INPUT
- -- LEFT: Redstone signal OUTPUT
- -- MONITOR: Recommended, but optional.
- -- Connect using modem/network cable or
- -- directly touching computer
- local mon = {}
- local hasMon = false
- local hasRMon = false
- local rMonName = ""
- local directions = {"top", "bottom", "front", "back", "left", "right"}
- local hasBA = false
- local bADir = ""
- local altar = peripheral.wrap("back")
- local monitor = peripheral.wrap("top")
- local function findPeripherals()
- for k, v in pairs(peripheral.getNames()) do
- if string.find(v, "monitor") then
- hasMon = true
- hasRMon = true
- rMonName = v
- print("INFO: Found remote "..v)
- os.sleep(1)
- end
- end
- end
- local function findMon()
- if hasRMon then return end
- for k, v in pairs(directions) do
- local p = peripheral.wrap(v)
- if p ~= nil then
- if string.find(peripheral.getType(v), "monitor") then
- mon = p
- hasMon = true
- return
- end
- end
- end
- print("WARNING: No monitor detected!")
- os.sleep(5)
- end
- local function monClear()
- if hasMon then
- if hasRMon then
- peripheral.call(rMonName, "setCursorPos", 1, 1)
- peripheral.call(rMonName, "clear")
- peripheral.call(rMonName, "setTextScale", 1)
- else
- mon.setCursorPos(1, 1)
- mon.clear()
- mon.setTextScale(1)
- end
- else
- term.clear()
- term.setCursorPos(1, 1)
- end
- end
- local function monWrite(x, y, text)
- if hasMon then
- if hasRMon then
- peripheral.call(rMonName, "setCursorPos", x, y)
- peripheral.call(rMonName, "write", text)
- else
- mon.setCursorPos(x, y)
- mon.write(text)
- end
- else
- term.setCursorPos(x, y)
- term.write(text)
- end
- end
- local function init()
- term.clear()
- term.setCursorPos(1, 1)
- findPeripherals()
- findMon()
- monClear()
- end
- local function displayInfo()
- local capacity = altar.getInfo().capacity
- local type = altar.getInfo().contents.rawName
- local amount = altar.getInfo().contents.amount
- monClear()
- monWrite(1,1,type..":")
- monWrite(1,2,amount.."/"..capacity)
- end
- local function getRedstoneInput()
- return rs.getAnalogInput("front")
- end
- init()
- while true do
- displayInfo()
- local strength = getRedstoneInput()
- if (strength < 5) then
- local i = 15
- rs.setOutput("left", true)
- os.sleep(.5)
- rs.setOutput("left", false)
- while i > 0 do
- displayInfo()
- i = i - 1
- os.sleep(1)
- end
- end
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement