<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.earthmc.net/index.php?action=history&amp;feed=atom&amp;title=Module%3AUI%2FCore</id>
	<title>Module:UI/Core - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.earthmc.net/index.php?action=history&amp;feed=atom&amp;title=Module%3AUI%2FCore"/>
	<link rel="alternate" type="text/html" href="https://wiki.earthmc.net/index.php?title=Module:UI/Core&amp;action=history"/>
	<updated>2026-10-27T19:07:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://wiki.earthmc.net/index.php?title=Module:UI/Core&amp;diff=234631&amp;oldid=prev</id>
		<title>515797455988850689: 515797455988850689 moved page Module:UI/core to Module:UI/Core without leaving a redirect</title>
		<link rel="alternate" type="text/html" href="https://wiki.earthmc.net/index.php?title=Module:UI/Core&amp;diff=234631&amp;oldid=prev"/>
		<updated>2023-11-25T08:26:56Z</updated>

		<summary type="html">&lt;p&gt;515797455988850689 moved page &lt;a href=&quot;/index.php?title=Module:UI/core&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Module:UI/core (page does not exist)&quot;&gt;Module:UI/core&lt;/a&gt; to &lt;a href=&quot;/wiki/Module:UI/Core&quot; title=&quot;Module:UI/Core&quot;&gt;Module:UI/Core&lt;/a&gt; without leaving a redirect&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:26, 25 November 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key mediawiki:diff:1.41:old-234630:rev-234631 --&gt;
