Merge most of iuzx's changes into develop-1.8
This commit is contained in:
@@ -23,14 +23,10 @@ function nameDB:loadDirectory(directory)
|
||||
error('Unable to read ' .. fs.combine(directory, file))
|
||||
end
|
||||
|
||||
for strId, block in pairs(blocks) do
|
||||
for strId, blockName in pairs(blocks) do
|
||||
strId = string.format('%s:%s', mod, strId)
|
||||
if type(block.name) == 'string' then
|
||||
self.data[strId .. ':0'] = block.name
|
||||
else
|
||||
for nid,name in pairs(block.name) do
|
||||
self.data[strId .. ':' .. (nid-1)] = name
|
||||
end
|
||||
if type(blockName) == 'string' then
|
||||
self.data[strId] = blockName
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -281,11 +281,12 @@ end
|
||||
|
||||
local function splitKey(key)
|
||||
local t = Util.split(key, '(.-):')
|
||||
|
||||
local item = { }
|
||||
if #t[#t] > 8 then
|
||||
item.nbt = table.remove(t)
|
||||
if t[3] then
|
||||
item.nbt = t[3]
|
||||
end
|
||||
item.damage = tonumber(table.remove(t))
|
||||
t[3] = nil
|
||||
item.name = table.concat(t, ':')
|
||||
return item
|
||||
end
|
||||
|
||||
@@ -489,6 +489,9 @@ function Storage:_sn(name)
|
||||
end
|
||||
|
||||
local function isValidTransfer(adapter, target)
|
||||
if string.find(target,":inventory") or string.find(target,":equipment") then
|
||||
return false
|
||||
end
|
||||
-- lazily cache transfer locations
|
||||
--[[if not adapter.transferLocations then
|
||||
adapter.transferLocations = adapter.getTransferLocations()
|
||||
|
||||
@@ -58,7 +58,7 @@ function page.tabs.inventory:enable()
|
||||
local list = { }
|
||||
|
||||
for k, item in pairs(inv) do
|
||||
item = itemDB:get(item, function() return ni.getInventory().getItemMeta(k) end)
|
||||
item = itemDB:get(item, function() return ni.getInventory().getItemDetail(k) end)
|
||||
local key = makeKey(item)
|
||||
if not list[key] then
|
||||
item.key = key
|
||||
@@ -129,7 +129,7 @@ Event.onInterval(5, function()
|
||||
|
||||
pcall(function() -- prevent errors from some mod items
|
||||
for slot,v in pairs(ni.getInventory().list()) do
|
||||
local item = itemDB:get(v, function() ni.getInventory().getItemMeta(slot) end)
|
||||
local item = itemDB:get(v, function() ni.getInventory().getItemDetail(slot) end)
|
||||
if item then
|
||||
if context.state.autostore[makeKey(item)] then
|
||||
context:sendRequest({
|
||||
|
||||
@@ -53,7 +53,7 @@ function page:updateInventoryList()
|
||||
|
||||
for slot, item in pairs(inv) do
|
||||
if (context.state.depositAll.includeHotbar or slot > 9) and item.name ~= 'plethora:neuralconnector' then
|
||||
item = itemDB:get(item, function() return ni.getInventory().getItemMeta(slot) end)
|
||||
item = itemDB:get(item, function() return ni.getInventory().getItemDetail(slot) end)
|
||||
local key = makeKey(item)
|
||||
if not list[key] then
|
||||
item.displayName = item.displayName:match('(.+) %(damage:.+%)') or item.displayName
|
||||
@@ -89,7 +89,7 @@ function page:depositAll()
|
||||
local inv = ni.getInventory().list()
|
||||
|
||||
for slot, item in pairs(inv) do
|
||||
item = itemDB:get(item, function() return ni.getInventory().getItemMeta(slot) end)
|
||||
item = itemDB:get(item, function() return ni.getInventory().getItemDetail(slot) end)
|
||||
local key = makeKey(item)
|
||||
if not context.state.depositAll.retain[key] then
|
||||
if (context.state.depositAll.includeHotbar or slot > 9) and item.name ~= 'plethora:neuralconnector' then
|
||||
|
||||
@@ -33,7 +33,7 @@ function page:enable()
|
||||
local list = { }
|
||||
|
||||
for k, item in pairs(inv) do
|
||||
item = itemDB:get(item, function() return ni.getInventory().getItemMeta(k) end)
|
||||
item = itemDB:get(item, function() return ni.getInventory().getItemDetail(k) end)
|
||||
local key = itemDB:makeKey(item)
|
||||
if not list[key] then
|
||||
item.key = key
|
||||
@@ -58,9 +58,9 @@ local function getFood(food)
|
||||
for slot,v in pairs(ni.getInventory().list()) do
|
||||
local key = itemDB:makeKey(v)
|
||||
if key == food then
|
||||
local item = ni.getInventory().getItem(slot)
|
||||
if item and item.consume then
|
||||
return item
|
||||
local item = ni.getInventory().getItemDetail(slot)
|
||||
if item and item.saturation then
|
||||
return slot
|
||||
end
|
||||
break
|
||||
end
|
||||
@@ -87,7 +87,7 @@ Event.onInterval(5, function()
|
||||
if context.state.food and ni.getMetaOwner().food.hungry then
|
||||
local item = getFood(context.state.food)
|
||||
if item then
|
||||
item.consume()
|
||||
ni.getInventory().consume(item)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -101,4 +101,4 @@ return {
|
||||
callback = function()
|
||||
UI:setPage(page)
|
||||
end,
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
{
|
||||
url = "https://raw.githubusercontent.com/kepler155c/opus-recipes/master/switchcraft",
|
||||
version = "MC 1.12",
|
||||
localName = "switchcraft",
|
||||
name = "Switchcraft Server",
|
||||
url = "https://raw.githubusercontent.com/iuzx0/opus-recipes/main/sc-goodies",
|
||||
version = "MC 1.19.4",
|
||||
localName = "sc-goodies",
|
||||
name = "SwitchCraft Goodies mod",
|
||||
},
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user