Module:Sandbox

local slot = require( Module:Inventory slot ).slot local addSlot = function( args, item, prefix, class, style, default ) local none, nostacksize prefix = prefix or '' if #prefix == 0 then none = 'none' nostacksize = (item or "") == "" and "" or (args and args[item] and args[item]:gsub( '[,%d]',  ) or ) end return slot{ nostacksize or args[item], mod = args.Mod, link = none or args[prefix .. 'link'], title = none or args[prefix .. 'title'], class = class, style = style, default = default, parsed = args.parsed } end

local p = {}

function p.inventory( f ) local args = f	if f == mw.getCurrentFrame then args = f:getParent.args else f = mw.getCurrentFrame end local invType = args.type local invDisplay = args.inventory local invTitle = args.title local width = invType == '' and 'auto' or '324px' local height if invType == '' then height = 'auto' elseif invType == 'chest' or		  invType == 'ender-chest' or		   invType == 'shulker-box' or		   invType == 'barrel' then height = '306px' elseif invType == 'large-chest' then height = '416px' elseif invType == 'hopper' then height = '238px' elseif invType == 'generic' then height = tostring( 1 * 36 + 20 ) .. 'px' else height = '304px' end if invDisplay == 'no' and height ~= 'auto' then height = tostring( string.gsub( height, 'px', '' ) - 158 ) .. 'px' end local titleStyle if invType == 'brewing-stand' or	  invType == 'dispenser' or	   invType == 'dropper' or	   invType == 'furnace' or	   invType == 'blast-furnace' or	   invType == 'smoker' or	   invType == 'hopper' then titleStyle = 'text-align: center; margin-top: -6px;' elseif invType == 'anvil' then titleStyle = 'text-align: left; margin-left: 106px; margin-top: -6px;' else titleStyle = 'text-align: left; margin-left: 2px; margin-top: -6px;' end local body = mw.html.create( 'span' ):addClass( 'mcui pixel-image' ) body :css{ height = height, width = width, ['border-image'] = ' 4 fill repeat', ['-o-border-image'] = ' 4 fill repeat', ['border-radius'] = '0', border = '8px solid', ['background-clip'] = 'padding-box', ['box-sizing'] = 'content-box' }	body :tag( 'span' ) :cssText( 'display: block; color: #3F3F3F; font-family: Minecraft; font-size: 16px; ' .. titleStyle ) :wikitext( string.gsub( string.gsub( invType, '-', ' ' ), '(%l)(%w*)', function( a, b ) return string.upper( a ) .. b end ) ) if invType == 'chest' or	  invType == 'ender-chest' or	   invType == 'shulker-box' or	   invType == 'barrel' or	   invType == 'large-chest' then local row = invType == 'large-chest' and 6 or 3

for numRow = 0, row - 1 do			local slotsRow = body:tag( 'span' ):css{ display = 'block' } for num = 9 * numRow, 9 * numRow + 8 do slotsRow:wikitext( addSlot( args, 'C' .. num, 'C' ) ) end end end if invType == 'crafting-table' then local inputTable = body:tag( 'span' ) inputTable :css{ position = 'absolute', top = '24px', left = '50px' }		for num = 1, 3 do			local row = inputTable:tag( 'span' ):css{ display = 'block' } for _, letter in ipairs{ 'A', 'B', 'C' } do row:wikitext( addSlot( args, letter .. num ) ) end end local arrow = body:tag( 'span' ) arrow :css{ position = 'absolute', top = '60px', left = '172px', background = '', width = '44px', height = '32px', }			:tag( 'br' ) local outputTable = body:tag( 'span' ) outputTable :css{ position = 'absolute', top = '52px', left = '230px' }			:wikitext( addSlot( args, 'Output', 'O', 'invslot-large' ) ) end return tostring( mw.html.create( 'div' ):node( body ) ) end

return p