Module:Inventory slot/Aliases: Difference between revisions

+ Any Overworld Planks
Revamp nether/overworld stem/log related things. Nether fence etc. are removed, but if needed you can put it back with $world.
Line 15: Line 15:
['Any netherite armor'] = { 'Netherite Helmet', 'Netherite Chestplate', 'Netherite Leggings', 'Netherite Boots' },
['Any netherite armor'] = { 'Netherite Helmet', 'Netherite Chestplate', 'Netherite Leggings', 'Netherite Boots' },
-- Wood --
['Any Log'] = { 'Oak Log', 'Spruce Log', 'Birch Log', 'Jungle Log', 'Acacia Log', 'Dark Oak Log', 'Crimson Stem', 'Warped Stem' },
['Any Stripped Log'] = { 'Stripped Oak Log', 'Stripped Spruce Log', 'Stripped Birch Log', 'Stripped Jungle Log', 'Stripped Acacia Log', 'Stripped Dark Oak Log', 'Stripped Crimson Stem', 'Stripped Warped Stem' },
['Any Wood'] = { 'Oak Wood', 'Spruce Wood', 'Birch Wood', 'Jungle Wood', 'Acacia Wood', 'Dark Oak Wood', 'Crimson Hyphae', 'Warped Hyphae' },
['Any Stripped Wood'] = { 'Stripped Oak Wood', 'Stripped Spruce Wood', 'Stripped Birch Wood', 'Stripped Jungle Wood', 'Stripped Acacia Wood', 'Stripped Dark Oak Wood', 'Stripped Crimson Hyphae', 'Stripped Warped Hyphae' },
['Any Overworld Log'] = { 'Oak Log', 'Spruce Log', 'Birch Log', 'Jungle Log', 'Acacia Log', 'Dark Oak Log' },
['Any Overworld Stripped Log'] = { 'Stripped Oak Log', 'Stripped Spruce Log', 'Stripped Birch Log', 'Stripped Jungle Log', 'Stripped Acacia Log', 'Stripped Dark Oak Log' },
['Any Overworld Wood'] = { 'Oak Wood', 'Spruce Wood', 'Birch Wood', 'Jungle Wood', 'Acacia Wood', 'Dark Oak Wood' },
['Any Overworld Stripped Wood'] = { 'Stripped Oak Wood', 'Stripped Spruce Wood', 'Stripped Birch Wood', 'Stripped Jungle Wood', 'Stripped Acacia Wood', 'Stripped Dark Oak Wood' },
['Any Sapling'] = { 'Oak Sapling', 'Spruce Sapling', 'Birch Sapling', 'Jungle Sapling', 'Acacia Sapling', 'Dark Oak Sapling' },
['Any Overworld Planks'] = { 'Oak Planks', 'Spruce Planks', 'Birch Planks', 'Jungle Planks', 'Acacia Planks', 'Dark Oak Planks' },
['Any Planks'] = { 'Oak Planks', 'Spruce Planks', 'Birch Planks', 'Jungle Planks', 'Acacia Planks', 'Dark Oak Planks', 'Crimson Planks', 'Warped Planks' },
['Any wood Stairs'] = { 'Oak Stairs', 'Spruce Stairs', 'Birch Stairs', 'Jungle Stairs', 'Acacia Stairs', 'Dark Oak Stairs', 'Crimson Stairs', 'Warped Stairs' },
['Any wood Slab'] = { 'Oak Slab', 'Spruce Slab', 'Birch Slab', 'Jungle Slab', 'Acacia Slab', 'Dark Oak Slab', 'Crimson Slab', 'Warped Slab' },
['Any wood Trapdoor'] = { 'Oak Trapdoor', 'Spruce Trapdoor', 'Birch Trapdoor', 'Jungle Trapdoor', 'Acacia Trapdoor', 'Dark Oak Trapdoor', 'Crimson Trapdoor', 'Warped Trapdoor' },
['Any wood Button'] = { 'Oak Button', 'Spruce Button', 'Birch Button', 'Jungle Button', 'Acacia Button', 'Dark Oak Button', 'Crimson Button', 'Warped Button' },
['Any wood Pressure Plate'] = { 'Oak Pressure Plate', 'Spruce Pressure Plate', 'Birch Pressure Plate', 'Jungle Pressure Plate', 'Acacia Pressure Plate', 'Dark Oak Pressure Plate', 'Crimson Pressure Plate', 'Warped Pressure Plate' },
['Any wood Door'] = { 'Oak Door', 'Spruce Door', 'Birch Door', 'Jungle Door', 'Acacia Door', 'Dark Oak Door', 'Crimson Door', 'Warped Door' },
['Any wood Fence'] = { 'Oak Fence', 'Spruce Fence', 'Birch Fence', 'Jungle Fence', 'Acacia Fence', 'Dark Oak Fence', 'Crimson Fence', 'Warped Fence' },
['Any Fence Gate'] = { 'Oak Fence Gate', 'Spruce Fence Gate', 'Birch Fence Gate', 'Jungle Fence Gate', 'Acacia Fence Gate', 'Dark Oak Fence Gate', 'Crimson Fence Gate', 'Warped Fence Gate' },
['Any Sign'] = { 'Oak Sign', 'Spruce Sign', 'Birch Sign', 'Jungle Sign', 'Acacia Sign', 'Dark Oak Sign', 'Crimson Sign', 'Warped Sign' },
['Any Boat'] = { 'Oak Boat', 'Spruce Boat', 'Birch Boat', 'Jungle Boat', 'Acacia Boat', 'Dark Oak Boat' },
     -- stones --
     -- stones --
