Advertisement
REKTorSET

Untitled

Mar 26th, 2023
666
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. -- Load the meBridge peripheral
  2. local me = peripheral.find("meBridge")
  3.  
  4. -- Define the item names to watch for
  5. local ITEM_1_NAME = "appliedenergistics2:item.printedlogiccircuit"
  6. local ITEM_2_NAME = "appliedenergistics2:item.printedcalculationprocessor"
  7. local ITEM_3_NAME = "appliedenergistics2:item.printedengineeringprocessor"
  8.  
  9. -- Define the message to print when a matching item is crafted
  10. local MESSAGE = "Congratulations on crafting an AE2 printed circuit!"
  11.  
  12. -- Create a function to check if an item matches the ones we're looking for
  13. local function isMatchingItem(itemName)
  14.   return itemName == ITEM_1_NAME or itemName == ITEM_2_NAME or itemName == ITEM_3_NAME
  15. end
  16.  
  17. -- Create a function to handle the event that fires when an item is crafted
  18. local function handleCraftingEvent(_, item, quantity)
  19.   if isMatchingItem(item.name) and me.isItemCrafting(item) then
  20.     print(MESSAGE)
  21.   end
  22. end
  23.  
  24. -- Register the crafting event with the event system
  25. event.listen("me_crafting", handleCraftingEvent)
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement