<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=Datageneration%2F1.18</id>
	<title>Datageneration/1.18 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=Datageneration%2F1.18"/>
	<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Datageneration/1.18&amp;action=history"/>
	<updated>2026-05-01T19:04:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Datageneration/1.18&amp;diff=3167&amp;oldid=prev</id>
		<title>ShrimpBot: Copy Datageneration to MC1.18 archive</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Datageneration/1.18&amp;diff=3167&amp;oldid=prev"/>
		<updated>2022-06-10T07:44:05Z</updated>

		<summary type="html">&lt;p&gt;Copy &lt;a href=&quot;/wiki/Datageneration&quot; title=&quot;Datageneration&quot;&gt;Datageneration&lt;/a&gt; to MC1.18 archive&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''Data generation''' (AKA '''datagen''') is a builtin system in Minecraft and Forge that allows mod developers to write code to programmatically generate the [[Using Resources/1.18|assets and data]] files of mods. &lt;br /&gt;
&lt;br /&gt;
Using datageneration offers some notable benefits:&lt;br /&gt;
* Asset and data files can be automatically generated by code without needing to manually type them out, saving effort and time.&lt;br /&gt;
* The structure of the datagenerated files may be changed without affecting the code which generates them, allowing for files to be cleanly regenerated when the format is changed.&lt;br /&gt;
* Mod developers can mix and match datagenerated resources with pre-existing or manually-made resources.&lt;br /&gt;
* Similar and repeated assets and data files can be programmatically generated for any number of objects, with the least amount of effort needed to define in code.&lt;br /&gt;
&lt;br /&gt;
The data generation system is loaded by the main class &amp;lt;code&amp;gt;net.minecraft.data.Main&amp;lt;/code&amp;gt;. Different command-line arguments can be passed to customize which mods’ data are gathered, what existing files are considered, etc. The class responsible for managing and orchestrating data generation is &amp;lt;code&amp;gt;net.minecraft.data.DataGenerator&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The default configurations in the MDK &amp;lt;code&amp;gt;build.gradle&amp;lt;/code&amp;gt; adds the &amp;lt;code&amp;gt;runData&amp;lt;/code&amp;gt; task for running the data generators.&lt;br /&gt;
&lt;br /&gt;
== Generator Modes ==&lt;br /&gt;
The data generator can be configured to run 4 different data generations, which are configured from the command-line parameters, and can be checked from &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;GatherDataEvent#include()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; methods.&lt;br /&gt;
* '''Client Assets'''&lt;br /&gt;
** Generates client-only files in &amp;lt;tt&amp;gt;assets&amp;lt;/tt&amp;gt;: [[Introduction to Models/1.18|block/item models]], [[BlockState JSONs/1.18|blockstate JSONs]], [[Datageneration/I18n/1.18|language files]], etc.&lt;br /&gt;
** &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--client&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;includeClient()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* '''Server Data'''&lt;br /&gt;
** Generates server-only files in &amp;lt;tt&amp;gt;data&amp;lt;/tt&amp;gt;: [[Datageneration/Recipes/1.18|recipes]], advancements, [[Datageneration/Tags/1.18|tags]], etc.&lt;br /&gt;
** &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--server&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;includeServer()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* '''Development Tools'''&lt;br /&gt;
** Runs some development tools: converting SNBT to NBT and vice-versa, etc.&lt;br /&gt;
** &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--dev&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;includeDev()&amp;lt;/code&amp;gt;&lt;br /&gt;
* '''Reports'''&lt;br /&gt;
** Dumps all registered blocks, items, commands, etc.&lt;br /&gt;
** &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--reports&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;includeReports()&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Providers ==&lt;br /&gt;
'''Data providers''' are the classes that define the resources data to be generated. All data providers implement &amp;lt;code&amp;gt;DataProvider&amp;lt;/code&amp;gt;. Minecraft has abstract implementations for most assets and data, so mod developers only need to extend those abstract classes and override the specified method.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;GatherDataEvent&amp;lt;/code&amp;gt; is fired on the mod event bus when the data generator is being created, and the &amp;lt;code&amp;gt;DataGenerator&amp;lt;/code&amp;gt; can be obtained from the event. Create and register data providers using &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;DataGenerator#addProvider&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Client Assets ===&lt;br /&gt;
* &amp;lt;code&amp;gt;net.minecraftforge.common.data.LanguageProvider&amp;lt;/code&amp;gt; - for language strings; override &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;#addTranslations&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ModelProvider&amp;lt;?&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; -  base class for all model providers&lt;br /&gt;
** ''These classes are under the &amp;lt;code&amp;gt;net.minecraftforge.client.model.generators&amp;lt;/code&amp;gt; package''&lt;br /&gt;
*** &amp;lt;code&amp;gt;ItemModelProvider&amp;lt;/code&amp;gt; - for item models; override &amp;lt;code&amp;gt;#registerModels&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;BlockStateProvider&amp;lt;/code&amp;gt; - for blockstates and their block and item models; override &amp;lt;code&amp;gt;#registerStatesAndModels&amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;BlockModelProvider&amp;lt;/code&amp;gt; -  for block models; override &amp;lt;code&amp;gt;#registerModels&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;SoundDefinitionsProvider&amp;lt;/code&amp;gt; - for the &amp;lt;code&amp;gt;sounds.json&amp;lt;/code&amp;gt; file; override &amp;lt;code&amp;gt;#registerSounds&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Data ===&lt;br /&gt;
* ''These classes are under the &amp;lt;code&amp;gt;net.minecraft.data&amp;lt;/code&amp;gt; package''&lt;br /&gt;
* &amp;lt;code&amp;gt;LootTableProvider&amp;lt;/code&amp;gt; - for loot tables; override &amp;lt;code&amp;gt;#getTables&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;RecipeProvider&amp;lt;/code&amp;gt; - for recipes and their unlocking advancements; override &amp;lt;code&amp;gt;#buildCraftingRecipes&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;TagsProvider&amp;lt;/code&amp;gt; - for tags; override &amp;lt;code&amp;gt;#addTags&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GlobalLootModifierProvider&amp;lt;/code&amp;gt; - for global loot modifiers; override &amp;lt;code&amp;gt;#start&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;AdvancementProvider&amp;lt;/code&amp;gt; - for advancements; override &amp;lt;code&amp;gt;#registerAdvancements&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Data Generation/1.18|Category:Data Generation]]&lt;/div&gt;</summary>
		<author><name>ShrimpBot</name></author>
	</entry>
</feed>