Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Script to allow enchanting via button
- -- Written by craftersanonmoose
- -- version history
- -- version 0.1
- -- button to click on attached monitor
- -- version 0.2
- -- adding in ability to view xp levels in collectors
- -- this is system is also connected to the blaze and spider xp collectors
- -- wanting to add ability to bittle xp from this system as well
- ----------------------------
- os.loadAPI("button")
- mon = peripheral.find("monitor")
- mon.clear()
- -- change the name of peripheral if needed
- enchanter = peripheral.wrap("enchanting_interface_0")
- bottler0 = peripheral.wrap("xp_bottler_2")
- bottler1 = peripheral.wrap("xp_bottler_1")
- c0 = peripheral.wrap("xp_collector_8")
- c1 = peripheral.wrap("xp_collector_9")
- c2 = peripheral.wrap("xp_collector_2")
- c3 = peripheral.wrap("xp_collector_3")
- c4 = peripheral.wrap("xp_collector_4")
- c5 = peripheral.wrap("xp_collector_5")
- function fillTable()
- button.setTable("Collector1", bottle1, 4,14,3,5)
- button.setTable("Collector2", bottle2, 17,27,3,5)
- button.setTable("Collector3", bottle3, 4,14,7,9)
- button.setTable("Collector4", bottle4, 17,27,7,9)
- button.setTable("Collector5", bottle5, 4,14,11,13)
- button.setTable("Collector6", bottle6, 17,27,11,13)
- button.setTable("Enchant", enchant, 10,20,15,15)
- button.screen()
- end
- function getClick()
- event,side,x,y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
- -- Vanilla storage is needed for this interface, change the name based on your storgae method
- function enchant()
- button.flash("Enchant")
- local success, err = pcall(function()
- enchanter.enchant("minecraft:chest_1", 1, "minecraft:chest_1")
- end)
- if not success then
- print("Error occured:", err)
- end
- end
- -- I used a diamond crate for this, change the name based on your storgae method
- function bottle1()
- button.flash("Collector1")
- local success, err = pcall(function()
- bottler0.bottleXP("minecraft:chest_1", "minecraft:chest_1", "xp_collector_8")
- end)
- if not success then
- print("Error occured:", err)
- end
- end
- function bottle2()
- button.flash("Collector2")
- local success, err = pcall(function()
- bottler0.bottleXP("minecraft:chest_1", "minecraft:chest_1", "xp_collector_9")
- end)
- if not success then
- print("Error occured:", err)
- end
- end
- function bottle3()
- button.flash("Collector3")
- local success, err = pcall(function()
- bottler1.bottleXP("minecraft:chest_1", "minecraft:chest_1", "xp_collector_2")
- end)
- if not success then
- print("Error occured:", err)
- end
- end
- function bottle4()
- button.flash("Collector4")
- local success, err = pcall(function()
- bottler1.bottleXP("minecraft:chest_1", "minecraft:chest_1", "xp_collector_3")
- end)
- if not success then
- print("Error occured:", err)
- end
- end
- function bottle5()
- button.flash("Collector5")
- local success, err = pcall(function()
- bottler1.bottleXP("minecraft:chest_1", "minecraft:chest_1", "xp_collector_4")
- end)
- if not success then
- print("Error occured:", err)
- end
- end
- function bottle6()
- button.flash("Collector6")
- local success, err = pcall(function()
- bottler1.bottleXP("minecraft:chest_1", "minecraft:chest_1", "xp_collector_5")
- end)
- if not success then
- print("Error occured:", err)
- end
- end
- function showLevel()
- mon.setCursorPos(1,17)
- mon.clearLine()
- mon.write("Levels")
- mon.setCursorPos(7,17)
- mon.write("1:")
- mon.setCursorPos(9,17)
- mon.write(c0.getCurrentXP())
- mon.setCursorPos(17,17)
- mon.write("2:")
- mon.setCursorPos(19,17)
- mon.write(c1.getCurrentXP())
- mon.setCursorPos(7,18)
- mon.clearLine()
- mon.write("3:")
- mon.setCursorPos(9,18)
- mon.write(c2.getCurrentXP())
- mon.setCursorPos(7,19)
- mon.clearLine()
- mon.write("4:")
- mon.setCursorPos(9,19)
- mon.write(c3.getCurrentXP())
- mon.setCursorPos(17,18)
- mon.write("5:")
- mon.setCursorPos(19,18)
- mon.write(c4.getCurrentXP())
- mon.setCursorPos(17,19)
- mon.write("6:")
- mon.setCursorPos(19,19)
- mon.write(c5.getCurrentXP())
- end
- fillTable()
- button.heading("Bottle Filler & Enchanter")
- while true do
- showLevel()
- getClick()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement