Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ItemThresholds={
- bonemeal=64,
- enderDust=64,
- gunpowder=64
- }
- ItemNames={
- bonemeal="minecraft:bone_meal",
- enderDust="appliedenergistics2:ender_dust",
- gunpowder="minecraft:gunpowder"
- }
- Peripherals={
- bonemealDrawer=nil,
- enderDustDrawer=nil,
- gunpowderDrawer=nil,
- wrapAll=function(self)
- for _,name in ipairs(peripheral.getNames()) do
- local t = peripheral.getType(name)
- if t == "standardDrawer" then
- local drawer = peripheral.wrap(name)
- drawer.name = name
- local item = drawer.getItemDetail(1)
- if item.name == ItemNames.bonemeal then
- self.bonemealDrawer = drawer
- elseif item.name == ItemNames.enderDust then
- self.enderDustDrawer = drawer
- elseif item.name == ItemNames.gunpowder then
- self.gunpowderDrawer = drawer
- end
- end
- end
- if self.bonemealDrawer == nil then
- error("Could not find bonemeal drawer")
- elseif self.enderDustDrawer == nil then
- error("Could not find ender dust drawer")
- elseif self.gunpowderDrawer == nil then
- error("Could not find gunpowder drawer")
- end
- end
- }
- function setColorOutput(color,output)
- if output then
- redstone.setBundledOutput("bottom",colors.combine(redstone.getBundledOutput("bottom"),color))
- else
- redstone.setBundledOutput("bottom",colors.subtract(redstone.getBundledOutput("bottom"),color))
- end
- end
- Peripherals:wrapAll()
- Checks={
- {
- perip=Peripherals.bonemealDrawer,
- threshold=ItemThresholds.bonemeal,
- color=colors.blue
- },{
- perip=Peripherals.enderDustDrawer,
- threshold=ItemThresholds.enderDust,
- color=colors.purple
- },{
- perip=Peripherals.gunpowderDrawer,
- threshold=ItemThresholds.gunpowder,
- color=colors.lime
- }
- }
- while true do
- for _,check in ipairs(Checks) do
- setColorOutput(check.color,check.perip.getItemDetail(1).count >= check.threshold)
- end
- sleep(5)
- end
Add Comment
Please, Sign In to add comment