Module:UI: Difference between revisions
Jump to navigation
Jump to search
Create: Minecraft Mod Wiki>Joker876 No edit summary |
Create: Minecraft Mod Wiki>Vincent243 No edit summary |
||
Line 1: | Line 1: | ||
local slot = require( [[Module:Inventory slot]] ).slot | local slot = require( [[Module:Inventory slot]] ).slot | ||
local function | local addSlot = function( args, item, prefix, class, default ) | ||
local none, nostacksize | local none, nostacksize | ||
prefix = prefix or '' | prefix = prefix or '' | ||
if #prefix == 0 then | if #prefix == 0 then | ||
none = 'none' | none = 'none' | ||
nostacksize = ((item == '' or nil) and '') or (args and args[item] and args[item]:gsub('[,%d]', '') or '') | nostacksize = ((item == '' or nil) and '') or (args and args[item] and args[item]:gsub( '[,%d]', '' ) or '') | ||
end | end | ||
return slot{ | return slot{ | ||
nostacksize or args[item], mod = args.Mod, link = none or args[prefix .. 'link'], | nostacksize or args[item], mod = args.Mod, link = none or args[prefix .. 'link'], | ||
title = none or args[prefix .. 'title'], class = class, default = default, | title = none or args[prefix .. 'title'], class = class, default = default, | ||
parsed = args.parsed | parsed = args.parsed | ||
} | } | ||
end | end | ||
Line 18: | Line 18: | ||
-- Crafting table | -- Crafting table | ||
function p.craftingTable(f) | function p.craftingTable( f ) | ||
local args = f | local args = f | ||
if f == mw.getCurrentFrame() then | if f == mw.getCurrentFrame() then | ||
Line 26: | Line 26: | ||
end | end | ||
local body = mw.html.create('span'):addClass('mcui mcui-Crafting_Table pixel-image') | local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Crafting_Table pixel-image' ) | ||
local input = body:tag( 'span' ):addClass( 'mcui-input' ) | |||
local input = body:tag(' | |||
for num = 1, 3 do | for num = 1, 3 do | ||
local row = input:tag(' | local row = input:tag( 'span' ):addClass( 'mcui-row' ) | ||
for _, letter in ipairs{ 'A', 'B', 'C' } do | for _, letter in ipairs{ 'A', 'B', 'C' } do | ||
row:wikitext( addSlot( args, letter .. num, 'I' ) ) | |||
end | end | ||
end | end | ||
local arrow = body:tag('span'):addClass('mcui-arrow'):tag('br'):done() | local arrow = body:tag( 'span' ):addClass( 'mcui-arrow' ):tag( 'br' ):done() | ||
if args.arrow or '' ~= '' then | if args.arrow or '' ~= '' then | ||
arrow:css( | arrow:css( | ||
Line 47: | Line 45: | ||
body | body | ||
:tag('span') | :tag( 'span' ) | ||
:addClass('mcui-output') | :addClass( 'mcui-output' ) | ||
:wikitext(addSlot(args, 'Output', 'O', 'invslot-large')) | :wikitext( addSlot( args, 'Output', 'O', 'invslot-large' ) ) | ||
local shapeless = args.shapeless or '' | local shapeless = args.shapeless or '' | ||
local fixed = args.fixed or '' | local fixed = args.fixed or '' | ||
if shapeless ~= '' or fixed ~= '' then | if shapeless ~= '' or fixed ~= '' then | ||
local icon = body:tag('span') | local icon = body:tag( 'span' ) | ||
:addClass('mcui-icons') | :addClass( 'mcui-icons' ) | ||
:tag('span') | :tag( 'span' ) | ||
:tag('br') | :tag( 'br' ) | ||
:done() | :done() | ||
if shapeless ~= '' then | if shapeless ~= '' then | ||
icon:addClass('mcui-shapeless') | icon:addClass( 'mcui-shapeless' ) | ||
:attr('title', | :attr( 'title', | ||
'This recipe is shapeless, the inputs may be placed in any arrangement in the crafting grid.' | 'This recipe is shapeless, the inputs may be placed in any arrangement in the crafting grid.' | ||
) | ) | ||
Line 71: | Line 69: | ||
end | end | ||
icon:addClass('mcui-fixed') | icon:addClass( 'mcui-fixed' ) | ||
:attr('title', | :attr( 'title', | ||
'This recipe is fixed, the input arrangement may not be moved or mirrored in the crafting grid' .. exceptFixed .. '.' | 'This recipe is fixed, the input arrangement may not be moved or mirrored in the crafting grid' .. exceptFixed .. '.' | ||
) | ) | ||
Line 78: | Line 76: | ||
end | end | ||
return tostring(mw.html.create('div'):node(body)) | return tostring( mw.html.create( 'div' ):node( body ) ) | ||
end | end | ||
-- Furnace | -- Furnace | ||
function p.furnace(f) | function p.furnace( f ) | ||
local args = f | local args = f | ||
if f == mw.getCurrentFrame() then | if f == mw.getCurrentFrame() then | ||
Line 90: | Line 88: | ||
end | end | ||
local body = mw.html.create('span'):addClass('mcui mcui-Furnace pixel-image') | local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Furnace pixel-image' ) | ||
local input = body:tag('span'):addClass('mcui-input') | local input = body:tag( 'span' ):addClass( 'mcui-input' ) | ||
input:wikitext(addSlot(args, 'Input', 'I')) | input:wikitext( addSlot( args, 'Input', 'I' ) ) | ||
local fuel = input:tag('span'):addClass('mcui-fuel'):tag('br'):done() | local fuel = input:tag( 'span' ):addClass( 'mcui-fuel' ):tag( 'br' ):done() | ||
local fuelImg = args.FuelUsage or '' | local fuelImg = args.FuelUsage or '' | ||
local burning = args.Input or '' ~= '' and args.Fuel or '' ~= '' | local burning = args.Input or '' ~= '' and args.Fuel or '' ~= '' | ||
if not burning then | if not burning then | ||
fuel:addClass('mcui-inactive') | fuel:addClass( 'mcui-inactive' ) | ||
if fuelImg ~= '' then | if fuelImg ~= '' then | ||
fuelImg = fuelImg .. ' (in-active)' | fuelImg = fuelImg .. ' (in-active)' | ||
Line 109: | Line 107: | ||
) | ) | ||
end | end | ||
input:wikitext(addSlot(args, 'Fuel', 'F')) | input:wikitext( addSlot( args, 'Fuel', 'F' ) ) | ||
local arrow = body:tag('span'):addClass('mcui-arrow'):tag('br'):done() | local arrow = body:tag( 'span' ):addClass( 'mcui-arrow' ):tag( 'br' ):done() | ||
local arrowImg = args.Progress or '' | local arrowImg = args.Progress or '' | ||
if not burning or (args.Output or '') == '' then | if not burning or ( args.Output or '' ) == '' then | ||
arrow:addClass('mcui-inactive') | arrow:addClass( 'mcui-inactive' ) | ||
if arrowImg ~= '' then | if arrowImg ~= '' then | ||
arrowImg = arrowImg .. ' (in-active)' | arrowImg = arrowImg .. ' (in-active)' | ||
Line 127: | Line 125: | ||
body | body | ||
:tag('span') | :tag( 'span' ) | ||
:addClass('mcui-output') | :addClass( 'mcui-output' ) | ||
:wikitext(addSlot(args, 'Output', 'O', 'invslot-large')) | :wikitext( addSlot( args, 'Output', 'O', 'invslot-large' ) ) | ||
args.Experience = args.Experience or '' | |||
if args.Experience ~= '' then | |||
-- Converts commas to dots, removes all spaces and splits the arguments with semicolon. | |||
local split = mw.text.split(string.gsub(args.Experience, '[ ,]', {[' '] = '', [','] = '.'}), ';', true) | |||
local animated = body:tag('span'):attr('title', 'If there is a fractional part, it means the recipe has a chance equal to the fractional part of rewarding an additional XP point.') | |||
:addClass('animated'):cssText('position:absolute;top:92px;left:108px;text-align:center;width:70px;') | |||
local isNotFirst = true | |||
for i, v in ipairs(split) do | |||
assert(tonumber(v), 'Module:UI: "' .. v .. '" is not a valid number') | |||
local xp = tonumber(v) | |||
animated:tag('span') | |||
:addClass(isNotFirst and 'animated-active' or nil) | |||
:wikitext('<span style="display:inline-block;margin-top:3px;width:16px;height:16px;vertical-align:top;background-size:16px 16px;background-image:{{FileUrl|' .. experience_image(xp) .. '}}"></span>' | |||
.. '<span style="display:inline-block;vertical-align:top;font-family:Minecraft;font-size:16px;color:#404040">' | |||
.. (' ' and xp > 72 or '') .. xp .. '</span>') | |||
isNotFirst = false | |||
end | |||
end | |||
return tostring(mw.html.create('div'):node(body)) | return tostring( mw.html.create( 'div' ):node( body ) ) | ||
end | end | ||
-- Brewing Stand | -- Brewing Stand | ||
function p.brewingStand(f) | function p.brewingStand( f ) | ||
local args = f | local args = f | ||
if f == mw.getCurrentFrame() then | if f == mw.getCurrentFrame() then | ||
Line 143: | Line 160: | ||
end | end | ||
local body = mw.html.create('span'):addClass('mcui mcui-Brewing_Stand pixel-image') | local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Brewing_Stand pixel-image' ) | ||
local input = body:tag('span'):addClass('mcui-input') | local input = body:tag( 'span' ):addClass( 'mcui-input' ) | ||
input:tag('span'):addClass('mcui-bubbling'):tag('br') | input:tag( 'span' ):addClass( 'mcui-bubbling' ):tag( 'br' ) | ||
input:wikitext(addSlot(args, 'Input', 'I')) | input:wikitext( addSlot( args, 'Input', 'I' ) ) | ||
input:tag('span'):addClass('mcui-arrow'):tag('br') | input:tag( 'span' ):addClass( 'mcui-arrow' ):tag( 'br' ) | ||
if (args.Input or '') == '' or | if ( args.Input or '' ) == '' or | ||
((args.Output1 or '') == '' and (args.Output2 or '') == '' and (args.Output3 or '') == '') | ( ( args.Output1 or '' ) == '' and ( args.Output2 or '' ) == '' and ( args.Output3 or '' ) == '' ) | ||
then | then | ||
input:addClass('mcui-inactive') | input:addClass( 'mcui-inactive' ) | ||
end | end | ||
body:tag('span'):addClass('mcui-paths'):tag('br') | body:tag( 'span' ):addClass( 'mcui-paths' ):tag( 'br' ) | ||
local output = body:tag('span'):addClass('mcui-output') | local output = body:tag( 'span' ):addClass( 'mcui-output' ) | ||
for i = 1, 3 do | for i = 1, 3 do | ||
output:wikitext(addSlot(args, 'Output' .. i, 'O' .. i, 'mcui-output' .. i)) | output:wikitext( addSlot( args, 'Output' .. i, 'O' .. i, 'mcui-output' .. i ) ) | ||
end | end | ||
return tostring(mw.html.create('div'):node(body)) | return tostring( mw.html.create( 'div' ):node( body ) ) | ||
end | end | ||
-- Stonecutter | -- Stonecutter | ||
function p.stonecutter(f) | function p.stonecutter( f ) | ||
local args = f | local args = f | ||
if f == mw.getCurrentFrame() then | if f == mw.getCurrentFrame() then | ||
Line 174: | Line 191: | ||
end | end | ||
local body = mw.html.create('span'):addClass('mcui mcui-Stonecutter pixel-image') | local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Stonecutter pixel-image' ) | ||
local input = body:tag('span'):addClass('mcui-input') | local input = body:tag( 'span' ):addClass( 'mcui-input' ) | ||
input:wikitext(addSlot(args, 'Input', 'I')) | input:wikitext( addSlot( args, 'Input', 'I' ) ) | ||
local arrow = body:tag('span'):addClass('mcui-stonecutterArrow') | local arrow = body:tag( 'span' ):addClass( 'mcui-stonecutterArrow' ) | ||
if (args.arrow or '') ~= '' then | if (args.arrow or '') ~= '' then | ||
arrow:css( | arrow:css( | ||
Line 186: | Line 203: | ||
) | ) | ||
end | end | ||
arrow:wikitext(addSlot(args, 'Output', '', 'invslot-plain | arrow:wikitext( addSlot( args, 'Output', '', 'invslot-plain mcui-stonecutterSprite' ) ) | ||
body | body | ||
:tag('span') | :tag( 'span' ) | ||
:addClass('mcui-output') | :addClass( 'mcui-output' ) | ||
:wikitext(addSlot(args, 'Output', 'O', 'invslot-large')) | :wikitext( addSlot( args, 'Output', 'O', 'invslot-large' ) ) | ||
return tostring(mw.html.create('div'):node(body)) | return tostring( mw.html.create( 'div' ):node( body ) ) | ||
end | end | ||
-- Loom | -- Loom | ||
function p.loom(f) | function p.loom( f ) | ||
local args = f | local args = f | ||
if f == mw.getCurrentFrame() then | if f == mw.getCurrentFrame() then | ||
Line 205: | Line 222: | ||
end | end | ||
local body = mw.html.create('span'):addClass('mcui mcui-Loom pixel-image') | local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Loom pixel-image' ) | ||
local tapestry = body:tag('span'):addClass('mcui-tapestry') | local tapestry = body:tag( 'span' ):addClass( 'mcui-tapestry' ) | ||
if args.Banner and #args.Banner>0 then | if args.Banner and #args.Banner>0 then | ||
tapestry:wikitext(addSlot(args, 'Banner', 'B', 'mcui-inputBanner')) | tapestry:wikitext( addSlot( args, 'Banner', 'B', 'mcui-inputBanner' ) ) | ||
end | end | ||
if args.Dye and #args.Dye>0 then | if args.Dye and #args.Dye>0 then | ||
tapestry:wikitext(addSlot(args, 'Dye', 'D', 'mcui-inputDye')) | tapestry:wikitext( addSlot( args, 'Dye', 'D', 'mcui-inputDye' ) ) | ||
end | end | ||
if args.Pattern and #args.Pattern>0 then | if args.Pattern and #args.Pattern>0 then | ||
tapestry:wikitext(addSlot(args, 'Pattern', 'P', 'mcui-inputPattern')) | tapestry:wikitext( addSlot( args, 'Pattern', 'P', 'mcui-inputPattern' ) ) | ||
end | end | ||
tapestry:tag('span'):tag('br'):done() | tapestry:tag( 'span' ):tag( 'br' ):done() | ||
local arrow = body:tag('span'):addClass('mcui-loomArrow') | local arrow = body:tag( 'span' ):addClass( 'mcui-loomArrow' ) | ||
if args.arrow or '' ~= '' then | if args.arrow or '' ~= '' then | ||
arrow:css( | arrow:css( | ||
Line 229: | Line 246: | ||
local bannerSprite | local bannerSprite | ||
if sprite and #sprite>0 then | if sprite and #sprite>0 then | ||
local animate = require([[Module:AnimateSprite]]).animate | local animate = require( [[Module:AnimateSprite]] ).animate | ||
bannerSprite = animate{ | bannerSprite = animate{ | ||
args.Sprite, | args.Sprite, | ||
Line 239: | Line 256: | ||
arrow | arrow | ||
:tag('span') | :tag( 'span' ) | ||
:addClass('mcui-bannerSprite') | :addClass( 'mcui-bannerSprite' ) | ||
:wikitext(bannerSprite) | :wikitext( bannerSprite ) | ||
body | body | ||
:tag('span') | :tag( 'span' ) | ||
:addClass('mcui-output') | :addClass( 'mcui-output' ) | ||
:wikitext(addSlot(args, 'Output', 'O', 'invslot-large')) | :wikitext( addSlot( args, 'Output', 'O', 'invslot-large' ) ) | ||
return tostring(mw.html.create('div'):node(body)) | return tostring( mw.html.create( 'div' ):node( body ) ) | ||
end | end | ||
-- Grindstone | -- Grindstone | ||
function p.grindstone(f) | function p.grindstone( f ) | ||
local args = f | local args = f | ||
if f == mw.getCurrentFrame() then | if f == mw.getCurrentFrame() then | ||
Line 260: | Line 277: | ||
end | end | ||
local body = mw.html.create('span'):addClass('mcui mcui-Grindstone pixel-image') | local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Grindstone pixel-image' ) | ||
local grindstone = body:tag('span'):addClass('mcui-grindstone') | local grindstone = body:tag( 'span' ):addClass( 'mcui-grindstone' ) | ||
grindstone:wikitext(addSlot(args, 'Input1', 'I1', 'mcui-input1')) | grindstone:wikitext( addSlot( args, 'Input1', 'I1', 'mcui-input1' ) ) | ||
grindstone:wikitext(addSlot(args, 'Input2', 'I2', 'mcui-input2')) | grindstone:wikitext( addSlot( args, 'Input2', 'I2', 'mcui-input2' ) ) | ||
local arrow = body:tag('span'):addClass('mcui-arrow') | local arrow = body:tag( 'span' ):addClass( 'mcui-arrow' ) | ||
if args.arrow or '' ~= '' then | if args.arrow or '' ~= '' then | ||
arrow:css( | arrow:css( | ||
Line 274: | Line 291: | ||
body | body | ||
:tag('span') | :tag( 'span' ) | ||
:addClass('mcui-output') | :addClass( 'mcui-output' ) | ||
:wikitext(addSlot(args, 'Output', 'O', 'invslot-large')) | :wikitext( addSlot( args, 'Output', 'O', 'invslot-large' ) ) | ||
return tostring( mw.html.create( 'div' ):node( body ) ) | |||
return tostring(mw.html.create('div'):node(body)) | |||
end | end | ||
-- Smithing Table | |||
function p.smithing (f) | |||
local args = f | |||
if f == mw.getCurrentFrame() then | |||
function p. | |||
args = f:getParent().args | args = f:getParent().args | ||
else | else | ||
f = mw.getCurrentFrame() | f = mw.getCurrentFrame() | ||
end | end | ||
return tostring( mw.html.create( 'div' ):node( body ) ) | |||
end | end | ||
return p | return p |
Revision as of 14:19, 14 October 2021
Documentation for this module may be created at Module:UI/doc
local slot = require( [[Module:Inventory slot]] ).slot
local addSlot = function( args, item, prefix, class, default )
local none, nostacksize
prefix = prefix or ''
if #prefix == 0 then
none = 'none'
nostacksize = ((item == '' or nil) 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, default = default,
parsed = args.parsed
}
end
local p = {}
-- Crafting table
function p.craftingTable( f )
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
else
f = mw.getCurrentFrame()
end
local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Crafting_Table pixel-image' )
local input = body:tag( 'span' ):addClass( 'mcui-input' )
for num = 1, 3 do
local row = input:tag( 'span' ):addClass( 'mcui-row' )
for _, letter in ipairs{ 'A', 'B', 'C' } do
row:wikitext( addSlot( args, letter .. num, 'I' ) )
end
end
local arrow = body:tag( 'span' ):addClass( 'mcui-arrow' ):tag( 'br' ):done()
if args.arrow or '' ~= '' then
arrow:css(
'background-image',
'{{FileUrl|' .. args.arrow .. ' (' .. args.Mod .. ').png}}'
)
end
body
:tag( 'span' )
:addClass( 'mcui-output' )
:wikitext( addSlot( args, 'Output', 'O', 'invslot-large' ) )
local shapeless = args.shapeless or ''
local fixed = args.fixed or ''
if shapeless ~= '' or fixed ~= '' then
local icon = body:tag( 'span' )
:addClass( 'mcui-icons' )
:tag( 'span' )
:tag( 'br' )
:done()
if shapeless ~= '' then
icon:addClass( 'mcui-shapeless' )
:attr( 'title',
'This recipe is shapeless, the inputs may be placed in any arrangement in the crafting grid.'
)
elseif fixed ~= '' then
local notFixed = args.notfixed or ''
local exceptFixed = ''
if notFixed ~= '' then
exceptFixed = '; except for ' .. notFixed .. ', which can go anywhere'
end
icon:addClass( 'mcui-fixed' )
:attr( 'title',
'This recipe is fixed, the input arrangement may not be moved or mirrored in the crafting grid' .. exceptFixed .. '.'
)
end
end
return tostring( mw.html.create( 'div' ):node( body ) )
end
-- Furnace
function p.furnace( f )
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
else
f = mw.getCurrentFrame()
end
local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Furnace pixel-image' )
local input = body:tag( 'span' ):addClass( 'mcui-input' )
input:wikitext( addSlot( args, 'Input', 'I' ) )
local fuel = input:tag( 'span' ):addClass( 'mcui-fuel' ):tag( 'br' ):done()
local fuelImg = args.FuelUsage or ''
local burning = args.Input or '' ~= '' and args.Fuel or '' ~= ''
if not burning then
fuel:addClass( 'mcui-inactive' )
if fuelImg ~= '' then
fuelImg = fuelImg .. ' (in-active)'
end
end
if fuelImg ~= '' then
fuel:css(
'background-image',
'{{FileUrl|' .. fuelImg .. ' (' .. args.Mod .. ').png}}'
)
end
input:wikitext( addSlot( args, 'Fuel', 'F' ) )
local arrow = body:tag( 'span' ):addClass( 'mcui-arrow' ):tag( 'br' ):done()
local arrowImg = args.Progress or ''
if not burning or ( args.Output or '' ) == '' then
arrow:addClass( 'mcui-inactive' )
if arrowImg ~= '' then
arrowImg = arrowImg .. ' (in-active)'
end
end
if arrowImg ~= '' then
arrow:css(
'background-image',
'{{FileUrl|' .. arrowImg .. ' Progress (' .. args.Mod .. ').png}}'
)
end
body
:tag( 'span' )
:addClass( 'mcui-output' )
:wikitext( addSlot( args, 'Output', 'O', 'invslot-large' ) )
args.Experience = args.Experience or ''
if args.Experience ~= '' then
-- Converts commas to dots, removes all spaces and splits the arguments with semicolon.
local split = mw.text.split(string.gsub(args.Experience, '[ ,]', {[' '] = '', [','] = '.'}), ';', true)
local animated = body:tag('span'):attr('title', 'If there is a fractional part, it means the recipe has a chance equal to the fractional part of rewarding an additional XP point.')
:addClass('animated'):cssText('position:absolute;top:92px;left:108px;text-align:center;width:70px;')
local isNotFirst = true
for i, v in ipairs(split) do
assert(tonumber(v), 'Module:UI: "' .. v .. '" is not a valid number')
local xp = tonumber(v)
animated:tag('span')
:addClass(isNotFirst and 'animated-active' or nil)
:wikitext('<span style="display:inline-block;margin-top:3px;width:16px;height:16px;vertical-align:top;background-size:16px 16px;background-image:{{FileUrl|' .. experience_image(xp) .. '}}"></span>'
.. '<span style="display:inline-block;vertical-align:top;font-family:Minecraft;font-size:16px;color:#404040">'
.. (' ' and xp > 72 or '') .. xp .. '</span>')
isNotFirst = false
end
end
return tostring( mw.html.create( 'div' ):node( body ) )
end
-- Brewing Stand
function p.brewingStand( f )
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
else
f = mw.getCurrentFrame()
end
local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Brewing_Stand pixel-image' )
local input = body:tag( 'span' ):addClass( 'mcui-input' )
input:tag( 'span' ):addClass( 'mcui-bubbling' ):tag( 'br' )
input:wikitext( addSlot( args, 'Input', 'I' ) )
input:tag( 'span' ):addClass( 'mcui-arrow' ):tag( 'br' )
if ( args.Input or '' ) == '' or
( ( args.Output1 or '' ) == '' and ( args.Output2 or '' ) == '' and ( args.Output3 or '' ) == '' )
then
input:addClass( 'mcui-inactive' )
end
body:tag( 'span' ):addClass( 'mcui-paths' ):tag( 'br' )
local output = body:tag( 'span' ):addClass( 'mcui-output' )
for i = 1, 3 do
output:wikitext( addSlot( args, 'Output' .. i, 'O' .. i, 'mcui-output' .. i ) )
end
return tostring( mw.html.create( 'div' ):node( body ) )
end
-- Stonecutter
function p.stonecutter( f )
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
else
f = mw.getCurrentFrame()
end
local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Stonecutter pixel-image' )
local input = body:tag( 'span' ):addClass( 'mcui-input' )
input:wikitext( addSlot( args, 'Input', 'I' ) )
local arrow = body:tag( 'span' ):addClass( 'mcui-stonecutterArrow' )
if (args.arrow or '') ~= '' then
arrow:css(
'background-image',
'{{FileUrl|' .. args.arrow .. ' (' .. args.Mod .. ').png}}'
)
end
arrow:wikitext( addSlot( args, 'Output', '', 'invslot-plain mcui-stonecutterSprite' ) )
body
:tag( 'span' )
:addClass( 'mcui-output' )
:wikitext( addSlot( args, 'Output', 'O', 'invslot-large' ) )
return tostring( mw.html.create( 'div' ):node( body ) )
end
-- Loom
function p.loom( f )
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
else
f = mw.getCurrentFrame()
end
local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Loom pixel-image' )
local tapestry = body:tag( 'span' ):addClass( 'mcui-tapestry' )
if args.Banner and #args.Banner>0 then
tapestry:wikitext( addSlot( args, 'Banner', 'B', 'mcui-inputBanner' ) )
end
if args.Dye and #args.Dye>0 then
tapestry:wikitext( addSlot( args, 'Dye', 'D', 'mcui-inputDye' ) )
end
if args.Pattern and #args.Pattern>0 then
tapestry:wikitext( addSlot( args, 'Pattern', 'P', 'mcui-inputPattern' ) )
end
tapestry:tag( 'span' ):tag( 'br' ):done()
local arrow = body:tag( 'span' ):addClass( 'mcui-loomArrow' )
if args.arrow or '' ~= '' then
arrow:css(
'background-image',
'{{FileUrl|' .. args.arrow .. ' (' .. args.Mod .. ').png}}'
)
end
local sprite = args.Sprite
local bannerSprite
if sprite and #sprite>0 then
local animate = require( [[Module:AnimateSprite]] ).animate
bannerSprite = animate{
args.Sprite,
sheet = 'SlotSprite'
}
else
bannerSprite = '<br>'
end
arrow
:tag( 'span' )
:addClass( 'mcui-bannerSprite' )
:wikitext( bannerSprite )
body
:tag( 'span' )
:addClass( 'mcui-output' )
:wikitext( addSlot( args, 'Output', 'O', 'invslot-large' ) )
return tostring( mw.html.create( 'div' ):node( body ) )
end
-- Grindstone
function p.grindstone( f )
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
else
f = mw.getCurrentFrame()
end
local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Grindstone pixel-image' )
local grindstone = body:tag( 'span' ):addClass( 'mcui-grindstone' )
grindstone:wikitext( addSlot( args, 'Input1', 'I1', 'mcui-input1' ) )
grindstone:wikitext( addSlot( args, 'Input2', 'I2', 'mcui-input2' ) )
local arrow = body:tag( 'span' ):addClass( 'mcui-arrow' )
if args.arrow or '' ~= '' then
arrow:css(
'background-image',
'{{FileUrl|' .. args.arrow .. ' (' .. args.Mod .. ').png}}'
)
end
body
:tag( 'span' )
:addClass( 'mcui-output' )
:wikitext( addSlot( args, 'Output', 'O', 'invslot-large' ) )
return tostring( mw.html.create( 'div' ):node( body ) )
end
-- Smithing Table
function p.smithing (f)
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
else
f = mw.getCurrentFrame()
end
return tostring( mw.html.create( 'div' ):node( body ) )
end
return p