Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- List of unwanted item names
- local unwantedItems = {
- "minecraft:cobblestone",
- "minecraft:dirt",
- "minecraft:gravel"
- -- Add more item names as needed
- }
- -- Function to check if an item is unwanted
- local function isUnwanted(itemName)
- for _, unwanted in ipairs(unwantedItems) do
- if itemName == unwanted then
- return true
- end
- end
- return false
- end
- -- Function to drop unwanted items from turtle's inventory
- local function dropUnwantedItems()
- for slot = 1, 16 do -- Iterate over turtle's inventory slots (1 to 16)
- local itemDetails = turtle.getItemDetail(slot)
- if itemDetails then
- local itemName = itemDetails.name
- if isUnwanted(itemName) then
- turtle.select(slot) -- Select the slot with unwanted item
- turtle.drop() -- Drop the unwanted item
- end
- end
- end
- end
- -- Call the function to drop unwanted items
- dropUnwantedItems()
Add Comment
Please, Sign In to add comment