VOOZH about

URL: https://minecraft.wiki/w/Module:Inventory

⇱ Module:Inventory – Minecraft Wiki


Module:Inventory

From Minecraft Wiki
Jump to navigation Jump to search
Documentation[view] [edit] [history] [purge]Jump to code ↴

Once completed, this module will implement GUIs of

[view] [edit] [history] [purge]The above documentation is transcluded from Module:Inventory/doc.
localp={}
localnoInvText=0
--[[
LOCAL addInventory()
Adds inventory underneath the GUI, true by default
]]
localfunctionaddInventory(args)
localhotbar={}
localj=0
whilej<9do
table.insert(hotbar,require("Module:Inventory slot").slot{args[j+1]})
j=j+1
end
localinventory={}
locali=1
whilei<4do
table.insert(inventory,'<span style="display: block;">')
-- For each column (9 for each row)
localj=0
whilej<9do
table.insert(inventory,require("Module:Inventory slot").slot{args[(i*9)+j+1]})
j=j+1
end
table.insert(inventory,'</span>')
i=i+1
end
localfunction_invText()
ifnoInvText==1then
return''
else
return'<span style="position: absolute; bottom:159px; left: 8px; color: #3F3F3F; font-family: Minecraft; font-size: 16px;">Inventory</span>'
end
end
return_invText()..'<span style="position: absolute; bottom: 6px; left: 6px">'..table.concat(inventory)..'<span style="display:block; margin-top:8px">'..table.concat(hotbar)..'</span></span>'
end
--[[
LOCAL recipeBook()
Adds a recipe book for survival, crafting table and furnace inventories
]]
localfunctionrecipeBook(t)
localattr=''
ift=='s'thenattr='top: 114px; left: 200px;'
elseift=='ct'thenattr='top: 60px; left: 2px;'
elseattr='top: 60px; left: 32px;'end
return'<span class="mcui-Inventory-Recipe_Book-button" style="position: absolute;'..attr..'padding: 2px 4px 2px 4px;">[[File:Invicon Recipe Book.png|32px|link=]]</span>'
end
--[[
{{#invoke: Inventory|crafting}}
]]
functionp.crafting(f)
localargs=f
iff==mw.getCurrentFrame()then
args=require('Module:ProcessArgs').merge(true)
else
f=mw.getCurrentFrame()
end
localslot=require('Module:Inventory slot')
localinv=''
ifargs.noinv~=nilorargs.noinv~=''then
inv=addInventory(args)
end
localtableHeight=''
ifargs.noinvthentableHeight='124px'elsetableHeight='304px'end
return'<div><span class="mcui mcui-Inventory-border pixel-image" style="box-sizing: content-box; border-width: 8px; border-style: solid; border-radius: 0; background-clip: padding-box; width: 324px; height:'..tableHeight..'">'..
'<span style="display: block; color: #3F3F3F; font-family: Minecraft; font-size: 16px; text-align:left; margin-left: 44px; margin-top: -6px; overflow: hidden; text-overflow: ellipsis;">'..(args.titleor'Crafting')..'</span>'..
'<span style="position: absolute; top: 24px; left: 50px;"><span style="display: block;">'..slot.slot{args.A1}..slot.slot{args.B1}..slot.slot{args.C1}..'</span>'..
'<span style="display: block;">'..slot.slot{args.A2}..slot.slot{args.B2}..slot.slot{args.C2}..'</span>'..
'<span style="display: block;">'..slot.slot{args.A3}..slot.slot{args.B3}..slot.slot{args.C3}..'</span></span>'..
'<span class="mcui-Inventory-Crafting_Table-arrow" style="position: absolute; top: 60px; left: 172px; width: 44px; height: 32px;"><br></span>'..
slot.slot{args.Output,class='invslot-large',style='position: absolute; top: 52px; left: 230px;'}..
recipeBook('ct')..inv..'</span></div>'
end
--[[
{{#invoke: Inventory|furnace}}
]]
functionp.furnace(f)
localargs=f
iff==mw.getCurrentFrame()then
args=require('Module:ProcessArgs').merge(true)
else
f=mw.getCurrentFrame()
end
localslot=require('Module:Inventory slot')
localinv=''
ifargs.noinv~=nilorargs.noinv~=''then
inv=addInventory(args)
end
localtableHeight=''
ifargs.noinvthentableHeight='124px'elsetableHeight='304px'end
locallit=''
ifargs.lit==nilorargs.lit==''thenlit='-inactive'end
return'<div><span class="mcui mcui-Inventory-border pixel-image" style="box-sizing: content-box; border-width: 8px; border-style: solid; border-radius: 0; background-clip: padding-box; width: 324px; height:'..tableHeight..'">'..
'<span style="display: block; color: #3F3F3F; font-family: Minecraft; font-size: 16px; text-align:center; margin-top: -6px; overflow: hidden; text-overflow: ellipsis;">'..(args.titleor'Furnace')..'</span>'..
'<span style="position: absolute; top: 24px; left: 102px;">'..slot.slot{args.Input}..'<span class="mcui-Inventory-Furnace-fire'..lit..'" style="display: block; width: 36px; height: 36px;"><br></span>'..
slot.slot{args.Fuel,style='display: block; position: absolute; top: 72px;'}..
'<span class="mcui-Inventory-Furnace-progress'..lit..'" style="display: block; position: absolute; top: 36px; left: 50px; width: 44px; height: 36px;"><br></span>'..
slot.slot{args.Output,class='invslot-large',style='position: absolute; top: 28px; left: 112px;'}..'</span>'..
recipeBook('f')..inv..'</span></div>'
end
--[[
{{#invoke: Inventory|brewing}}
]]
functionp.brewing(f)
localargs=f
iff==mw.getCurrentFrame()then
args=require('Module:ProcessArgs').merge(true)
else
f=mw.getCurrentFrame()
end
localslot=require('Module:Inventory slot')
localinv=''
ifargs.noinv~=nilorargs.noinv~=''then
inv=addInventory(args)
end
localtableHeight=''
ifargs.noinvthentableHeight='124px'elsetableHeight='304px'end
localfunction_fuel()
ifargs.fuelandargs.fuel~=''then
iftonumber(args.fuel)<=100then
return(36/100*tonumber(args.fuel))
else
return36
end
else
return0
end
end
localfunction_progress()
ifargs.progressandargs.progress~=''then
localprogress=57
iftonumber(args.progress)<=100then
progress=57/100*tonumber(args.progress)
end
return'<span class="mcui-Inventory-Brewing_Stand-arrow" style="position: absolute; top: 21px; left: 184px; width: 18px; height:'..progress..'px;"><br></span>'
else
return''
end
end
return'<div><span class="mcui mcui-Inventory-border pixel-image" style="box-sizing: content-box; border-width: 8px; border-style: solid; border-radius: 0; background-clip: padding-box; width: 324px; height:'..tableHeight..'">'..
'<span style="display: block; color: #3F3F3F; font-family: Minecraft; font-size: 16px; text-align:center; margin-top: -6px; overflow: hidden; text-overflow: ellipsis;">'..(args.titleor'Brewing Stand')..'</span>'..
slot.slot{args.Fuel,default='Brewing Fuel',style='position: absolute; top: 24px; left: 24px;'}..
slot.slot{args.Input,style='position: absolute; top: 24px; left: 148px;'}..
slot.slot{args.Output1,default='Brewing',style='position: absolute; top: 92px; left: 102px;'}..
slot.slot{args.Output2,default='Brewing',style='position: absolute; top: 106px; left: 148px;'}..
slot.slot{args.Output3,default='Brewing',style='position: absolute; top: 92px; left: 194px;'}..
'<span class="mcui-Inventory-Brewing_Stand-pipes" style="position: absolute; top: 48px; left: 58px; width: 92px; height: 42px;"><br></span>'..
'<span class="mcui-Inventory-Brewing_Stand-paths" style="position: absolute; top: 58px; left: 136px; width: 60px; height: 50px;"><br></span>'..
'<span class="mcui-Inventory-Brewing_Stand-fuel" style="position: absolute; top: 80px; left: 112px; background-size: cover; width:'.._fuel()..'px; height: 8px;"><br></span>'..
'<span class="mcui-Inventory-Brewing_Stand-bubbles'..(args.progressor'-inactive')..'" style="position: absolute; top: 21px; left: 120px; background-size: cover; width: 24px; height: 57px;"><br></span>'..
'<span class="mcui-Inventory-Brewing_Stand-arrow-inactive" style="position: absolute; top: 21px; left: 184px; width: 18px; height: 57px;"><br></span>'..
_progress()..
inv..'</span></div>'
end
--[[
{{#invoke: Inventory|anvil}}
]]
functionp.anvil(f)
localargs=f
iff==mw.getCurrentFrame()then
args=require('Module:ProcessArgs').merge(true)
else
f=mw.getCurrentFrame()
end
localslot=require('Module:Inventory slot')
localinv=''
ifargs.noinv~=nilorargs.noinv~=''then
inv=addInventory(args)
end
localtableHeight=''
ifargs.noinvthentableHeight='124px'elsetableHeight='304px'end
localcrossed=''
ifargs.crossedthen
crossed='-inactive'
end
localfunction_title()
ifargs.textthen
local_text=mw.html.create('span'):addClass('mcui-Anvil-inputbox mcui-input')
localitemName
ifargs.Input1orargs.textthen
localanimate=require([[Module:AnimateText]]).animate
ifargs.textthen
itemName=animate{
args.text:gsub(';',',,')
}
else
itemName=animate{
args.Input1:gsub(';',',,')
}
end
else
_text:addClass('mcui-inactive')
itemName='<br>'
end
_text:wikitext((itemName:gsub('class="animated"','class="mcui-Anvil-inputtext animated"')))
return'<span class="mcui-Inventory-Anvil-input" style="position: absolute; top: 32px; right: 6px; width: 220px; height: 32px;">'..
'<span style="display: block; margin: 5px 6px; color: #FCFCFC; text-shadow: 0.125em 0.125em 0 #3E3E3E; font-family: Minecraft; font-size: 16px; overflow: hidden; text-overflow: ellipsis; max-width: 208px;">'..
tostring(_text)..
'</span></span>'
else
return'<span class="mcui-Inventory-Anvil-input-inactive" style="position: absolute; top: 32px; right: 6px; width: 220px; height: 32px;"><br></span>'
end
end
localfunction_cost()
--return '' --
ifargs.costandargs.cost~=''then
localfunction_expensive()
ifargs.expensiveandargs.expensive~=''then
return'color: #FC5F5F; text-shadow: 0.125em 0.125em #3E1818, 0.125em 0 #3E1818, 0 0.125em #3E1818;'
else
return'color: #7EFC20; text-shadow: 0.125em 0.125em #203E08, 0.125em 0 #203E08, 0 0.125em #203E08;'
end
end
localfunction_cost()
ifargs.cost=='expensive'then
return'Too Expensive!'
else
return'Enchantment Cost: '..args.cost
end
end
return'<span style="display: block; position: absolute; top: 126px; right: 8px; background: #898989; padding: 0 4px 0 4px; font-family: Minecraft; font-size: 16px;'..
_expensive()..'overflow: hidden; text-overflow: ellipsis; max-width: 308px;">'.._cost()..'</span>'
end
return''
end
return'<div><span class="mcui mcui-Inventory-border pixel-image" style="box-sizing: content-box; border-width: 8px; border-style: solid; border-radius: 0; background-clip: padding-box; width: 324px; height:'..tableHeight..'">'..
'<span style="display: block; color: #3F3F3F; font-family: Minecraft; font-size: 16px; text-align:left; margin-left: 106px; margin-top: -6px; overflow: hidden; text-overflow: ellipsis;">'..(args.titleor'Repair & Name')..'</span>'..
_title()..
'<span style="display: block; position: absolute; top: 84px; left: 44px;">'..
slot.slot{args.Input1}..
slot.slot{args.Input2,style='margin-left: 62px'}..
slot.slot{args.Output,style='margin-left: 80px'}..'</span>'..
'<span class="mcui-Inventory-Anvil-hammer" style="position: absolute; top: 6px; left: 26px; background-size: cover; width: 60px; height: 60px;"><br></span>'..
'<span class="mcui-Inventory-Anvil-plus" style="position: absolute; top: 90px; left: 98px; background-size: cover; width: 26px; height: 26px;"><br></span>'..
'<span class="mcui-Inventory-Anvil-arrow'..crossed..'" style="display: block; position: absolute; top: 88px; left: 196px; width: 44px; height: 30px;"><br></span>'..
_cost()..
inv..'</span></div>'
end
--[[
{{#invoke: Inventory|legacy_smithing}}
]]
functionp.legacy_smithing(f)
localargs=f
iff==mw.getCurrentFrame()then
args=require('Module:ProcessArgs').merge(true)
else
f=mw.getCurrentFrame()
end
localslot=require('Module:Inventory slot')
localinv=''
ifargs.noinv~=nilorargs.noinv~=''then
inv=addInventory(args)
end
localcrossed=''
ifargs.crossedthen
crossed='-inactive'
end
localtableHeight=''
ifargs.noinvthentableHeight='124px'elsetableHeight='304px'end
return'<div><span class="mcui mcui-Inventory-border pixel-image" style="box-sizing: content-box; border-width: 8px; border-style: solid; border-radius: 0; background-clip: padding-box; width: 324px; height:'..tableHeight..'">'..
'<span style="display: block; color: #3F3F3F; font-family: Minecraft; font-size: 16px; text-align:left; margin-left: 106px; margin-top: 18px; overflow: hidden; text-overflow: ellipsis;">'..(args.titleor'Upgrade Gear')..'</span>'..
'<span style="display: block; position: absolute; top: 84px; left: 44px;">'..
slot.slot{args.Input1}..
slot.slot{args.Input2,default='Smithing',style='margin-left: 62px'}..
slot.slot{args.Output,style='margin-left: 80px'}..'</span>'..
'<span class="mcui-Inventory-Smithing_Table-hammer" style="position: absolute; top: 6px; left: 26px; background-size: cover; width: 60px; height: 60px;"><br></span>'..
'<span class="mcui-Inventory-Anvil-plus" style="position: absolute; top: 90px; left: 98px; background-size: cover; width: 26px; height: 26px;"><br></span>'..
'<span class="mcui-Inventory-Anvil-arrow'..crossed..'" style="display: block; position: absolute; top: 88px; left: 196px; width: 44px; height: 30px;"><br></span>'..
inv..'</span></div>'
end
--[[
{{#invoke: Inventory|smithing}}
]]
functionp.smithing(f)
localargs=f
iff==mw.getCurrentFrame()then
args=require('Module:ProcessArgs').merge(true)
else
f=mw.getCurrentFrame()
end
localslot=require('Module:Inventory slot')
localinv=''
ifargs.noinv~=nilorargs.noinv~=''then
inv=addInventory(args)
end
return''
end
--[[
{{#invoke: Inventory|survival}}
]]
functionp.survival(f)
localargs=f
iff==mw.getCurrentFrame()then
args=require('Module:ProcessArgs').merge(true)
else
f=mw.getCurrentFrame()
end
localslot=require('Module:Inventory slot')
noInvText=1
localinv=addInventory(args)
localfunction_armor()
return'<span style="display: block; position: absolute; top: 6px; left: 6px;">'..
slot.slot{args[103],default=(args[103]or'Head'),style='display: block;'}..
slot.slot{args[102],default=(args[102]or'Chest'),style='display: block;'}..
slot.slot{args[101],default=(args[101]or'Legs'),style='display: block;'}..
slot.slot{args[100],default=(args[100]or'Feet'),style='display: block;'}..
'</span>'..
'<span class="invslot" style="display: block; position: absolute; top: 6px; left: 42px; width: 98px; height: 140px; background:'..(args.backgroundor'black')..';"><span class="mcui-Inventory-Player-Steve" style="display: block; position: absolute; width: 98px; height: 140px;"></span><br></span>'..
slot.slot{args.offhand,default=(args.offhandor'Offhand'),style='position: absolute; top: 114px; left: 144px;'}..
''
end
return'<div><span class="mcui mcui-Inventory-border pixel-image" style="box-sizing: content-box; border-width: 8px; border-style: solid; border-radius: 0; background-clip: padding-box; width: 324px; height: 304px">'..
_armor()..
'<span style="position: absolute; top: 26px; left: 186px;"><span style="position: absolute; top: -26px; color: #3F3F3F; font-family: Minecraft; font-size: 16px;">Crafting</span>'..
'<span style="display:inline-block;"><span style="display:block;">'..slot.slot{(args.A1or'')}..slot.slot{(args.B1or'')}..'</span>'..
'<span style="display:block;">'..slot.slot{(args.A2or'')}..slot.slot{(args.B2or'')}..'</span></span>'..
'<span class="mcui-Inventory-Table-arrow" style="display: inline-block; width: 32px; height: 26px; vertical-align: top; margin-left: 4px; margin-top: 24px;"><br></span>'..
'<span style="display: inline-block; vertical-align: top; margin-left: 4px; margin-top: 20px;">'..slot.slot{(args.Outputor'')}..'</span></span>'..
recipeBook('s')..inv..'</span></div>'
end
returnp
Retrieved from "https://minecraft.wiki/w/Module:Inventory?oldid=3226485"

Navigation menu