Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Load the meBridge peripheral
- local me = peripheral.find("meBridge")
- -- Define the item names to watch for
- local ITEM_1_NAME = "appliedenergistics2:item.printedlogiccircuit"
- local ITEM_2_NAME = "appliedenergistics2:item.printedcalculationprocessor"
- local ITEM_3_NAME = "appliedenergistics2:item.printedengineeringprocessor"
- -- Define the message to print when a matching item is crafted
- local MESSAGE = "Congratulations on crafting an AE2 printed circuit!"
- -- Create a function to check if an item matches the ones we're looking for
- local function isMatchingItem(itemName)
- return itemName == ITEM_1_NAME or itemName == ITEM_2_NAME or itemName == ITEM_3_NAME
- end
- -- Create a function to handle the event that fires when an item is crafted
- local function handleCraftingEvent(_, item, quantity)
- if isMatchingItem(item.name) and me.isItemCrafting(item) then
- print(MESSAGE)
- end
- end
- -- Register the crafting event with the event system
- event.listen("me_crafting", handleCraftingEvent)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement