<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.celestek.xyz/index.php?action=history&amp;feed=atom&amp;title=Module%3AGrid_branch_anyrandom</id>
		<title>Module:Grid branch anyrandom - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.celestek.xyz/index.php?action=history&amp;feed=atom&amp;title=Module%3AGrid_branch_anyrandom"/>
		<link rel="alternate" type="text/html" href="https://wiki.celestek.xyz/index.php?title=Module:Grid_branch_anyrandom&amp;action=history"/>
		<updated>2026-04-29T08:00:02Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.24.2</generator>

	<entry>
		<id>//wiki.celestek.xyz/index.php?title=Module:Grid_branch_anyrandom&amp;diff=187&amp;oldid=prev</id>
		<title>Celestek: Created page with &quot;local p = {} -- Individual cell function p.cell( f ) 	local args = f.args or f 	if f == mw.getCurrentFrame() and args[1] == nil then 		args = f:getParent().args 	end 	 	args[1...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.celestek.xyz/index.php?title=Module:Grid_branch_anyrandom&amp;diff=187&amp;oldid=prev"/>
				<updated>2015-04-24T11:25:37Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;local p = {} -- Individual cell function p.cell( f ) 	local args = f.args or f 	if f == mw.getCurrentFrame() and args[1] == nil then 		args = f:getParent().args 	end 	 	args[1...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
-- Individual cell&lt;br /&gt;
function p.cell( f )&lt;br /&gt;
	local args = f.args or f&lt;br /&gt;
	if f == mw.getCurrentFrame() and args[1] == nil then&lt;br /&gt;
		args = f:getParent().args&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	args[1] = mw.text.trim( args[1] or '' )&lt;br /&gt;
	&lt;br /&gt;
	-- Comment this next line out if you're not using aliases&lt;br /&gt;
	local aliases = mw.loadData( 'Module:Grid/Aliases' )&lt;br /&gt;
	&lt;br /&gt;
	local modAliases = args.modaliases or ''&lt;br /&gt;
	if modAliases ~= '' then&lt;br /&gt;
		modAliases = mw.loadData( 'Module:' .. modAliases )&lt;br /&gt;
	else&lt;br /&gt;
		modAliases = nil&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if aliases or modAliases then&lt;br /&gt;
		local frames = {}&lt;br /&gt;
		for frame in mw.text.gsplit( args[1], '%s*;%s*' ) do&lt;br /&gt;
			local frameParts = p.getParts( frame, args.mod )&lt;br /&gt;
			&lt;br /&gt;
			local id = frameParts.name&lt;br /&gt;
			if frameParts.mod then&lt;br /&gt;
				id = frameParts.mod .. ':' .. id&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			local alias&lt;br /&gt;
			if modAliases and modAliases[id] then&lt;br /&gt;
				alias = modAliases[id]&lt;br /&gt;
			elseif aliases and aliases[id] then&lt;br /&gt;
				alias = aliases[id]&lt;br /&gt;
            elseif aliases and id:match('^Random ') then&lt;br /&gt;
                local choices = mw.text.split(aliases['Any '..id:sub(8)], '; ', true)&lt;br /&gt;
                alias = choices[math.random(#choices)]&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			if alias then&lt;br /&gt;
				table.insert( frames, p.expandAlias( frameParts, alias ) )&lt;br /&gt;
			else&lt;br /&gt;
				table.insert( frames, frame )&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		args[1] = table.concat( frames, ';' )&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local animated = args[1]:find( ';' )&lt;br /&gt;
	local pageName = mw.title.getCurrentTitle().subpageText&lt;br /&gt;
	local class = args.class or ''&lt;br /&gt;
	local imgClass = args.imgclass or ''&lt;br /&gt;
	local style = args.style or ''&lt;br /&gt;
	local align = args.align or ''&lt;br /&gt;
	local numStyle = args.numstyle or ''&lt;br /&gt;
	local cell = {}&lt;br /&gt;
	&lt;br /&gt;
	for frame in mw.text.gsplit( args[1], '%s*;%s*' ) do&lt;br /&gt;
		if frame == '' then&lt;br /&gt;
			if animated then&lt;br /&gt;
				table.insert( cell, '&amp;lt;span class=&amp;quot;item&amp;quot;&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/span&amp;gt;' )&lt;br /&gt;
			else&lt;br /&gt;
				table.insert( cell, '&amp;lt;br&amp;gt;' )&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			local parts = p.getParts( frame, args.mod )&lt;br /&gt;
			local tooltipTitle = parts.title&lt;br /&gt;
			local mod = parts.mod&lt;br /&gt;
			local name = parts.name&lt;br /&gt;
			local num = parts.num&lt;br /&gt;
			local tooltipDesc = parts.text&lt;br /&gt;
			&lt;br /&gt;
			local img&lt;br /&gt;
			if mod then&lt;br /&gt;
				img = name .. ' (' .. mod .. ')'&lt;br /&gt;
			else&lt;br /&gt;
				img = name&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			local link = args.link or ''&lt;br /&gt;
			if link == '' then&lt;br /&gt;
				if name == pageName then&lt;br /&gt;
					link = 'none'&lt;br /&gt;
				elseif mod then&lt;br /&gt;
					link = 'Mods/' .. mod .. '/' .. name&lt;br /&gt;
				else&lt;br /&gt;
					link = name&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			local title = args.title or ''&lt;br /&gt;
			if title == '' then&lt;br /&gt;
				if tooltipTitle then&lt;br /&gt;
					title = tooltipTitle:gsub( '&amp;amp;[0-9a-fk-or]', '' )&lt;br /&gt;
				end&lt;br /&gt;
				if mw.text.trim( title ) == '' or link:lower() == 'none' or link ~= name:gsub( '%s%(.*', '' ) then&lt;br /&gt;
					title = name&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			if not tooltipTitle and title:lower() == 'none' then&lt;br /&gt;
				tooltipTitle = 0&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			local alt = img&lt;br /&gt;
			if title:lower() ~= 'none' then&lt;br /&gt;
				alt = title&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			if link:lower() == 'none' then&lt;br /&gt;
				link = ''&lt;br /&gt;
			end&lt;br /&gt;
			if title:lower() == 'none' then&lt;br /&gt;
				title = ''&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			local tooltip = ''&lt;br /&gt;
			if tooltipTitle then&lt;br /&gt;
				tooltip = ' data-minetip-title=&amp;quot;' .. tooltipTitle .. '&amp;quot;'&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			if tooltipDesc then&lt;br /&gt;
				tooltip = tooltip .. ' data-minetip-text=&amp;quot;' .. tooltipDesc .. '&amp;quot;'&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			local image = {&lt;br /&gt;
				'&amp;lt;span class=&amp;quot;item ' .. imgClass .. '&amp;quot; title=&amp;quot;' .. title .. '&amp;quot;' .. tooltip .. '&amp;gt;',&lt;br /&gt;
					'[[File:Grid ' .. img .. '.png|32x32px|link=' .. link .. '|alt=' .. alt .. ']]',&lt;br /&gt;
				'&amp;lt;/span&amp;gt;',&lt;br /&gt;
			}&lt;br /&gt;
			image[1] = image[1]:gsub( ' title=&amp;quot;&amp;quot;', '' )&lt;br /&gt;
			image[2] = image[2]:gsub( '||', '|' )&lt;br /&gt;
			&lt;br /&gt;
			if num and num &amp;gt; 1 and num &amp;lt; 1000 then&lt;br /&gt;
				if link ~= '' then&lt;br /&gt;
					num = '[[' .. link .. '|' .. num .. ']]'&lt;br /&gt;
				end&lt;br /&gt;
				if numStyle ~= '' then&lt;br /&gt;
					numStyle = ' style=&amp;quot;' .. numStyle .. '&amp;quot;'&lt;br /&gt;
				end&lt;br /&gt;
				table.insert( image, 3, '&amp;lt;span class=&amp;quot;number&amp;quot;' .. numStyle .. '&amp;gt;' .. num .. '&amp;lt;/span&amp;gt;' )&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			table.insert( cell, table.concat( image, '' ) )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if animated then&lt;br /&gt;
		cell[1] = cell[1]:gsub( 'class=&amp;quot;item', 'class=&amp;quot;item active' )&lt;br /&gt;
		class = 'animated ' .. class&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local styles = {}&lt;br /&gt;
	if align ~= '' then&lt;br /&gt;
		table.insert( styles, 'vertical-align:' .. align )&lt;br /&gt;
	end&lt;br /&gt;
	if style ~= '' then&lt;br /&gt;
		table.insert( styles, style )&lt;br /&gt;
	end&lt;br /&gt;
	if #styles &amp;gt; 0 then&lt;br /&gt;
		styles = ' style=&amp;quot;' .. table.concat( styles, ';' ) .. '&amp;quot;'&lt;br /&gt;
	else&lt;br /&gt;
		styles = ''&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local html = {&lt;br /&gt;
		'&amp;lt;span class=&amp;quot;grid ' .. class .. '&amp;quot;' .. styles .. '&amp;gt;',&lt;br /&gt;
			table.concat( cell, '' ),&lt;br /&gt;
		'&amp;lt;/span&amp;gt;'&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	if ( args.default or '' ) ~= '' then&lt;br /&gt;
		local defaultClass = ''&lt;br /&gt;
		if animated then&lt;br /&gt;
			defaultClass = ' skip'&lt;br /&gt;
		end&lt;br /&gt;
		table.insert( html, 2, '&amp;lt;span class=&amp;quot;default-item' .. defaultClass .. '&amp;quot;&amp;gt;[[File:Grid ' .. args.default .. '.png|32x32px|alt=|link=]]&amp;lt;/span&amp;gt;' )&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	html = table.concat( html, '' ):gsub( ' &amp;quot;', '&amp;quot;' )&lt;br /&gt;
	return html&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.expandAlias( frameParts, alias )&lt;br /&gt;
	-- If the frame has no parts, we can just return the alias as-is&lt;br /&gt;
	if not frameParts.title and not frameParts.mod and not frameParts.num and not frameParts.text then&lt;br /&gt;
		return alias&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local expandedFrames = {}&lt;br /&gt;
	for aliasFrame in mw.text.gsplit( alias, '%s*;%s*' ) do&lt;br /&gt;
		local aliasParts = p.getParts( aliasFrame )&lt;br /&gt;
		aliasParts.title = frameParts.title or aliasParts.title or ''&lt;br /&gt;
		aliasParts.mod = frameParts.mod or aliasParts.mod or 'Minecraft'&lt;br /&gt;
		aliasParts.num = frameParts.num or aliasParts.num or ''&lt;br /&gt;
		aliasParts.text = frameParts.text or aliasParts.text or ''&lt;br /&gt;
		&lt;br /&gt;
		table.insert( expandedFrames, string.format( '[%s]%s:%s,%s[%s]', aliasParts.title, aliasParts.mod, aliasParts.name, aliasParts.num, aliasParts.text ) )&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return table.concat( expandedFrames, ';' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getParts( frame, mod )&lt;br /&gt;
	local parts = {}&lt;br /&gt;
	parts.title = frame:match( '^%[%s*([^%]]+)%s*%]' )&lt;br /&gt;
	&lt;br /&gt;
	parts.mod = mw.text.trim( frame:match( '([^:%]]+):' ) or mod or '' )&lt;br /&gt;
	&lt;br /&gt;
	local vanilla = { v = 1, vanilla = 1, mc = 1, minecraft = 1 }&lt;br /&gt;
	if parts.mod == '' or vanilla[mw.ustring.lower( parts.mod )] then&lt;br /&gt;
		parts.mod = nil&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local nameStart = ( frame:find( ':' ) or frame:find( '%]' ) or 0 ) + 1&lt;br /&gt;
	if nameStart - 1 == #frame then&lt;br /&gt;
		nameStart = 1&lt;br /&gt;
	end&lt;br /&gt;
	parts.name = mw.text.trim( frame:sub( nameStart, ( frame:find( '[,%[]', nameStart ) or 0 ) - 1 ) )&lt;br /&gt;
	&lt;br /&gt;
	parts.num = math.floor( frame:match( ',%s*(%d+)' ) or 0 )&lt;br /&gt;
	if parts.num == 0 then&lt;br /&gt;
		parts.num = nil&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	parts.text = frame:match( '%[%s*([^%]]+)%s*%]$' )&lt;br /&gt;
	&lt;br /&gt;
	return parts&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- GUI variants; called directly to avoid the overhead of a bunch of #invoke calls per GUI&lt;br /&gt;
-- Crafting table&lt;br /&gt;
function p.craftingTable( f )&lt;br /&gt;
	local args = f&lt;br /&gt;
	if f == mw.getCurrentFrame() then&lt;br /&gt;
		args = f:getParent().args&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local arrow = 'Arrow (small)'&lt;br /&gt;
	local shapeless = ''&lt;br /&gt;
	&lt;br /&gt;
	if args.arrow or '' ~= '' then&lt;br /&gt;
		arrow = args.arrow .. ' (' .. args.Mod .. ')'&lt;br /&gt;
	end&lt;br /&gt;
	if args.shapeless or '' ~= '' then&lt;br /&gt;
		shapeless = '&amp;lt;span title=&amp;quot;This recipe is shapeless; the inputs may be placed in any arrangement in the crafting grid.&amp;quot;&amp;gt;[[File:Grid layout Shapeless.png|link=]]&amp;lt;/span&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local html = {&lt;br /&gt;
		'{| class=&amp;quot;grid-Crafting_Table&amp;quot; cellpadding=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot;',&lt;br /&gt;
		'| ' .. p.cell{ args.A1, mod = args.Mod, link = args.A1link, title = args.A1title },&lt;br /&gt;
		'| ' .. p.cell{ args.B1, mod = args.Mod, link = args.B1link, title = args.B1title },&lt;br /&gt;
		'| ' .. p.cell{ args.C1, mod = args.Mod, link = args.C1link, title = args.C1title },&lt;br /&gt;
		'| rowspan=&amp;quot;2&amp;quot; class=&amp;quot;arrow&amp;quot; | [[File:Grid layout ' .. arrow .. '.png|link=]]',&lt;br /&gt;
		'| rowspan=&amp;quot;3&amp;quot; | ' .. p.cell{ args.Output, mod = args.Mod, link = args.Olink, title = args.Otitle, class = 'output' },&lt;br /&gt;
		'|-',&lt;br /&gt;
		'| ' .. p.cell{ args.A2, mod = args.Mod, link = args.A2link, title = args.A2title },&lt;br /&gt;
		'| ' .. p.cell{ args.B2, mod = args.Mod, link = args.B2link, title = args.B2title },&lt;br /&gt;
		'| ' .. p.cell{ args.C2, mod = args.Mod, link = args.C2link, title = args.C2title },&lt;br /&gt;
		'|-',&lt;br /&gt;
		'| ' .. p.cell{ args.A3, mod = args.Mod, link = args.A3link, title = args.A3title },&lt;br /&gt;
		'| ' .. p.cell{ args.B3, mod = args.Mod, link = args.B3link, title = args.B3title },&lt;br /&gt;
		'| ' .. p.cell{ args.C3, mod = args.Mod, link = args.C3link, title = args.C3title },&lt;br /&gt;
		'| class=&amp;quot;shapeless&amp;quot; | ' .. shapeless,&lt;br /&gt;
		'|}'&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	return table.concat( html, '\n' );&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Furnace&lt;br /&gt;
function p.furnace( f )&lt;br /&gt;
	local args = f&lt;br /&gt;
	if f == mw.getCurrentFrame() then&lt;br /&gt;
		args = f:getParent().args&lt;br /&gt;
	end&lt;br /&gt;
	args = require( 'Module:ProcessArgs' ).norm( args )&lt;br /&gt;
	&lt;br /&gt;
	local progress = 'Furnace Progress'&lt;br /&gt;
	local burning = ' (in-active)'&lt;br /&gt;
	local smelting = burning&lt;br /&gt;
	local fuelUsage = 'Fire'&lt;br /&gt;
	&lt;br /&gt;
	if args.Progress then&lt;br /&gt;
		progress = args.Progress .. ' Progress'&lt;br /&gt;
		if args.Mod then&lt;br /&gt;
			progress = progress .. ' (' .. args.Mod .. ')'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args.Input and args.Fuel then&lt;br /&gt;
		burning = ''&lt;br /&gt;
		if args.Output then&lt;br /&gt;
			smelting = ''&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if args.FuelUsage then&lt;br /&gt;
		fuelUsage = args.FuelUsage&lt;br /&gt;
		if args.Mod then&lt;br /&gt;
			fuelUsage = fuelUsage .. ' (' .. args.Mod .. ')'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local html = {&lt;br /&gt;
		'{| class=&amp;quot;grid-Furnace&amp;quot; cellpadding=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot;',&lt;br /&gt;
		'| ' .. p.cell{ args.Input, mod = args.Mod, link = args.Ilink, title = args.Ititle },&lt;br /&gt;
		'| rowspan=&amp;quot;3&amp;quot; class=&amp;quot;arrow&amp;quot; | [[File:Grid layout ' .. progress .. smelting .. '.png|link=]]',&lt;br /&gt;
		'| rowspan=&amp;quot;3&amp;quot; class=&amp;quot;output&amp;quot; | ' .. p.cell{ args.Output, mod = args.Mod, link = args.Olink, title = args.Otitle, class = 'output' },&lt;br /&gt;
		'|-',&lt;br /&gt;
		'| [[File:Grid layout ' .. fuelUsage .. burning .. '.png|link=]]',&lt;br /&gt;
		'|-',&lt;br /&gt;
		'| ' .. p.cell{ args.Fuel, mod = args.Mod, link = args.Flink, title = args.Ftitle },&lt;br /&gt;
		'|}'&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	return table.concat( html, '\n' );&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Brewing Stand&lt;br /&gt;
function p.brewingStand( f )&lt;br /&gt;
	local args = f&lt;br /&gt;
	if f == mw.getCurrentFrame() then&lt;br /&gt;
		args = f:getParent().args&lt;br /&gt;
	end&lt;br /&gt;
	args = require( 'Module:ProcessArgs' ).norm( args )&lt;br /&gt;
	&lt;br /&gt;
	local inactive = ' (In-active)'&lt;br /&gt;
	if args.Input and ( args.Output1 or args.Output2 or args.Output3 ) then&lt;br /&gt;
		inactive = ''&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local html = {&lt;br /&gt;
		'&amp;lt;div class=&amp;quot;grid-Brewing_Stand&amp;quot;&amp;gt;',&lt;br /&gt;
			'{| cellpadding=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot;',&lt;br /&gt;
			'| class=&amp;quot;bubbles&amp;quot; | [[File:Grid layout Brewing Bubbles.gif|link=]]',&lt;br /&gt;
			'| class=&amp;quot;input&amp;quot; | ' .. p.cell{ args.Input, mod = args.Mod, link = args.Ilink, title = args.Ititle },&lt;br /&gt;
			'| [[File:Grid layout Brewing Arrow' .. inactive .. '.png|link=]]',&lt;br /&gt;
			'|-',&lt;br /&gt;
			'| class=&amp;quot;output1&amp;quot; | ' .. p.cell{ args.Output1, mod = args.Mod, link = args.O1link, title = args.O1title, default = 'layout Brewing Empty' },&lt;br /&gt;
			'| class=&amp;quot;output2&amp;quot; | ' .. p.cell{ args.Output2, mod = args.Mod, link = args.O2link, title = args.O2title, default = 'layout Brewing Empty' },&lt;br /&gt;
			'| class=&amp;quot;output3&amp;quot; | ' .. p.cell{ args.Output3, mod = args.Mod, link = args.O3link, title = args.O3title, default = 'layout Brewing Empty' },&lt;br /&gt;
			'|-',&lt;br /&gt;
			'| class=&amp;quot;paths&amp;quot; colspan=&amp;quot;3&amp;quot; | [[File:Grid layout Brewing Paths.png|link=]]',&lt;br /&gt;
			'|}',&lt;br /&gt;
		'&amp;lt;/div&amp;gt;'&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	return table.concat( html, '\n' );&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Celestek</name></author>	</entry>

	</feed>