Enhance dropper detection logic: implement name-based matching for improved compatibility with CC:Tweaked versions
This commit is contained in:
@@ -897,9 +897,18 @@ local function refreshCache(onProgress)
|
||||
cache.barrelOk = peripheral.wrap(BARREL_NAME) ~= nil
|
||||
|
||||
-- Discover all droppers on the network (for location-based dispensing)
|
||||
-- Use name-based matching as peripheral.getType() may return "inventory"
|
||||
-- as the primary type in some CC:Tweaked versions (1.99+)
|
||||
local droppers = {}
|
||||
for _, name in ipairs(peripheral.getNames()) do
|
||||
if peripheral.getType(name) == "minecraft:dropper" and name ~= COMPOST_DROPPER then
|
||||
local isDropper = name:match("^minecraft:dropper_")
|
||||
if not isDropper and peripheral.hasType then
|
||||
isDropper = peripheral.hasType(name, "minecraft:dropper")
|
||||
end
|
||||
if not isDropper then
|
||||
isDropper = peripheral.getType(name) == "minecraft:dropper"
|
||||
end
|
||||
if isDropper and name ~= COMPOST_DROPPER then
|
||||
local isDefault = (name == DROPPER_NAME)
|
||||
table.insert(droppers, { name = name, isDefault = isDefault })
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user