<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.joban.org/w/index.php?action=history&amp;feed=atom&amp;title=JCM%3AScripting%2FResource_Loading</id>
	<title>JCM:Scripting/Resource Loading - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.joban.org/w/index.php?action=history&amp;feed=atom&amp;title=JCM%3AScripting%2FResource_Loading"/>
	<link rel="alternate" type="text/html" href="https://www.joban.org/w/index.php?title=JCM:Scripting/Resource_Loading&amp;action=history"/>
	<updated>2026-05-03T13:58:14Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://www.joban.org/w/index.php?title=JCM:Scripting/Resource_Loading&amp;diff=3282&amp;oldid=prev</id>
		<title>AmberFrost: LX86 moved page JCM:Scripting:Documentation:Resource Loading to JCM:Scripting/Resource Loading</title>
		<link rel="alternate" type="text/html" href="https://www.joban.org/w/index.php?title=JCM:Scripting/Resource_Loading&amp;diff=3282&amp;oldid=prev"/>
		<updated>2025-02-23T15:28:51Z</updated>

		<summary type="html">&lt;p&gt;LX86 moved page &lt;a href=&quot;/wiki/JCM:Scripting:Documentation:Resource_Loading&quot; class=&quot;mw-redirect&quot; title=&quot;JCM:Scripting:Documentation:Resource Loading&quot;&gt;JCM:Scripting:Documentation:Resource Loading&lt;/a&gt; to &lt;a href=&quot;/wiki/JCM:Scripting/Resource_Loading&quot; title=&quot;JCM:Scripting/Resource Loading&quot;&gt;JCM:Scripting/Resource Loading&lt;/a&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:28, 23 February 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&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;/table&gt;</summary>
		<author><name>AmberFrost</name></author>
	</entry>
	<entry>
		<id>https://www.joban.org/w/index.php?title=JCM:Scripting/Resource_Loading&amp;diff=3229&amp;oldid=prev</id>
		<title>AmberFrost at 06:13, 6 February 2025</title>
		<link rel="alternate" type="text/html" href="https://www.joban.org/w/index.php?title=JCM:Scripting/Resource_Loading&amp;diff=3229&amp;oldid=prev"/>
		<updated>2025-02-06T06:13:53Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&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 14:13, 6 February 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l20&quot;&gt;Line 20:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 20:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Model Loading ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Model Loading ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''Model loading &lt;/del&gt;is not &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;implemented &lt;/del&gt;in &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;JCM for now&lt;/del&gt;.&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Please note that the current API &lt;/ins&gt;is &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;somewhat simplistic and does &lt;/ins&gt;not &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;offer fine-grained control like &lt;/ins&gt;in &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;MTR 3/NTE&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{| class=&amp;quot;wikitable&amp;quot;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;!Functions&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;!Description&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|&amp;lt;code&amp;gt;static ModelManager.loadModel(id: Identifier, flipV: boolean): ScriptedModel&amp;lt;/code&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|Load an OBJ/bbmodel model from a path and upload to the GPU.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Set flipV to true if your texture is rendered incorrectly.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Loading AWT Resources ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Loading AWT Resources ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AmberFrost</name></author>
	</entry>
	<entry>
		<id>https://www.joban.org/w/index.php?title=JCM:Scripting/Resource_Loading&amp;diff=3075&amp;oldid=prev</id>
		<title>AmberFrost: Created page with &quot;= Resource Loading = NTE/JCM provides several methods for controlling the loading and retrieval of resources within resource packs in JavaScript scripts.  Code written in the top-level space outside of functions will be executed when a resource pack is loaded and can be used to initialize resources such as models, textures, etc. Resources that should not be different for each train (such as models and such) are recommended to be stored in global variables to avoid excess...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.joban.org/w/index.php?title=JCM:Scripting/Resource_Loading&amp;diff=3075&amp;oldid=prev"/>
		<updated>2024-11-05T11:45:29Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Resource Loading = NTE/JCM provides several methods for controlling the loading and retrieval of resources within resource packs in JavaScript scripts.  Code written in the top-level space outside of functions will be executed when a resource pack is loaded and can be used to initialize resources such as models, textures, etc. Resources that should not be different for each train (such as models and such) are recommended to be stored in global variables to avoid excess...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Resource Loading =&lt;br /&gt;
NTE/JCM provides several methods for controlling the loading and retrieval of resources within resource packs in JavaScript scripts.&lt;br /&gt;
&lt;br /&gt;
Code written in the top-level space outside of functions will be executed when a resource pack is loaded and can be used to initialize resources such as models, textures, etc. Resources that should not be different for each train (such as models and such) are recommended to be stored in global variables to avoid excessive memory usage when loading a copy of the same content for each train.&lt;br /&gt;
&lt;br /&gt;
== Identifier (ResourceLocation) ==&lt;br /&gt;
Minecraft uses a Identifier to identify files in a resource pack. Many but not all functions only accept &amp;lt;code&amp;gt;Identifier&amp;lt;/code&amp;gt; paths rather than strings. To create a &amp;lt;code&amp;gt;Identifier&amp;lt;/code&amp;gt;, you can use the following functions:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Functions&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;static Resources.id(idStr: string): Identifier&amp;lt;/code&amp;gt;&lt;br /&gt;
|Converts the string to the appropriate Identifier&lt;br /&gt;
e.g. &amp;lt;code&amp;gt;Resources.id(“mtr:path/absolute.js”)&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;static Resources.idr(relPath: string): Identifier&amp;lt;/code&amp;gt;&lt;br /&gt;
|Converts the string to Identifier relative to the directory that the currently executed script are located in&lt;br /&gt;
e.g. &amp;lt;code&amp;gt;Resources.idr(“relative.js”)&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Model Loading ==&lt;br /&gt;
'''Model loading is not implemented in JCM for now.'''&lt;br /&gt;
&lt;br /&gt;
== Loading AWT Resources ==&lt;br /&gt;
These functions load the resources used to draw dynamic textures via the Java AWT.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Functions&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;static Resources.getSystemFont(name: string): Font&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get a system or MTR built-in font.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Font Name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Noto Serif&lt;br /&gt;
|MTR's built-in serif font (similar to Song). Identical on all systems.&lt;br /&gt;
|-&lt;br /&gt;
|Noto Sans&lt;br /&gt;
|NTE Built-in sans serif font (similar to Helvetica). Identical on all systems. '''[Not available in JCM for now]'''&lt;br /&gt;
|-&lt;br /&gt;
|Serif&lt;br /&gt;
|A serif font selected by AWT that is installed on this computer. May be different on different devices.&lt;br /&gt;
|-&lt;br /&gt;
|SansSerif&lt;br /&gt;
|A sans serif font selected by AWT that is installed on this computer. May be different on different devices.&lt;br /&gt;
|-&lt;br /&gt;
|Monospaced&lt;br /&gt;
|A monospaced font selected by AWT that is installed on this computer. May be different on different devices.&lt;br /&gt;
|}&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;static Resources.readFont(path: Identifier): Font&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Load a custom TTF or OTF font file as an AWT Font.&lt;br /&gt;
* ''Note: Due to the way Java and Minecraft Resource Pack works, new temporary font files are generated on your disk every time you call this function. If you find yourself running out of disk space during the development, you can free up disk space by deleting files starting with &amp;lt;code&amp;gt;+~JF&amp;lt;/code&amp;gt; on your system temp directory, or restart your Minecraft/Computer.''&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;static Resources.readBufferedImage(path: Identifier): BufferedImage&amp;lt;/code&amp;gt;&lt;br /&gt;
|Loads an image file as an AWT BufferedImage.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;static Resources.getFontRenderContext(): FontRenderContext&amp;lt;/code&amp;gt;&lt;br /&gt;
|Get an AWT FontRenderContext.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Reading resource files ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Functions&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;static Resources.readString(location: Identifier): string?&amp;lt;/code&amp;gt;&lt;br /&gt;
|Reads the contents of a resource file as a string. Returns null if reading fails.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AmberFrost</name></author>
	</entry>
</feed>