&lt;/table&gt;</summary>
		<author><name>515797455988850689</name></author>
	</entry>
	<entry>
		<id>https://wiki.earthmc.net/index.php?title=Module:UI/Core&amp;diff=234630&amp;oldid=prev</id>
		<title>515797455988850689: Created page with &quot;local loader = require(&#039;Module:Loader&#039;)  local makeClass, yesno, inventorySlot, random = 	loader.require(&#039;Class&#039;, &#039;Yesno&#039;, &#039;Inventory slot&#039;, &#039;Random&#039;) local colorData = loader.loadData(&#039;Color/Data&#039;) local slot = inventorySlot.slot  local fillmode = function(s) 	if s == &#039;border&#039; then -- all valid fill modes here 		return s 	else 		return yesno(s, true) 	end end local backslashSubstitute = function(s) 	-- substitute every &#039;\&lt;char&gt;&#039; but those that have special meaning for t...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.earthmc.net/index.php?title=Module:UI/Core&amp;diff=234630&amp;oldid=prev"/>
		<updated>2023-11-25T08:26:35Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local loader = require(&amp;#039;Module:Loader&amp;#039;)  local makeClass, yesno, inventorySlot, random = 	loader.require(&amp;#039;Class&amp;#039;, &amp;#039;Yesno&amp;#039;, &amp;#039;Inventory slot&amp;#039;, &amp;#039;Random&amp;#039;) local colorData = loader.loadData(&amp;#039;Color/Data&amp;#039;) local slot = inventorySlot.slot  local fillmode = function(s) 	if s == &amp;#039;border&amp;#039; then -- all valid fill modes here 		return s 	else 		return yesno(s, true) 	end end local backslashSubstitute = function(s) 	-- substitute every &amp;#039;\&amp;lt;char&amp;gt;&amp;#039; but those that have special meaning for t...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local loader = require(&amp;#039;Module:Loader&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local makeClass, yesno, inventorySlot, random =&lt;br /&gt;
	loader.require(&amp;#039;Class&amp;#039;, &amp;#039;Yesno&amp;#039;, &amp;#039;Inventory slot&amp;#039;, &amp;#039;Random&amp;#039;)&lt;br /&gt;
local colorData = loader.loadData(&amp;#039;Color/Data&amp;#039;)&lt;br /&gt;
local slot = inventorySlot.slot&lt;br /&gt;
&lt;br /&gt;
local fillmode = function(s)&lt;br /&gt;
	if s == &amp;#039;border&amp;#039; then -- all valid fill modes here&lt;br /&gt;
		return s&lt;br /&gt;
	else&lt;br /&gt;
		return yesno(s, true)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
local backslashSubstitute = function(s)&lt;br /&gt;
	-- substitute every &amp;#039;\&amp;lt;char&amp;gt;&amp;#039; but those that have special meaning for tooltips generation, e.g. &amp;#039;\&amp;amp;&amp;#039;&lt;br /&gt;
	s = s:gsub(&amp;#039;\\\\&amp;#039;, &amp;#039;\254&amp;#039;):gsub(&amp;#039;\\([^&amp;amp;/])&amp;#039;, &amp;#039;%1&amp;#039;):gsub(&amp;#039;\254&amp;#039;, &amp;#039;\\\\&amp;#039;)&lt;br /&gt;
	return s&lt;br /&gt;
end&lt;br /&gt;
local backslashSubstituteStrict = function (s)&lt;br /&gt;
	-- substitute all &amp;#039;\&amp;lt;char&amp;gt;&amp;#039;&lt;br /&gt;
	s = s:gsub(&amp;#039;\\\\&amp;#039;, &amp;#039;\254&amp;#039;):gsub(&amp;#039;\\(.)&amp;#039;, &amp;#039;%1&amp;#039;):gsub(&amp;#039;\254&amp;#039;, &amp;#039;\\\\&amp;#039;)&lt;br /&gt;
	return s&lt;br /&gt;
end&lt;br /&gt;
local makeGotoClass = function (id)&lt;br /&gt;
	return (id and id ~= &amp;#039;none&amp;#039;) and &amp;#039;goto-&amp;#039; .. id:gsub(&amp;#039;^goto%-&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
---------------------------------------------------------------------------------&lt;br /&gt;
-- Main Interface Class&lt;br /&gt;
---------------------------------------------------------------------------------&lt;br /&gt;
local Interface = makeClass(&amp;#039;Interface&amp;#039;, {&lt;br /&gt;
	aprilFools = false,&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	-- constructor(topText: string, id?: string, goBack?: table, hide?: boolean, fill?: boolean, rows?: number, cols?: number)&lt;br /&gt;
	-- &lt;br /&gt;
	-- Constructor function for the methods provided. Creates the actual UI.&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	constructor = function (self, ...)&lt;br /&gt;
		local topText, id, goBack, hide, fill, rows, cols, noarrow, noclose, arrow_, close_, inline&lt;br /&gt;
		if type(({...})[1]) == &amp;#039;table&amp;#039; then&lt;br /&gt;
			local u = ({...})[1]&lt;br /&gt;
			topText, id, goBack, hide, fill, rows, cols, noarrow, noclose, arrow_, close_, inline =&lt;br /&gt;
				u.topText or u[1],&lt;br /&gt;
				u.id,&lt;br /&gt;
				type(u.goBack) == &amp;#039;table&amp;#039; and u.goBack or {&lt;br /&gt;
					text = u.return_text or u.goback_text or u[&amp;#039;return&amp;#039;] or u.goback,&lt;br /&gt;
					link = u.return_link or u.goback_link,&lt;br /&gt;
					id = u.return_id or u.goback_id,&lt;br /&gt;
				},&lt;br /&gt;
				u.hide,&lt;br /&gt;
				u.fill,&lt;br /&gt;
				u.rows,&lt;br /&gt;
				u.cols,&lt;br /&gt;
				u.noarrow,&lt;br /&gt;
				u.noclose,&lt;br /&gt;
				u.arrow or u.arrow_,&lt;br /&gt;
				u.close or u.close_,&lt;br /&gt;
				u.inline&lt;br /&gt;
		else&lt;br /&gt;
			topText, id, goBack, hide, fill, rows, cols, noarrow, noclose, arrow_, close_, inline = ...&lt;br /&gt;
		end&lt;br /&gt;
		goBack = goBack or {}&lt;br /&gt;
		rows, cols = tonumber(rows) or 6, tonumber(cols) or 9&lt;br /&gt;
		fill, noarrow, noclose, inline = fillmode(fill), yesno(noarrow, false), yesno(noclose, false), yesno(inline, false)&lt;br /&gt;
		local arrowX, arrowY, closeX, closeY&lt;br /&gt;
		self.randomColor = colorData.MCColors[random.number{16}] -- for april fools only&lt;br /&gt;
		self.hide = yesno(hide)&lt;br /&gt;
		self.id = id&lt;br /&gt;
		self.slots = {}&lt;br /&gt;
		self.custom = {}&lt;br /&gt;
		self.html = mw.html.create(&amp;#039;div&amp;#039;)&lt;br /&gt;
			:attr{ class=&amp;#039;mcui mcui-Chest pixel-image&amp;#039; .. (inline and &amp;#039;&amp;#039; or &amp;#039; mcui-centered&amp;#039;) }&lt;br /&gt;
		if topText then&lt;br /&gt;
			self.html:tag(&amp;#039;div&amp;#039;):attr{ class = &amp;#039;mcui-header&amp;#039; }&lt;br /&gt;
				:wikitext(backslashSubstituteStrict(topText))&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if arrow_ then&lt;br /&gt;
			if arrow_:match(&amp;#039;^%d+%s*,%s*%d+$&amp;#039;) then&lt;br /&gt;
				arrowX, arrowY = arrow_:match(&amp;#039;^(%d+)%s*,%s*(%d+)$&amp;#039;)&lt;br /&gt;
			elseif not yesno(arrow_) or arrow_:match(&amp;#039;[Nn]one&amp;#039;) then&lt;br /&gt;
				noarrow = true&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		arrowX = tonumber(arrowX) or rows&lt;br /&gt;
		arrowY = tonumber(arrowY) or 4&lt;br /&gt;
		&lt;br /&gt;
		if close_ then&lt;br /&gt;
			if close_:match(&amp;#039;^%d+%s*,%s*%d+$&amp;#039;) then&lt;br /&gt;
				closeX, closeY = close_:match(&amp;#039;^(%d+)%s*,%s*(%d+)$&amp;#039;)&lt;br /&gt;
			elseif not yesno(close_) or close_:match(&amp;#039;[Nn]one&amp;#039;) then&lt;br /&gt;
				noclose = true&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		closeX = tonumber(closeX) or rows&lt;br /&gt;
		closeY = tonumber(closeY) or 5&lt;br /&gt;
		&lt;br /&gt;
		for x = 1, rows, 1 do&lt;br /&gt;
			self.slots[x] = {}&lt;br /&gt;
			self.custom[x] = {}&lt;br /&gt;
			for y = 1, cols, 1 do&lt;br /&gt;
				if not noarrow and x == arrowX and y == arrowY then&lt;br /&gt;
					self:setSlot(x, y, {&lt;br /&gt;
						&amp;#039;Go Back&amp;#039;,&lt;br /&gt;
						text = goBack.text and &amp;#039;&amp;amp;7&amp;#039; .. goBack.text or &amp;#039;none&amp;#039;,&lt;br /&gt;
						link = goBack.link or &amp;#039;none&amp;#039;,&lt;br /&gt;
						title = &amp;#039;&amp;amp;aGo Back&amp;#039;,&lt;br /&gt;
						class = makeGotoClass(goBack.id),&lt;br /&gt;
					})&lt;br /&gt;
				elseif not noclose and x == closeX and y == closeY then&lt;br /&gt;
					self:setSlot(x, y, { &amp;#039;Close&amp;#039; })&lt;br /&gt;
				else&lt;br /&gt;
					if fill == &amp;#039;border&amp;#039; then&lt;br /&gt;
						if x == 1 or x == rows or y == 1 or y == cols then&lt;br /&gt;
							self:setBlankSlot(x, y)&lt;br /&gt;
						else&lt;br /&gt;
							self:setEmptySlot(x, y)&lt;br /&gt;
						end&lt;br /&gt;
					elseif not fill then&lt;br /&gt;
						self:setEmptySlot(x, y)&lt;br /&gt;
					else&lt;br /&gt;
						self:setBlankSlot(x, y)&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end,&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	-- setSlot(x: number, y: number, args: table, isCustom?: boolean)&lt;br /&gt;
	-- &lt;br /&gt;
	-- Sets a slot according to the `x` and `y` parameters provided, with the arguments&lt;br /&gt;
	-- to the parser as `args`.&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	setSlot = function (self, x, y, args, isCustom)&lt;br /&gt;
		checkType(1, x, &amp;#039;number&amp;#039;)&lt;br /&gt;
		checkType(2, y, &amp;#039;number&amp;#039;)&lt;br /&gt;
		checkType(3, args, { &amp;#039;table&amp;#039;, &amp;#039;string&amp;#039; })&lt;br /&gt;
		&lt;br /&gt;
		local tp = type(args)&lt;br /&gt;
		&lt;br /&gt;
		if tp == &amp;#039;table&amp;#039; or (tp == &amp;#039;string&amp;#039; and args:match(&amp;#039;&amp;lt;.-&amp;gt;.-&amp;lt;/.-&amp;gt;&amp;#039;)) then&lt;br /&gt;
			self.slots[x] = self.slots[x] or {}&lt;br /&gt;
			self.custom[x] = self.custom[x] or {}&lt;br /&gt;
			self.slots[x][y] = args&lt;br /&gt;
			self.custom[x][y] = not not isCustom&lt;br /&gt;
		elseif tp == &amp;#039;string&amp;#039; then&lt;br /&gt;
			assertTrue(self.slots[x] and self.slots[x][y], &amp;#039;slot in posistion (%d, %d) does not exist&amp;#039;, 2, x, y)[args] = isCustom&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		return self&lt;br /&gt;
	end,&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	-- getSlot(x: number, y: number, prop?: string)&lt;br /&gt;
	-- &lt;br /&gt;
	-- Gets a slot according to the `x` and `y` parameters provided, with an option parameter&lt;br /&gt;
	-- of `prop` to get a particular slot property.&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	getSlot = function (self, x, y, prop)&lt;br /&gt;
		if prop then&lt;br /&gt;
			return assertTrue(self.slots[x] and self.slots[x][y], &amp;#039;slot in posistion (%d, %d) does not exist&amp;#039;, 2, x, y)[prop]&lt;br /&gt;
		else&lt;br /&gt;
			return self.slots[x][y]&lt;br /&gt;
		end&lt;br /&gt;
	end,&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	-- hasSlot(x: number, y: number)&lt;br /&gt;
	-- &lt;br /&gt;
	-- Checks if the UI has a specific slot based on `x` and `y`.&lt;br /&gt;
	-- NOTICE: THIS IS CURRENTLY UNUSABLE&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	hasSlot = function (self, x, y)&lt;br /&gt;
		return not not self.slots[x][y]&lt;br /&gt;
	end,&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	-- isEmptySlot(x: number, y: number)&lt;br /&gt;
	-- &lt;br /&gt;
	-- Checks if a slot based on `x` and `y` is not blank.&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	isEmptySlot = function (self, x, y)&lt;br /&gt;
		return self.slots[x][y][1] == &amp;#039;&amp;#039; or self.slots[x][y][1] == &amp;#039;Blank&amp;#039;&lt;br /&gt;
	end,&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	-- setBlankSlot(x: number, y: number)&lt;br /&gt;
	-- &lt;br /&gt;
	-- Sets a blank slot according to the `x` and `y` parameters provided.&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	setBlankSlot = function (self, x, y)&lt;br /&gt;
		if self.aprilFools then&lt;br /&gt;
			return self:setSlot(x, y, { (&amp;#039;Blank (%s)&amp;#039;):format(self.randomColor) })&lt;br /&gt;
		end&lt;br /&gt;
		return self:setSlot(x, y, { &amp;#039;Blank&amp;#039; })&lt;br /&gt;
	end,&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	-- setEmptySlot(x: number, y: number)&lt;br /&gt;
	-- &lt;br /&gt;
	-- Sets a empty slot according to the `x` and `y` parameters provided.&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	setEmptySlot = function (self, x, y)&lt;br /&gt;
		return self:setSlot(x, y, { &amp;#039;&amp;#039; })&lt;br /&gt;
	end,&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	-- __tostring()&lt;br /&gt;
	-- &lt;br /&gt;
	-- __tostring metamethod for the class. Parses the `slots` to an acual string.&lt;br /&gt;
	---------------------------------------------------------------------------------&lt;br /&gt;
	__tostring = function (self)&lt;br /&gt;
		for x, xValue in ipairs(self.slots) do&lt;br /&gt;
			local row = self.html:tag(&amp;#039;div&amp;#039;):addClass(&amp;#039;mcui-row&amp;#039;)&lt;br /&gt;
			for y, yValue in ipairs(xValue) do&lt;br /&gt;
				row:wikitext(backslashSubstitute(self.custom[x][y] and yValue or slot(yValue)))&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		return self.id&lt;br /&gt;
			and tostring(mw.html.create(&amp;#039;div&amp;#039;)&lt;br /&gt;
				:node(self.html)&lt;br /&gt;
				:attr{ &lt;br /&gt;
					id = self.id and &amp;#039;ui-&amp;#039; .. self.id:gsub(&amp;#039;^ui%-&amp;#039;, &amp;#039;&amp;#039;), &lt;br /&gt;
					class = self.id and &amp;#039;sbw-ui-tab-content&amp;#039;, &lt;br /&gt;
					style = self.hide and &amp;#039;display: none;&amp;#039; or nil,&lt;br /&gt;
				} &lt;br /&gt;
			:done())&lt;br /&gt;
			or tostring(self.html)&lt;br /&gt;
	end,&lt;br /&gt;
	static = {&lt;br /&gt;
		makeGotoClass = makeGotoClass&lt;br /&gt;
	},&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
return Interface&lt;/div&gt;</summary>
		<author><name>515797455988850689</name></author>
	</entry>
</feed>