['Any Cobblestone or Blackstone'] = { 'Cobblestone', 'Blackstone' },
['Any Cobblestone or Blackstone'] = { 'Cobblestone', 'Blackstone' },
Line 322: Line 299:
['Roots'] = { 'Crimson Roots', 'Warped Roots' },
['Roots'] = { 'Crimson Roots', 'Warped Roots' },
['Nylium'] = { 'Crimson Nylium', 'Warped Nylium' },
['Nylium'] = { 'Crimson Nylium', 'Warped Nylium' },
['Nether Planks'] = { 'Crimson Planks', 'Warped Planks' },
['Stem'] = { 'Crimson Stem', 'Warped Stem' },
['Stripped Stem'] = { 'Stripped Crimson Stem', 'Stripped Warped Stem' },
['Hyphae'] = { 'Crimson Hyphae', 'Warped Hyphae' },
['Stripped Hyphae'] = { 'Stripped Crimson Hyphae', 'Stripped Warped Hyphae' },
['Nether Wood Button'] = { 'Crimson Button', 'Warped Button' },
['Nether Wood Pressure Plate'] = { 'Crimson Pressure Plate', 'Warped Pressure Plate' },
['Nether Wood Fence'] = { 'Crimson Fence', 'Warped Fence' },
['Nether Wood Trapdoor'] = { 'Crimson Trapdoor', 'Warped Trapdoor' },
['Nether Wood Fence Gate'] = { 'Crimson Fence Gate', 'Warped Fence Gate' },
['Nether Wood Stairs'] = { 'Crimson Stairs', 'Warped Stairs' },
['Nether Wood Door'] = { 'Crimson Door', 'Warped Door' },
['Nether Wood Sign'] = { 'Crimson Sign', 'Warped Sign' },
['Soul Sand'] = { 'Soul Sand', 'Soul Soil' },
['Soul Sand'] = { 'Soul Sand', 'Soul Soil' },
['Campfire'] = { 'Campfire', 'Soul Campfire' },
['Campfire'] = { 'Campfire', 'Soul Campfire' },
Line 340: Line 304:
['Stone Button'] = { 'Stone Button', 'Polished Blackstone Button' },
['Stone Button'] = { 'Stone Button', 'Polished Blackstone Button' },
['Stone Pressure Plate'] = { 'Stone Pressure Plate', 'Polished Blackstone Pressure Plate' },
['Stone Pressure Plate'] = { 'Stone Pressure Plate', 'Polished Blackstone Pressure Plate' },
}
}
table.insert( itemVariants['Dye'], 1, 'White Dye' )
table.insert( itemVariants['Dye'], 1, 'White Dye' )
Line 696: Line 658:


