CCHacker132

Beekeeping program ++

Aug 17th, 2020 (edited)
4,385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.57 KB | None | 0 0
  1. local pressersP = {peripheral.find('minecraft:pampresser')}
  2.  
  3. local honeyPressers = {
  4. }
  5.  
  6. local waxPressers = {
  7. }
  8.  
  9. for i,v in pairs(pressersP) do
  10.     if i%2 ~= 0 then
  11.         table.insert(honeyPressers,peripheral.getName(v))
  12.     else
  13.         table.insert(waxPressers,peripheral.getName(v))
  14.     end
  15. end
  16.  
  17. local apiaries = {peripheral.find('minecraft:pamapiary')}
  18.  
  19. local trashChest = 'minecraft:dispenser_0'
  20.  
  21. local trashChestP = peripheral.wrap(trashChest)
  22.  
  23. local waxOutput = 'minecraft:ironchest_diamond_0'
  24. local honeyOutput = 'minecraft:ironchest_diamond_1'
  25.  
  26. local waxOutputP = peripheral.wrap(waxOutput)
  27. local honeyOutputP = peripheral.wrap(honeyOutput)
  28.  
  29. --begin load
  30.     for i,v in pairs(apiaries) do
  31.         sleep()
  32.         print('Checking apiary '..i..'/'..#apiaries)
  33.         for ii,vv in pairs(v.list()) do
  34.             if vv.name == 'harvestcraft:honeycombitem' then
  35.                 for iii,vvv in pairs(honeyPressers) do
  36.                     v.pushItems(vvv,ii,math.ceil(vv.count/#honeyPressers),1)
  37.                 end
  38.             elseif vv.name == 'harvestcraft:waxcombitem' then
  39.                 for iii,vvv in pairs(waxPressers) do
  40.                     v.pushItems(vvv,ii,math.ceil(vv.count/#waxPressers),1)
  41.                 end
  42.             elseif vv.name == 'harvestcraft:queenbeeitem' then
  43.                 v.pushItems('self',ii,1,19)
  44.             else
  45.                 v.pushItems(trashChest,ii,64)
  46.             end
  47.         end
  48.     if i%math.floor(#apiaries/10) == 0 then
  49.     for i,v in pairs(honeyPressers) do
  50.         print('Emptying honey presser '..i..'/'..#honeyPressers)
  51.         sleep()
  52.         local tempP = peripheral.wrap(v)
  53.         for ii,vv in pairs(tempP.list()) do
  54.             if vv.name == 'harvestcraft:beeswaxitem' then
  55.                 waxOutputP.pullItems(v,ii,64)
  56.                 trashChestP.pullItems(v,ii,64)
  57.             elseif vv.name == 'harvestcraft:honeyitem' then
  58.                 honeyOutputP.pullItems(v,ii,64)
  59.                 trashChestP.pullItems(v,ii,64)
  60.             end
  61.         end
  62.     end
  63.     print('Emptying Trash Chest...')
  64.     for ii,vv in pairs(trashChestP.list()) do
  65.         trashChestP.drop(ii)
  66.     end
  67.     for i,v in pairs(waxPressers) do
  68.         print('Emptying wax presser '..i..'/'..#waxPressers)
  69.         sleep()
  70.         local tempP = peripheral.wrap(v)
  71.         for ii,vv in pairs(tempP.list()) do
  72.             if vv.name == 'harvestcraft:beeswaxitem' then
  73.                 waxOutputP.pullItems(v,ii,64)
  74.                 trashChestP.pullItems(v,ii,64)
  75.             end
  76.         end
  77.     end
  78.     end
  79.     end
  80. --end load
  81.  
Advertisement
Add Comment
Please, Sign In to add comment