From 8536ded85c3346c3940e1f6758e67e4a61467b4b Mon Sep 17 00:00:00 2001 From: Navid Sassan Date: Thu, 23 Nov 2023 00:40:19 +0100 Subject: [PATCH] handle empty item slots --- lava-collector | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lava-collector b/lava-collector index 527bd6b..88582cc 100644 --- a/lava-collector +++ b/lava-collector @@ -1,12 +1,20 @@ -- vi: ft=lua -- Goal: collect lava using buckets in the nether, deposit the buckets into a fluid transposer that extracts the lava and sends it to a power generator +local function compareItemName(target) + local itemDetail = turtle.getItemDetail() + if itemDetail == nil then + return nil + end + return itemDetail.name == target +end + local function isEmptyBucket() - return turtle.getItemDetail().name == "minecraft:bucket" + compareItemName("minecraft:bucket") end local function isLavaBucket() - return turtle.getItemDetail().name == "minecraft:lava_bucket" + compareItemName("minecraft:lava_bucket") end local function findFirstEmptyBucket()