-- Wood --
-- Wood --
local logs = {
local woodTypes = {
'Oak',
    overworld = {
'Spruce',
        'Oak',
'Birch',
    'Spruce',
'Jungle',
    'Birch',
'Acacia',
    'Jungle',
'Dark Oak',
    'Acacia',
        'Dark Oak',
    },
    nether = {
        'Crimson',
        'Warped'
    },
    both = {},
}
}
local woodTypeWorld = {}
for world, woods in pairs(woodTypes) do
for _, type in ipairs(woods) do
woodTypeWorld[type] = world
        table.insert(woodTypes.both, type)
    end
end
local woodItems = {
local woodItems = {
'Wood',
    overworld = {
'Log',
        'Wood',
'Planks',
        'Log',
'Fence Gate',
        'Boat',
'Boat',
        'Stripped $1 Log',
'wood Door',
        'Stripped $1 Wood',
'wood Fence',
        'Wood Planks',
'wood Button',
        'Wood Slab',
'wood Pressure Plate',
        'Sapling',
'wood Trapdoor',
    },
'wood Slab',
    nether = {
'wood Stairs',
        'Stem',
'Stripped $1 Log',
        'Hyphae',
'Stripped $1 Wood',
        'Stripped $1 Stem',
'Wood Planks',
        'Stripped $1 Hyphae',
'Wood Slab',
    },
'Wood Stairs',
    both = {
'Sign',
        '$world Planks',
'Sapling',
        '${Wood,Hyphae}',
        '${Log,Stem}',
        'Stripped $1 ${Wood,Hyphae}',
        'Stripped $1 ${Log,Stem}',
        'Fence Gate',
        '$world Wood Fence',
        '$wood fence',
        '$wood Button',
        '$wood Pressure Plate',
        '$wood Trapdoor',
        '$world $wood Slab',
        '$wood Stairs',
        'Sign'
    }
}
}
local woodItemWorld = {}
for world, items in pairs(woodItems) do
    for _, item in ipairs(items) do
-- expand $world (should only happen in "both")
        if (item:find('%$world')) and world == 'both' then
            item = string.gsub(item, '%$world ', '')
            woodItemWorld['Overworld ' .. item] = 'overworld'
woodItemWorld['Nether ' .. item] = 'nether'
end
woodItemWorld[item] = world
    end
end


for _, item in ipairs( woodItems ) do
for item, world in pairs(woodItemWorld) do
local itemName = ''
local itemName = ''
local woodAliases = {}
local woodAliases = {}
 
for _, wood in ipairs( logs ) do
-- real "linkable" name
if item:find('wood') then
    local realItem = string.gsub(item, '^Overworld ', '')
itemName = string.gsub( item, 'wood', wood )
    realItem = string.gsub(realItem, '^Nether ', '')
elseif item:find('%$1') then
 
itemName = string.gsub( item, '%$1', wood )
for _, wood in ipairs(woodTypes[world]) do
-- Parse ${,} (world-select) syntax
local selector = woodTypeWorld[wood] == 'overworld' and "%1" or "%2"
realItem = string.gsub(realItem, "%${(.-),(.-)}", selector)
 
if realItem:find('%$wood') then
itemName = string.gsub(realItem, '%$wood', wood)
elseif realItem:find('%$1') then
itemName = string.gsub(realItem, '%$1', wood)
else
else
itemName = wood .. ' ' .. item
itemName = wood .. ' ' .. item
end
end
table.insert( woodAliases, itemName )
table.insert(woodAliases, itemName)
end
end
 
item = string.gsub( item, '%$1 ', '' )
-- Parse ${,} (world-select) syntax
item = string.gsub(item, "%${(.-),(.-)}", "%1 or %2")
    item = string.gsub(item, '%$wood ', 'Wood ')
    item = string.gsub(item, '%$1 ', '')
    aliases['Any ' .. item] = woodAliases
aliases['Matching ' .. item] = woodAliases
aliases['Matching ' .. item] = woodAliases
end
end