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