VOOZH about

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

⇱ Module:Aicon – Minecraft Wiki


Module:Aicon

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

This module implements {{Aicon}}, supports invocations from other modules.

See template documentation for how to use this module from template.

Functions

[edit source]

Other modules can invoke this module.

Exported function are listed below.

This function generates an icon instance in the style of legacy achievements or advancements in Java Edition.

Syntax: aIcon ( InvIcon, Background, State, Link, InvFile )

  • InvIcon: The name should handled by Module:Inventory icon (not effective when InvFile is specified).
  • Background: The type of achievement or advancement this icon represents. Valid values: plain, oval, fancy, and plain-mini.
  • State: The status of achievement or advancement this icon represents. Valid values: raw, worn (valid only when Background is not plain-mini).
  • Link: Optional, the link target that the icon points to. No link by default.
  • InvFile: Optional, replacing the default icon (provided by Module:Inventory icon) as an image file (omitting File: prefix).

This function is designed for template invocation, without extra parameter accepted, so not recomended to invoke it by other modules.

Dependencies

[edit source]
[view] [edit] [history] [purge]The above documentation is transcluded from Module:Aicon/doc.
localp={}
localinvIcon=require('Module:Inventory icon').icon
functionp.aIcon(icon,background,state,link,file)
localf=mw.getCurrentFrame()
localargIcon=iconor'Grass Block'
localargBackground=backgroundor'plain'
localargState=stateor'raw'
localargLink=linkor''
if(argBackground~='oval')and(argBackground~='fancy')and(argBackground~='plain-mini')then
argBackground='plain'
end
ifargState~='worn'then
argState='raw'
end
if(argBackground=='plain-mini')and(argState~='raw')then
argState='raw'
end
localiconBackground='[[File:Advancement-'..argBackground..'-'..argState..'.png|link='..argLink..'|class=pixel-image]]'
localiconContent
iffileandfile~=''then
iconContent='[[File:'..file..'|link='..argLink..'|32px|class=pixel-image]]'
else
iconContent=invIcon{argIcon,link=argLink}
end
localoutputContent=f:extensionTag{name='span',content=iconContent,args={class='module-Aicon-content'}}
localoutputBackground=f:extensionTag{name='span',content=iconBackground..outputContent,args={class='plainlinks module-Aicon-background'}}
returnrequire('Module:TSLoader').call('Module:Aicon/styles.css')..outputBackground
end
functionp.main(f)
localargs=f
localframe=mw.getCurrentFrame()
iff==framethen
args=require('Module:ProcessArgs').merge(true)
end
returnp.aIcon(args[1],args[2]orargs.bg,args[3]orargs.state,args.link,args.file)
end
returnp
Retrieved from "https://minecraft.wiki/w/Module:Aicon?oldid=2619520"

Navigation menu