<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://forge.gemwire.uk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Unbekannt</id>
	<title>Forge Community Wiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://forge.gemwire.uk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Unbekannt"/>
	<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/wiki/Special:Contributions/Unbekannt"/>
	<updated>2026-04-06T08:01:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Dynamic_Loot_Modification&amp;diff=2492</id>
		<title>Dynamic Loot Modification</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Dynamic_Loot_Modification&amp;diff=2492"/>
		<updated>2021-03-13T23:38:08Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: add folder for serialized jsons&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Global Loot Modifiers are a data-driven method of handling modification of harvested drops without the need to overwrite dozens to hundreds of vanilla loot tables or to handle effects that would require interactions with another mod's loot tables without knowing what mods may be loaded. Global Loot Modifiers are also stacking, rather than last-load-wins as modifications to loot tables would be.&lt;br /&gt;
&lt;br /&gt;
== Registering a Global Loot Modifier ==&lt;br /&gt;
&lt;br /&gt;
You will need 3 things:&lt;br /&gt;
# Create a &amp;lt;code&amp;gt;global_loot_modifiers.json&amp;lt;/code&amp;gt; file at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;/data/forge/loot_modifiers/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* This will tell Forge about your modifiers and works similar to [[Tags|tags]].&lt;br /&gt;
# A serialized json representing your modifier at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;/data/&amp;lt;modID&amp;gt;/loot_modifiers/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* This will contain all of the data about your modification and allows data packs to tweak your effect.&lt;br /&gt;
# A class that extends &amp;lt;code&amp;gt;LootModifier&amp;lt;/code&amp;gt;&lt;br /&gt;
#* The operational code that makes your modifier work and associated serializer.&lt;br /&gt;
&lt;br /&gt;
Finally, the serializer for your operational class is [[Registration|registered]] as any other &amp;lt;code&amp;gt;ForgeRegistryEntry&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== The global_loot_modifiers.json ==&lt;br /&gt;
&lt;br /&gt;
All you need to add here are the registry names of your loot modifiers.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;replace&amp;quot;: false,&lt;br /&gt;
  &amp;quot;entries&amp;quot;: [&lt;br /&gt;
    &amp;quot;global_loot_test:silk_touch_bamboo&amp;quot;,&lt;br /&gt;
    &amp;quot;global_loot_test:smelting&amp;quot;,&lt;br /&gt;
    &amp;quot;global_loot_test:wheat_harvest&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;replace&amp;lt;/code&amp;gt; causes the cache of modifiers to be cleared fully when this asset loads (mods are loaded in an order that may be specified by a data pack). For modders you will want to use &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; while data pack makers may want to specify their overrides with &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;entries&amp;lt;/code&amp;gt; is an *ordered list* of the modifiers that will be loaded. Any modifier that is not listed will not be loaded and the ones listed are called in the order listed. This is primarily relevant to data pack makers for resolving conflicts between modifiers from separate mods.&lt;br /&gt;
&lt;br /&gt;
== The serialized json ==&lt;br /&gt;
&lt;br /&gt;
This file contains all of the potential variables related to your modifier, including the conditions that must be met prior to modifying any loot as well as any other parameters your modifier might have. Avoid hard-coded values where ever possible so that data pack makers can adjust balance if they wish to.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;conditions&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;condition&amp;quot;: &amp;quot;minecraft:match_tool&amp;quot;,&lt;br /&gt;
      &amp;quot;predicate&amp;quot;: {&lt;br /&gt;
        &amp;quot;item&amp;quot;: &amp;quot;minecraft:shears&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;condition&amp;quot;: &amp;quot;block_state_property&amp;quot;,&lt;br /&gt;
      &amp;quot;block&amp;quot;:&amp;quot;minecraft:wheat&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ],&lt;br /&gt;
  &amp;quot;seedItem&amp;quot;: &amp;quot;minecraft:wheat_seeds&amp;quot;,&lt;br /&gt;
  &amp;quot;numSeeds&amp;quot;: 3,&lt;br /&gt;
  &amp;quot;replacement&amp;quot;: &amp;quot;minecraft:wheat&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above example, the modification only happens if the player harvests wheat when using shears (specified by the two &amp;lt;code&amp;gt;conditions&amp;lt;/code&amp;gt; which are automatically &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt;ed together). The &amp;lt;code&amp;gt;seedsItem&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;numSeeds&amp;lt;/code&amp;gt; values are then used to count how many seeds were generated by the vanilla loot table, and if matched, are substituted for an additional &amp;lt;code&amp;gt;replacement&amp;lt;/code&amp;gt; item instead. The operation code will be shown below.&lt;br /&gt;
&amp;lt;code&amp;gt;conditions&amp;lt;/code&amp;gt; is the only object needed by the system specification, everything else is the mod maker's data.&lt;br /&gt;
&lt;br /&gt;
== The LootModifier Subclass ==&lt;br /&gt;
&lt;br /&gt;
You will also need a static child class that extends &amp;lt;code&amp;gt;GlobalLootModifierSerializer&amp;lt;T&amp;gt;&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;T&amp;lt;/code&amp;gt; is your LootModifier subclass in order to deserialize your json data file into operational code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
private static class WheatSeedsConverterModifier extends LootModifier {&lt;br /&gt;
	private final int numSeedsToConvert;&lt;br /&gt;
	private final Item itemToCheck;&lt;br /&gt;
	private final Item itemReward;&lt;br /&gt;
	public WheatSeedsConverterModifier(ILootCondition[] conditionsIn, int numSeeds, Item itemCheck, Item reward) {&lt;br /&gt;
		super(conditionsIn);&lt;br /&gt;
		numSeedsToConvert = numSeeds;&lt;br /&gt;
		itemToCheck = itemCheck;&lt;br /&gt;
		itemReward = reward;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	@Nonnull&lt;br /&gt;
	@Override&lt;br /&gt;
	public List&amp;lt;ItemStack&amp;gt; doApply(List&amp;lt;ItemStack&amp;gt; generatedLoot, LootContext context) {&lt;br /&gt;
		//*&lt;br /&gt;
		* Additional conditions can be checked, though as much as possible should be parameterized via JSON data.&lt;br /&gt;
		* It is better to write a new ILootCondition implementation than to do things here.&lt;br /&gt;
		*//&lt;br /&gt;
		int numSeeds = 0;&lt;br /&gt;
		for(ItemStack stack : generatedLoot) {&lt;br /&gt;
			if(stack.getItem() == itemToCheck)&lt;br /&gt;
				numSeeds+=stack.getCount();&lt;br /&gt;
		}&lt;br /&gt;
		if(numSeeds &amp;gt;= numSeedsToConvert) {&lt;br /&gt;
			generatedLoot.removeIf(x -&amp;gt; x.getItem() == itemToCheck);&lt;br /&gt;
			generatedLoot.add(new ItemStack(itemReward, (numSeeds/numSeedsToConvert)));&lt;br /&gt;
			numSeeds = numSeeds%numSeedsToConvert;&lt;br /&gt;
			if(numSeeds &amp;gt; 0)&lt;br /&gt;
				generatedLoot.add(new ItemStack(itemToCheck, numSeeds));&lt;br /&gt;
		}&lt;br /&gt;
		return generatedLoot;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	private static class Serializer extends GlobalLootModifierSerializer&amp;lt;WheatSeedsConverterModifier&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
		@Override&lt;br /&gt;
		public WheatSeedsConverterModifier read(ResourceLocation name, JsonObject object, ILootCondition[] conditionsIn) {&lt;br /&gt;
			int numSeeds = JSONUtils.getInt(object, &amp;quot;numSeeds&amp;quot;);&lt;br /&gt;
			Item seed = ForgeRegistries.ITEMS.getValue(new ResourceLocation((JSONUtils.getString(object, &amp;quot;seedItem&amp;quot;))));&lt;br /&gt;
			Item wheat = ForgeRegistries.ITEMS.getValue(new ResourceLocation(JSONUtils.getString(object, &amp;quot;replacement&amp;quot;)));&lt;br /&gt;
			return new WheatSeedsConverterModifier(conditionsIn, numSeeds, seed, wheat);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The critical portion is the &amp;lt;code&amp;gt;doApply&amp;lt;/code&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
This method is only called if the &amp;lt;code&amp;gt;conditions&amp;lt;/code&amp;gt; specified return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; and the modder is now able to make the modifications they desire. In this case we can see that the number of &amp;lt;code&amp;gt;itemToCheck&amp;lt;/code&amp;gt; meets or exceeds the &amp;lt;code&amp;gt;numSeedsToConvert&amp;lt;/code&amp;gt; before modifying the list by adding an &amp;lt;code&amp;gt;itemReward&amp;lt;/code&amp;gt; and removing any excess &amp;lt;code&amp;gt;itemToCheck&amp;lt;/code&amp;gt; stacks, matching the previously mentioned effects: When a wheat block is harvested with shears, if enough seeds are generated as loot, they are converted to additional wheat instead.&lt;br /&gt;
&lt;br /&gt;
Also take note of the &amp;lt;code&amp;gt;read&amp;lt;/code&amp;gt; method in the serializer. The conditions are already deserialized for you and if you have no other data, simply &amp;lt;code&amp;gt;return new MyModifier(conditionsIn)&amp;lt;/code&amp;gt;. However, the full &amp;lt;code&amp;gt;JsonObject&amp;lt;/code&amp;gt; is available if needed.&lt;br /&gt;
&lt;br /&gt;
Additional [https://github.com/MinecraftForge/MinecraftForge/blob/1.15.x/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java examples] can be found on the Forge Git repository, including silk touch and smelting effects.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Saplings&amp;diff=2491</id>
		<title>Saplings</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Saplings&amp;diff=2491"/>
		<updated>2021-03-11T17:59:33Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: fix formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Let's start with a basic example by extending SaplingBlock.First create a class that extends SaplingBlock.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;public class ExampleSapling extends SaplingBlock{}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that you can insert the constructor. It must call super with the Parameters : &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=1&lt;br /&gt;
!Name !! Type !!Description &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;treeIn&amp;lt;/code&amp;gt;   ||   &amp;lt;code&amp;gt;net.minecraft.block.trees.Tree&amp;lt;/code&amp;gt;   || &amp;lt;code&amp;gt;The Tree your Sapling is related to&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;properties&amp;lt;/code&amp;gt;   ||   &amp;lt;code&amp;gt;net.minecraft.block.AbstractBlock.Properties&amp;lt;/code&amp;gt;   ||  &amp;lt;code&amp;gt;The Block Properties of the Sapling&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That means we need to make a Tree for ourselves, but more on that in a bit.&lt;br /&gt;
If you want to have the Sapling be placeable on your own Mods Block, you need to override &amp;lt;code&amp;gt;isValidGround&amp;lt;/code&amp;gt; and make your own additions to the vanilla provided Blocks. I recommend making a &lt;br /&gt;
&amp;lt;code&amp;gt;private static final List&amp;lt;Block&amp;gt; validBlocks = ImmutableList.of(Blocks block...)&amp;lt;/code&amp;gt; to add Blocks to the List of possible Blocks.&lt;br /&gt;
If you have that, your function could look like :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
protected boolean isValidGround(@Nonnull BlockState state,@Nonnull IBlockReader worldIn,@Nonnull BlockPos pos) {&lt;br /&gt;
return validBlocks.stream().anyMatch(state::isIn) || super.isValidGround(state, worldIn, pos);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now onto making the Tree for your Sapling.&lt;br /&gt;
&lt;br /&gt;
Start by making a &amp;lt;code&amp;gt;class&amp;lt;/code&amp;gt; that extends &amp;lt;code&amp;gt;Tree&amp;lt;/code&amp;gt; : &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;public class ExampleTree extends Tree &amp;lt;/code&amp;gt;&lt;br /&gt;
This &amp;lt;code&amp;gt;class&amp;lt;/code&amp;gt; will only contain one &amp;lt;code&amp;gt;function&amp;lt;/code&amp;gt; which is : &lt;br /&gt;
&amp;lt;code&amp;gt;protected ConfiguredFeature&amp;lt;BaseTreeFeatureConfig, ?&amp;gt; getTreeFeature(Random randomIn, boolean largeHive)&amp;lt;/code&amp;gt;&lt;br /&gt;
As you can see, this function requires to return a ConfiguredFeature&amp;lt;BaseTreeFeatureConfig, ?&amp;gt;. This will be the Tree that is Placed in the World.&lt;br /&gt;
The &amp;lt;code&amp;gt;ConfiguredFeature&amp;lt;BaseTreeFeatureConfig, ?&amp;gt;&amp;lt;/code&amp;gt; will look sth like this :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public static final ConfiguredFeature&amp;lt;BaseTreeFeatureConfig, ?&amp;gt; EXAMPLETREEFEATURE = &lt;br /&gt;
 Feature.TREE.withConfiguration(&lt;br /&gt;
            new BaseTreeFeatureConfig.Builder(&lt;br /&gt;
                    new SimpleBlockStateProvider(BlockInit.EXAMPLE_WOOD.get().getDefaultState()),&lt;br /&gt;
                    new SimpleBlockStateProvider(BlockInit.EXAMPLE_LEAVES.get().getDefaultState()),&lt;br /&gt;
                    new BlobFoliagePlacer(FeatureSpread.func_242252_a(2), FeatureSpread.func_242252_a(0), 3),&lt;br /&gt;
                    new StraightTrunkPlacer(4, 2, 0),&lt;br /&gt;
                    new TwoLayerFeature(1, 0, 1)&lt;br /&gt;
            ).setIgnoreVines().build());&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
After we have our ExampleTree we need to register it. This is done via 2 functions :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public static void registerTrees() {&lt;br /&gt;
        register(&amp;quot;example_tree&amp;quot;, EXAMPLETREE);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and also the function &amp;lt;code&amp;gt;register&amp;lt;/code&amp;gt; : &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public void register(String key, ConfiguredFeature&amp;lt;FC, ?&amp;gt; configuredFeature){&lt;br /&gt;
Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, key, configuredFeature);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight &amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have everything setup, call registerTrees() in FMLCommonSetupEvent.&amp;lt;br&amp;gt;&lt;br /&gt;
Back to the Sapling. Your constructor can now be completed by putting the Tree we just registered as the first super parameter and the Properties as the second parameter : &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public ExampleSapling() {&lt;br /&gt;
        super(new ExampleTree(), AbstractBlock.Properties.create(Material.PLANTS).doesNotBlockMovement().tickRandomly().zeroHardnessAndResistance().sound(SoundType.PLANT));&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/syntaxhighlight &amp;gt;&lt;br /&gt;
Also in your ExampleTree class, instead of null, the function now should return your TreeFeature : &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
protected ConfiguredFeature&amp;lt;BaseTreeFeatureConfig, ?&amp;gt; getTreeFeature(@Nonnull Random randomIn, boolean largeHive) {&lt;br /&gt;
        return EXAMPLETREEFEATURE;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/syntaxhighlight &amp;gt;&lt;br /&gt;
Now register the Sapling like any other Block and it should be able to be placed and grow with the correct Tree.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Tags&amp;diff=2482</id>
		<title>Tags</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Tags&amp;diff=2482"/>
		<updated>2021-03-07T15:59:42Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: make the comment correct in code block&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Tags are generalized sets of objects in the game, used for grouping related things together and providing fast membership checks.&lt;br /&gt;
&lt;br /&gt;
== Declaring Your Own Groupings ==&lt;br /&gt;
Tags are declared in your mod’s [https://mcforge.readthedocs.io/en/latest/utilities/tags/datapacks.md datapack]. For example, &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;/data/modid/tags/blocks/foo/tagname.json&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; will declare a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Tag&amp;lt;Block&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; with ID &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;modid:foo/tagname&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. Similarly, you may append to or override tags declared in other domains, such as Vanilla, by declaring your own JSONs. For example, to add your own mod’s saplings to the Vanilla sapling tag, you would specify it in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;/data/minecraft/tags/blocks/saplings.json&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, and Vanilla will merge everything into one tag at reload, if the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;replace&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; option is false. If &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;replace&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is true, then all entries before the json specifying &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;replace&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; will be removed. See the [https://minecraft.gamepedia.com/Tag#JSON_format Vanilla wiki] for a description of the base syntax.&lt;br /&gt;
&lt;br /&gt;
Forge provides two extensions on the Vanilla syntax: * You may declare an &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;optional&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; array of the same format as the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;values&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; array, but any values listed here that are not present will not cause the tag loading to error. This is useful to provide integration for mods that may or may not be present at runtime. &lt;br /&gt;
* You may declare a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;remove&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; array of the same format as the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;values&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; array. Any values listed here will be removed from the tag. This acts as a finer grained version of the Vanilla &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;replace&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
==Using Tags In Code==&lt;br /&gt;
Block, Item, and Fluid tags are automatically sent from the server to any remote clients on login and reload. Function tags are not synced.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockTags.getCollection()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ItemTags.getCollection()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; will retrieve the current &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;TagCollection&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, from which you can retrieve a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Tag&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; object by its ID. With a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Tag&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; object in hand, membership can be tested with &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;tag.contains(thing)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, or all the objects in the tag queried with &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;tag.getAllElements()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As an example: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
ResourceLocation myTagId = new ResourceLocation(&amp;quot;mymod&amp;quot;, &amp;quot;myitemgroup&amp;quot;);&lt;br /&gt;
Item unknownItem = stack.getItem();&lt;br /&gt;
boolean isInGroup = ItemTags.getCollection().getOrCreateTag(myTagId).contains(unknownItem);&lt;br /&gt;
// alternatively, can use getTag and perform a null check&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=tip|content=The &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;TagCollection&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; returned by &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;getCollection()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; (and the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Tag&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;s within it) may expire if a reload happens, so you should always query the collection anew every time you need it. The static &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Tag&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; fields in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BlockTags&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ItemTags&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; avoid this by introducing a wrapper that handles this expiring. Alternatively, a resource reload listener can be used to refresh any cached tags.}}&lt;br /&gt;
&lt;br /&gt;
== Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are several conventions that will help facilitate compatibility in the ecosystem: &lt;br /&gt;
   * If there is a Vanilla tag that fits your block or item, add it to that tag. See the [https://minecraft.gamepedia.com/Tag#List_of_tags list of Vanilla tags]. &lt;br /&gt;
   * If there is a Forge tag that fits your block or item, add it to that tag. The list of tags declared by Forge can be seen on [https://github.com/MinecraftForge/MinecraftForge/tree/1.16.x/src/generated/resources/data/forge/tags GitHub]. &lt;br /&gt;
   * If there is a group of something you feel should be shared by the community, consider PR-ing it to Forge instead of making your own tag &lt;br /&gt;
   * Tag naming conventions should follow Vanilla conventions. In particular, item and block groupings are plural instead of singular. E.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;minecraft:logs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;minecraft:saplings&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. &lt;br /&gt;
   * Item tags should be sorted into subdirectories according to the type of item, e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;forge:ingots/iron&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;forge:nuggets/brass&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
&lt;br /&gt;
== Migration from OreDictionary ==&lt;br /&gt;
* For recipes, tags can be used directly in the vanilla recipe format (see below)&lt;br /&gt;
* For matching items in code, see the section above.&lt;br /&gt;
* If you are declaring a new type of item grouping, follow a couple naming conventions:&lt;br /&gt;
** Use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;domain:type/material&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. When the name is a common one that all modders should adopt, use the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;forge&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; domain.&lt;br /&gt;
** For example, brass ingots should be registered under the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;forge:ingots/brass&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; tag, and cobalt nuggets under the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;forge:nuggets/cobalt&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; tag.&lt;br /&gt;
&lt;br /&gt;
== Using Tags in Recipes and Advancements  ==&lt;br /&gt;
Tags are directly supported by Vanilla, see the respective Vanilla wiki pages for [https://minecraft.gamepedia.com/Recipe#JSON_format recipes] and [https://minecraft.gamepedia.com/Advancements advancements] for usage details.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Additional_Resources&amp;diff=2410</id>
		<title>Additional Resources</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Additional_Resources&amp;diff=2410"/>
		<updated>2021-02-12T17:44:57Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: add Mcjty's Tutorial&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Under construction}}&lt;br /&gt;
&lt;br /&gt;
There are hundreds of different resources and libraries that make modding for Forge easier to understand and use. This page contains a collection of these entries that is recommended for use.&lt;br /&gt;
&lt;br /&gt;
== Informational Resources ==&lt;br /&gt;
&lt;br /&gt;
* [https://mcforge.readthedocs.io/ Official Forge Documentation]&lt;br /&gt;
* [https://minecraft.gamepedia.com/Minecraft_Wiki Minecraft Wiki]&lt;br /&gt;
* [https://wiki.mcjty.eu/modding/index.php?title=YouTube-Tutorials Mcjty's Tutorials]&lt;br /&gt;
&lt;br /&gt;
== Useful Libraries and APIs ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
! Library !! Author !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Example || Example || Example&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Semantic_Versioning&amp;diff=2281</id>
		<title>Semantic Versioning</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Semantic_Versioning&amp;diff=2281"/>
		<updated>2020-12-21T13:49:54Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: remove old Box to new one&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://semver.org/ Semantic Versioning] is a versioning system where three variable are used to represent the version, in the format of &amp;lt;code&amp;gt;MAJOR.MINOR.PATCH&amp;lt;/code&amp;gt;. However, in the case of modding, it may be beneficial to add additional variable such as the Minecraft version, to allow distinction between mods that work for which Minecraft versions.&lt;br /&gt;
&lt;br /&gt;
{{Tip|The information presented here is purely informative. You are free to use any versioning system you wish.}}&lt;br /&gt;
&lt;br /&gt;
When incrementing any variable, all lesser variables should reset to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;. For instance, if &amp;lt;code&amp;gt;MINOR&amp;lt;/code&amp;gt; would increment, &amp;lt;code&amp;gt;PATCH&amp;lt;/code&amp;gt; would become &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;. If &amp;lt;code&amp;gt;MAJORMOD&amp;lt;/code&amp;gt; would increment, all other variables would become &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Hybrid Versioning ==&lt;br /&gt;
&lt;br /&gt;
A good hybrid of Semantic Versioning for Minecraft mods is the format: &amp;lt;code&amp;gt;MCVERSION-MAJORMOD.MAJORAPI.MINOR.PATCH&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Variable !! Description &lt;br /&gt;
! When to Change&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MCVERSION&amp;lt;/code&amp;gt; || The Minecraft version being targeted. &lt;br /&gt;
| The target Minecraft version is updated. &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MAJORMOD&amp;lt;/code&amp;gt; || The major version of the mod. &lt;br /&gt;
| Exising mod objects - such as items, blocks, tile entities - are removed or fundamental mechanics are modified. &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MAJORAPI&amp;lt;/code&amp;gt; || The major version of the mod's API. &lt;br /&gt;
| Any part of the mod's public-facing API is changed, such as reordered enums, method signature changes, or removal of public methods. &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MINOR&amp;lt;/code&amp;gt; || The minor version of the mod. &lt;br /&gt;
| Mod objects or non-fundamental mechanics are added, or elements of the API are deprecated (but not removed). &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PATCH&amp;lt;/code&amp;gt; || The patch version of the mod release. &lt;br /&gt;
| Bugs are fixed or the changes are unnoticable. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Classifiers ==&lt;br /&gt;
&lt;br /&gt;
A classifer can be appended to the build version to denote it is a special build of some note. These classifiers are appended after the version variables are incremented and reset.&lt;br /&gt;
&lt;br /&gt;
=== Pre-releases ===&lt;br /&gt;
&lt;br /&gt;
It is also possible to pre-release work-in-progress features, which means new features are released that are not quite done yet. These can be seen as a sort of &amp;quot;beta&amp;quot;. These versions should be appended with &amp;lt;code&amp;gt;-betaX&amp;lt;/code&amp;gt;, where &amp;lt;code&amp;gt;X&amp;lt;/code&amp;gt; is the number of the pre-release. Already released versions before the initial release can not go into pre-release; a variable must be incremented (e.g. the &amp;lt;code&amp;gt;MINOR&amp;lt;/code&amp;gt; variable) and others updated before applying this classifier.&lt;br /&gt;
&lt;br /&gt;
{{Tip/Important|This guide does not use the &amp;lt;code&amp;gt;-preX&amp;lt;/code&amp;gt; classifier for pre-releases, because the library used to compare versions does not accept it as an alias for &amp;lt;code&amp;gt;-betaX&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
=== Release Candidates ===&lt;br /&gt;
&lt;br /&gt;
If you are confident enough that a build is ready to be a release but a bit more testing is required, you may make it a ''release candidate''. These release candidates may receive the &amp;lt;code&amp;gt;-rcX&amp;lt;/code&amp;gt; classifier, where &amp;lt;code&amp;gt;X&amp;lt;/code&amp;gt; is the number of the release candidate, incremented for every new release candidate build. Already released versions before the initial release can not go into pre-release; a variable must be incremented (e.g. the &amp;lt;code&amp;gt;MINOR&amp;lt;/code&amp;gt; variable) and others updated before applying this classifier.&lt;br /&gt;
&lt;br /&gt;
The final released build will have the same version as the release candidate with the classifier omitted, and will usually be exactly the same or have a few unnoticable bugfixes included.&lt;br /&gt;
&lt;br /&gt;
=== Final Release ===&lt;br /&gt;
&lt;br /&gt;
When dropping support for a Minecraft version, the ''final build'' for that Minecraft version may receive the &amp;lt;code&amp;gt;-final&amp;lt;/code&amp;gt; classifer. This denotes that the mod will no longer be supported for the denoted &amp;lt;code&amp;gt;MCVERSION&amp;lt;/code&amp;gt; and players should upgrade their Minecraft version to continue receiving updates and fixes.&lt;br /&gt;
&lt;br /&gt;
== During Development ==&lt;br /&gt;
&lt;br /&gt;
If you are in the initial development stage of your mod (before any official releases), the &amp;lt;code&amp;gt;MAJORMOD&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;MAJORAPI&amp;lt;/code&amp;gt; should be kept at &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;. Only &amp;lt;code&amp;gt;MINOR.PATCH&amp;lt;/code&amp;gt; should be updated every time you build your mod. During this development stage, you are free to change or restructure your mod's API, objects, and mechanics as you wish without updating the major version variables. Once you build an official public release, you should increment the &amp;lt;code&amp;gt;MAJORMOD&amp;lt;/code&amp;gt; version, reset the others to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;, and follow your versioning strictly.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Internationalization&amp;diff=2280</id>
		<title>Internationalization</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Internationalization&amp;diff=2280"/>
		<updated>2020-12-21T13:48:35Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: update Box to use new Templates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Internationalization''' (shortened as '''i18n'''), is a way of designing code so that it requires no changes to be adapted for various languages. '''Localization''' (shortened as '''l10n''') is the process of adapting displayed text to the user’s language.&lt;br /&gt;
&lt;br /&gt;
Internationalization is implemented using ''translation keys''. A translation key is a string that identifies a piece of displayable text in no specific language. For example, &amp;lt;code&amp;gt;block.minecraft.dirt&amp;lt;/code&amp;gt; is the translation key referring to the name of the Dirt block. This way, displayable text may be referenced with no concern for a specific language. The code requires no changes to be adapted in a new language.&lt;br /&gt;
&lt;br /&gt;
Localization will happen in the game’s locale. In a Minecraft client the locale is specified by the language settings. On a dedicated server, the only supported locale is &amp;lt;code&amp;gt;en_us&amp;lt;/code&amp;gt;. A list of available locales can be found on the [https://minecraft.gamepedia.com/Language#Available_languages Minecraft Wiki].&lt;br /&gt;
&lt;br /&gt;
{{Tip/Important|The only purpose of a translation key is internationalization. Do not use them for logic, such as comparing if two blocks are equal. Use their [[Registration|registry names]] instead.}}&lt;br /&gt;
&lt;br /&gt;
== Language files ==&lt;br /&gt;
&lt;br /&gt;
Language files are located by &amp;lt;code&amp;gt;assets/[namespace]/lang/[locale].json&amp;lt;/code&amp;gt; (e.g. the US English translation for &amp;lt;code&amp;gt;examplemod&amp;lt;/code&amp;gt; would be &amp;lt;code&amp;gt;assets/examplemod/lang/en_us.json&amp;lt;/code&amp;gt;). The file format is simply a json map from translation keys to values. The file must be encoded in UTF-8.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;item.examplemod.example_item&amp;quot;: &amp;quot;Example Item Name&amp;quot;,&lt;br /&gt;
  &amp;quot;block.examplemod.example_block&amp;quot;: &amp;quot;Example Block Name&amp;quot;,&lt;br /&gt;
  &amp;quot;commands.examplemod.example_command.error&amp;quot;: &amp;quot;Example Command Errored!&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage with Blocks and Items ==&lt;br /&gt;
&lt;br /&gt;
Block, Item, and a few other Minecraft classes have built-in translation keys used to display their names. These translation keys are specified by overriding &amp;lt;code&amp;gt;getTranslationKey()&amp;lt;/code&amp;gt;. Item also has &amp;lt;code&amp;gt;getTranslationKey(ItemStack)&amp;lt;/code&amp;gt; which can be overridden to provide different translation keys depending on &amp;lt;code&amp;gt;ItemStack&amp;lt;/code&amp;gt; NBT.&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;code&amp;gt;getTranslationKey()&amp;lt;/code&amp;gt; will return &amp;lt;code&amp;gt;block&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;item&amp;lt;/code&amp;gt;. prepended to the registry name of the block or item, with the colon replaced by a dot. &amp;lt;code&amp;gt;BlockItem&amp;lt;/code&amp;gt;s will take their corresponding Block's translation key by default. For example, an item with ID &amp;lt;code&amp;gt;examplemod:example_item&amp;lt;/code&amp;gt; effectively requires the following line in a language file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;item.examplemod.example_item&amp;quot;: &amp;quot;Example Item Name&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Localization methods ==&lt;br /&gt;
&lt;br /&gt;
{{Tip/Important|A common issue is having the server localize for clients. The server can only localize in its own locale, which does not necessarily match the locale of connected clients.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
To respect the language settings of clients, the server should have clients localize text in their own locale using &amp;lt;code&amp;gt;TranslationTextComponent&amp;lt;/code&amp;gt; or other methods preserving the language neutral translation keys.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3 id=&amp;quot;I18n&amp;quot;&amp;gt;&amp;lt;tt style=&amp;quot;font-size: 100%&amp;quot;&amp;gt;net.minecraft.client.resources.I18n&amp;lt;/tt&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Tip/Danger|'''This I18n class can only be found on the [[Sides#Different_Kinds_of_Sides|physical client]]!''' It is intended to be used by code that only runs on the client. Attempts to use this on a server will throw exceptions and crash.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;format(String, Object...)&amp;lt;/code&amp;gt; localizes in the client’s locale with formatting. The first parameter is a translation key, and the rest are formatting arguments for &amp;lt;code&amp;gt;String.format(String, Object...)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt style=&amp;quot;font-size: 100%&amp;quot;&amp;gt;TranslationTextComponent&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;TranslationTextComponent&amp;lt;/code&amp;gt; is an &amp;lt;code&amp;gt;ITextComponent&amp;lt;/code&amp;gt; that is localized and formatted lazily. It is very useful when sending messages to players because it will be automatically localized in their own locale.&lt;br /&gt;
&lt;br /&gt;
The first parameter of the &amp;lt;code&amp;gt;TranslationTextComponent(String, Object...)&amp;lt;/code&amp;gt; constructor is a translation key, and the rest are used for formatting. The only supported format specifiers are &amp;lt;code&amp;gt;%s&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;%1$s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%2$s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%3$s&amp;lt;/code&amp;gt; etc. Formatting arguments may be other &amp;lt;code&amp;gt;ITextComponent&amp;lt;/code&amp;gt;s that will be inserted into the resulting formatted text with all their attributes preserved.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Resources&amp;diff=2279</id>
		<title>Resources</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Resources&amp;diff=2279"/>
		<updated>2020-12-21T13:45:39Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: update link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A resource is extra data used by the game, and is stored in a data file, instead of being in the code. Minecraft has two primary resource systems active: one on the client used for visuals such as models, textures, and localization called &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;assets&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, the other used for gameplay such as recipes and loot tables called &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;data&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. Resource packs control the former, while data packs control the latter.&lt;br /&gt;
&lt;br /&gt;
When multiple resource packs or data packs are enabled, they are merged. Generally, files from packs at the top of the stack override those below; however, for certain files, such as localization files and tags, data is actually merged contentwise. Mods actually define resource and data packs too, in their &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;resources&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; directories, but they are seen as subsets of the “Default” pack. Mod resource packs cannot be disabled, but they can be overridden by other resource packs. Mod datapacks can be disabled with the vanilla &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;/datapack&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
All resources should have '''snake case''' paths and filenames (lowercase, using “_” for word boundaries).&lt;br /&gt;
&lt;br /&gt;
== ResourceLocation ==&lt;br /&gt;
&lt;br /&gt;
Minecraft identifies resources using &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ResourceLocation&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;s. A &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ResourceLocation&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; contains two parts: a namespace and a path. It generally points to the resource at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;assets|data&amp;gt;/&amp;lt;namespace&amp;gt;/&amp;lt;ctx&amp;gt;/&amp;lt;path&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, where &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ctx&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is a context-specific path fragment that depends on how the ResourceLocation is being used. When a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ResourceLocation&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is written from/read as a string, it is seen as &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;namespace&amp;gt;:&amp;lt;path&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. If the namespace and the colon are left out, then when the string is read into an ResourceLocation the namespace will almost always default to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;minecraft&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. A mod should put its resources into a namespace with the same name as its modid (E.g. a mod with id &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;examplemod&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; should place its resources in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;assets|data&amp;gt;/examplemod&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ResourceLocation&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;s pointing to those files would look like &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;examplemod:&amp;lt;path&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;). This is not a requirement, and in some cases it can be desirable to use a different (or even more than one) namespace. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ResourceLocation&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;s are used outside the resource system, too, as they happen to be a great way to uniquely identify objects (e.g. [[Registration|registries]]).&lt;br /&gt;
&lt;br /&gt;
== Important Directories ==&lt;br /&gt;
&lt;br /&gt;
Minecraft expects certain parts of your project to be in certain locations, such as textures and JSONs.&lt;br /&gt;
&lt;br /&gt;
All locations and items covered in this page are relative to your &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./src/main/resources/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
== General Files ==&lt;br /&gt;
&lt;br /&gt;
=== mods.toml ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;mods.toml&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; file is in the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./META-INF/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; directory. This holds the basic information relating to your mod.&lt;br /&gt;
&lt;br /&gt;
=== pack.mcmeta ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;pack.mcmeta&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; file is in the current directory. This allows Minecraft to notice the assets provided by your mod.&lt;br /&gt;
&lt;br /&gt;
== Assets ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; folder holds all client related files for a specific user. These files are only specific to the computer they're on.&lt;br /&gt;
&lt;br /&gt;
=== Blockstates ===&lt;br /&gt;
&lt;br /&gt;
Blockstate definition files are in the JSON format and are in the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/blockstates/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
=== Localizations ===&lt;br /&gt;
&lt;br /&gt;
Localizations are plain-text files with the file extension &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;.json&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and the name being their [https://docs.microsoft.com/en-us/previous-versions/commerce-server/ee825488(v=cs.20)?redirectedfrom=MSDN language code] in lowercase such as &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;en_us&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
They are located in the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/lang/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
=== Models ===&lt;br /&gt;
&lt;br /&gt;
Model files are in JSON format and are located in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/models/block/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/models/item/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; depending on whether they are for a block or an item, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Textures ===&lt;br /&gt;
&lt;br /&gt;
Textures are in the PNG format and are located in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/textures/block/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/textures/item/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; depending on whether they are for a block or an item, respectively. For other entries, they will be placed in their specified location within &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/textures/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Data ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./data&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; folder holds all server related files for a specific game file. These files are synced across the network from the hosting server location.&lt;br /&gt;
&lt;br /&gt;
=== Advancements ===&lt;br /&gt;
&lt;br /&gt;
Advancements are in JSON format and are located in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./data/&amp;lt;modid&amp;gt;/advancements/&amp;lt;group&amp;gt;/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;group&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is the tab the advancement is part of.&lt;br /&gt;
&lt;br /&gt;
=== Loot Tables ===&lt;br /&gt;
&lt;br /&gt;
Loot tables are in JSON format and are located in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./data/&amp;lt;modid&amp;gt;/loot_tables/&amp;lt;group&amp;gt;/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;group&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is the general object where the loot table drops from (e.g. a block's loot table is in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;blocks&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Recipes ===&lt;br /&gt;
&lt;br /&gt;
Recipes are in JSON format and are located in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./data/&amp;lt;modid&amp;gt;/recipes/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Tags ===&lt;br /&gt;
&lt;br /&gt;
Tags are in JSON format and are located in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./data/&amp;lt;modid&amp;gt;/tags/&amp;lt;group&amp;gt;/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;group&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is the registry object to create the tags for (e.g. an entity tag would be in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;entity_types&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;).&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Resources&amp;diff=2278</id>
		<title>Resources</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Resources&amp;diff=2278"/>
		<updated>2020-12-21T13:43:14Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: update kink&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A resource is extra data used by the game, and is stored in a data file, instead of being in the code. Minecraft has two primary resource systems active: one on the client used for visuals such as models, textures, and localization called &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;assets&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, the other used for gameplay such as recipes and loot tables called &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;data&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. Resource packs control the former, while data packs control the latter.&lt;br /&gt;
&lt;br /&gt;
When multiple resource packs or data packs are enabled, they are merged. Generally, files from packs at the top of the stack override those below; however, for certain files, such as localization files and tags, data is actually merged contentwise. Mods actually define resource and data packs too, in their &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;resources&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; directories, but they are seen as subsets of the “Default” pack. Mod resource packs cannot be disabled, but they can be overridden by other resource packs. Mod datapacks can be disabled with the vanilla &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;/datapack&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
All resources should have '''snake case''' paths and filenames (lowercase, using “_” for word boundaries).&lt;br /&gt;
&lt;br /&gt;
== ResourceLocation ==&lt;br /&gt;
&lt;br /&gt;
Minecraft identifies resources using &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ResourceLocation&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;s. A &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ResourceLocation&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; contains two parts: a namespace and a path. It generally points to the resource at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;assets|data&amp;gt;/&amp;lt;namespace&amp;gt;/&amp;lt;ctx&amp;gt;/&amp;lt;path&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, where &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ctx&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is a context-specific path fragment that depends on how the ResourceLocation is being used. When a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ResourceLocation&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is written from/read as a string, it is seen as &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;namespace&amp;gt;:&amp;lt;path&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. If the namespace and the colon are left out, then when the string is read into an ResourceLocation the namespace will almost always default to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;minecraft&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. A mod should put its resources into a namespace with the same name as its modid (E.g. a mod with id &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;examplemod&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; should place its resources in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;assets|data&amp;gt;/examplemod&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ResourceLocation&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;s pointing to those files would look like &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;examplemod:&amp;lt;path&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;). This is not a requirement, and in some cases it can be desirable to use a different (or even more than one) namespace. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ResourceLocation&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;s are used outside the resource system, too, as they happen to be a great way to uniquely identify objects (e.g. [[Registration|registries]]).&lt;br /&gt;
&lt;br /&gt;
== Important Directories ==&lt;br /&gt;
&lt;br /&gt;
Minecraft expects certain parts of your project to be in certain locations, such as textures and JSONs.&lt;br /&gt;
&lt;br /&gt;
All locations and items covered in this page are relative to your &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./src/main/resources/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
== General Files ==&lt;br /&gt;
&lt;br /&gt;
=== mods.toml ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;mods.toml&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; file is in the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./META-INF/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; directory. This holds the basic information relating to your mod.&lt;br /&gt;
&lt;br /&gt;
=== pack.mcmeta ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;pack.mcmeta&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; file is in the current directory. This allows Minecraft to notice the assets provided by your mod.&lt;br /&gt;
&lt;br /&gt;
== Assets ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; folder holds all client related files for a specific user. These files are only specific to the computer they're on.&lt;br /&gt;
&lt;br /&gt;
=== Blockstates ===&lt;br /&gt;
&lt;br /&gt;
Blockstate definition files are in the JSON format and are in the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/blockstates/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
=== Localizations ===&lt;br /&gt;
&lt;br /&gt;
Localizations are plain-text files with the file extension &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;.json&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and the name being their [[https:''docs.microsoft.com/en-us/previous-versions/commerce-server/ee825488(v=cs.20)?redirectedfrom=MSDN|language code]] in lowercase such as &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;en_us&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
They are located in the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/lang/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
=== Models ===&lt;br /&gt;
&lt;br /&gt;
Model files are in JSON format and are located in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/models/block/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/models/item/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; depending on whether they are for a block or an item, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Textures ===&lt;br /&gt;
&lt;br /&gt;
Textures are in the PNG format and are located in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/textures/block/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/textures/item/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; depending on whether they are for a block or an item, respectively. For other entries, they will be placed in their specified location within &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./assets/&amp;lt;modid&amp;gt;/textures/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Data ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./data&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; folder holds all server related files for a specific game file. These files are synced across the network from the hosting server location.&lt;br /&gt;
&lt;br /&gt;
=== Advancements ===&lt;br /&gt;
&lt;br /&gt;
Advancements are in JSON format and are located in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./data/&amp;lt;modid&amp;gt;/advancements/&amp;lt;group&amp;gt;/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;group&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is the tab the advancement is part of.&lt;br /&gt;
&lt;br /&gt;
=== Loot Tables ===&lt;br /&gt;
&lt;br /&gt;
Loot tables are in JSON format and are located in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./data/&amp;lt;modid&amp;gt;/loot_tables/&amp;lt;group&amp;gt;/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;group&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is the general object where the loot table drops from (e.g. a block's loot table is in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;blocks&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Recipes ===&lt;br /&gt;
&lt;br /&gt;
Recipes are in JSON format and are located in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./data/&amp;lt;modid&amp;gt;/recipes/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Tags ===&lt;br /&gt;
&lt;br /&gt;
Tags are in JSON format and are located in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./data/&amp;lt;modid&amp;gt;/tags/&amp;lt;group&amp;gt;/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;group&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is the registry object to create the tags for (e.g. an entity tag would be in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;entity_types&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;).&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Registration&amp;diff=2277</id>
		<title>Registration</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Registration&amp;diff=2277"/>
		<updated>2020-12-21T13:33:35Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: update Link to Resource Location&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Registration is the process of taking the objects of a mod (such as items, blocks, sounds, etc.) and making them known to the game. Registering things is important, as without registration the game will simply not know about these objects, which will cause unexplainable behaviors and crashes.&lt;br /&gt;
&lt;br /&gt;
Most things that require registration in the game are handled by the Forge registries. A registry is an object similar to a map that assigns values to keys. Forge uses registries with [[Using Resources#ResourceLocation|ResourceLocation]] keys to register objects. This allows the &amp;lt;code&amp;gt;ResourceLocation&amp;lt;/code&amp;gt; to act as the &amp;quot;registry name&amp;quot; for objects. The registry name for an object may be accessed with &amp;lt;code&amp;gt;#getRegistryName&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;#setRegistryName&amp;lt;/code&amp;gt;. The setter can only be called once; calling it twice results in an exception.&lt;br /&gt;
&lt;br /&gt;
Every type of registrable object has its own registry. To see all registries supported by Forge, see the &amp;lt;code&amp;gt;ForgeRegistries&amp;lt;/code&amp;gt; class. All registry names within a registry always be unique; attempting to register with an already existing registry name will cause the newly registered object to override whatever was registered previously. However, names in different registries will not collide. For example, there's a &amp;lt;code&amp;gt;Block&amp;lt;/code&amp;gt; registry, and an &amp;lt;code&amp;gt;Item&amp;lt;/code&amp;gt; registry. A &amp;lt;code&amp;gt;Block&amp;lt;/code&amp;gt; and an &amp;lt;code&amp;gt;Item&amp;lt;/code&amp;gt; may be registered with the same name &amp;lt;code&amp;gt;example:thing&amp;lt;/code&amp;gt; without colliding; however, if two different &amp;lt;code&amp;gt;Block&amp;lt;/code&amp;gt;s or &amp;lt;code&amp;gt;Item&amp;lt;/code&amp;gt;s were registered with the same exact name, the second object will override the first.&lt;br /&gt;
&lt;br /&gt;
== Methods for Registering ==&lt;br /&gt;
&lt;br /&gt;
There are two proper ways to register objects: the &amp;lt;code&amp;gt;DeferredRegister&amp;lt;/code&amp;gt; class, and the &amp;lt;code&amp;gt;RegistryEvent.Register&amp;lt;/code&amp;gt; lifecycle event.&lt;br /&gt;
&lt;br /&gt;
=== DeferredRegister ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DeferredRegister&amp;lt;/code&amp;gt; is the newer and documented way to register objects. It allows the use and convenience of static initialisers while avoiding the issues associated with it. It simply maintains a list of suppliers for entries and registers the objects from those suppliers during the proper &amp;lt;code&amp;gt;RegistryEvent.Register&amp;lt;/code&amp;gt; event.&lt;br /&gt;
&lt;br /&gt;
An example of a mod registering a custom block:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
private static final DeferredRegister&amp;lt;Block&amp;gt; BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);&lt;br /&gt;
&lt;br /&gt;
public static final RegistryObject&amp;lt;Block&amp;gt; ROCK_BLOCK = BLOCKS.register(&amp;quot;rock&amp;quot;, () -&amp;gt; new Block(Block.Properties.create(Material.ROCK)));&lt;br /&gt;
&lt;br /&gt;
public ExampleMod() {&lt;br /&gt;
    BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== RegistryEvent.Register ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;RegistryEvent&amp;lt;/code&amp;gt;s are the second and more flexible way to register objects. These [[Events|events]] are fired after the mod constructors and before the loading of configs.&lt;br /&gt;
&lt;br /&gt;
The event used in registering objects is the &amp;lt;code&amp;gt;RegistryEvent.Register&amp;lt;T&amp;gt;&amp;lt;/code&amp;gt;, where the type parameter &amp;lt;code&amp;gt;T&amp;lt;/code&amp;gt; is the type of the object being registered. Calling &amp;lt;code&amp;gt;#getRegistry&amp;lt;/code&amp;gt; will return the registry, upon which objects are registered with &amp;lt;code&amp;gt;#register&amp;lt;/code&amp;gt; (pass it a single object that you want to register) or &amp;lt;code&amp;gt;#registerAll&amp;lt;/code&amp;gt; (pass it a list of objects).&lt;br /&gt;
&lt;br /&gt;
The latter is very useful for minimising calls to &amp;lt;code&amp;gt;#register&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here is an example: (the event handler is registered on the *mod event bus*)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
@SubscribeEvent&lt;br /&gt;
public void registerBlocks(RegistryEvent.Register&amp;lt;Block&amp;gt; event) {&lt;br /&gt;
    event.getRegistry().registerAll(new Block(...), new Block(...), ...);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Tip/Important|Some classes cannot by themselves be registered; instead, &amp;lt;code&amp;gt;*Type&amp;lt;/code&amp;gt; classes are registered, and used in the formers' constructors. For example, [[Tile_Entities|&amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt;]] has &amp;lt;code&amp;gt;TileEntityType&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;Entity&amp;lt;/code&amp;gt; has &amp;lt;code&amp;gt;EntityType&amp;lt;/code&amp;gt;. These &amp;lt;code&amp;gt;*Type&amp;lt;/code&amp;gt; classes are factories that simply create the containing type on demand.&lt;br /&gt;
&lt;br /&gt;
These factories are created through the use of their &amp;lt;code&amp;gt;*Type.Builder&amp;lt;/code&amp;gt; classes. An example: (&amp;lt;code&amp;gt;REGISTER&amp;lt;/code&amp;gt; here refers to a &amp;lt;code&amp;gt;DeferredRegister&amp;lt;TileEntityType&amp;lt;?&amp;gt;&amp;gt;&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public static final RegistryObject&amp;lt;TileEntityType&amp;lt;ExampleTile&amp;gt;&amp;gt; EXAMPLE_TILE = REGISTER.register(&lt;br /&gt;
    &amp;quot;example_tile&amp;quot;, () -&amp;gt; TileEntityType.Builder.create(ExampleTile::new, EXAMPLE_BLOCK.get()).build(null)&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Referencing Registered Objects ==&lt;br /&gt;
&lt;br /&gt;
Registered objects should not be stored in fields when they are created and registered. They are to be always newly created and registered whenever their respective &amp;lt;code&amp;gt;RegistryEvent.Register&amp;lt;/code&amp;gt; event is fired. This is to allow dynamic loading and unloading of mods in a future version of Forge.&lt;br /&gt;
&lt;br /&gt;
Registered objects must always be referenced through a &amp;lt;code&amp;gt;RegistryObject&amp;lt;/code&amp;gt; or a field with &amp;lt;code&amp;gt;@ObjectHolder&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Using RegistryObjects ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;RegistryObject&amp;lt;/code&amp;gt;s can be used to retrieve references to registered objects once they are available. These are used by &amp;lt;code&amp;gt;DeferredRegister&amp;lt;/code&amp;gt; to return a reference to registered objects. Their references are updated after their corresponding registry's &amp;lt;code&amp;gt;RegistryEvent.Register&amp;lt;/code&amp;gt; event is fired, along with the &amp;lt;code&amp;gt;@ObjectHolder&amp;lt;/code&amp;gt; annotations.&lt;br /&gt;
&lt;br /&gt;
To get a &amp;lt;code&amp;gt;RegistryObject&amp;lt;/code&amp;gt;, call &amp;lt;code&amp;gt;RegistryObject.of&amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;ResourceLocation&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;IForgeRegistry&amp;lt;/code&amp;gt; of the registrable object. Custom registries can also be used through giving a supplier of the custom object's class. Store the &amp;lt;code&amp;gt;RegistryObject&amp;lt;/code&amp;gt; in a &amp;lt;code&amp;gt;public static final&amp;lt;/code&amp;gt; field, and call &amp;lt;code&amp;gt;#get&amp;lt;/code&amp;gt; whenever you need the registered object.&lt;br /&gt;
&lt;br /&gt;
An example of using &amp;lt;code&amp;gt;RegistryObject&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public static final RegistryObject&amp;lt;Item&amp;gt; BOW = RegistryObject.of(new ResourceLocation(&amp;quot;minecraft:bow&amp;quot;), ForgeRegistries.ITEMS);&lt;br /&gt;
&lt;br /&gt;
// assume that ManaType is a valid registry, and 'neomagicae:coffeinum' is a valid object within that registry&lt;br /&gt;
public static final RegistryObject&amp;lt;ManaType&amp;gt; COFFEINUM = RegistryObject.of(new ResourceLocation(&amp;quot;neomagicae&amp;quot;, &amp;quot;coffeinum&amp;quot;), () -&amp;gt; ManaType.class); &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using @ObjectHolder ===&lt;br /&gt;
&lt;br /&gt;
Registered objects from registries can be injected into the &amp;lt;code&amp;gt;public static&amp;lt;/code&amp;gt; fields by annotating classes or fields with &amp;lt;code&amp;gt;@ObjectHolder&amp;lt;/code&amp;gt; and supplying enough information to construct a &amp;lt;code&amp;gt;ResourceLocation&amp;lt;/code&amp;gt; to identify a specific object in a specific registry.&lt;br /&gt;
&lt;br /&gt;
The rules for &amp;lt;code&amp;gt;@ObjectHolder&amp;lt;/code&amp;gt; are as follows:&lt;br /&gt;
&lt;br /&gt;
* If the class is annotated with &amp;lt;code&amp;gt;@ObjectHolder&amp;lt;/code&amp;gt;, its value will be the default namespace for all fields within if not explicitly defined&lt;br /&gt;
* If the class is annotated with &amp;lt;code&amp;gt;@Mod&amp;lt;/code&amp;gt;, the modid will be the default namespace for all annotated fields within if not explicitly defined &lt;br /&gt;
* A field is considered for injection if:&lt;br /&gt;
** it has at least the modifiers &amp;lt;code&amp;gt;public static&amp;lt;/code&amp;gt;;&lt;br /&gt;
** one of the following conditions are true:&lt;br /&gt;
*** the '''enclosing class''' has an &amp;lt;code&amp;gt;@ObjectHolder&amp;lt;/code&amp;gt; annotation, and the field is &amp;lt;code&amp;gt;final&amp;lt;/code&amp;gt;, and:&lt;br /&gt;
**** the name value is the field's name; and&lt;br /&gt;
**** the namespace value is the enclosing class's namespace&lt;br /&gt;
**** _An exception is thrown if the namespace value cannot be found and inherited_&lt;br /&gt;
*** the '''field''' is annotated with &amp;lt;code&amp;gt;@ObjectHolder&amp;lt;/code&amp;gt;, and:&lt;br /&gt;
**** the name value is explicitly defined; and&lt;br /&gt;
**** the namespace value is either explicitly defined or the enclosing class's namespace&lt;br /&gt;
** the field type or one of its supertypes corresponds to a valid registry (e.g. &amp;lt;code&amp;gt;Item&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ArrowItem&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;Item&amp;lt;/code&amp;gt; registry);&lt;br /&gt;
** ''An exception is thrown if a field does not have a corresponding registry.''&lt;br /&gt;
* ''An exception is thrown if the resulting &amp;lt;code&amp;gt;ResourceLocation&amp;lt;/code&amp;gt; is incomplete or invalid (non-valid characters in path)''&lt;br /&gt;
* If no other errors or exceptions occur, the field will be injected 7&lt;br /&gt;
* If all of the above rules do not apply, no action will be taken (and a message may be logged)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;@ObjectHolder&amp;lt;/code&amp;gt;-annotated fields are injected with their values after their corresponding registry's &amp;lt;code&amp;gt;RegistryEvent.Register&amp;lt;/code&amp;gt; event is fired, along with the &amp;lt;code&amp;gt;RegistryObject&amp;lt;/code&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Informational|content=If the object does not exist in the registry when it is to be injected, a debug message will be logged and no value will be injected.}}&lt;br /&gt;
&lt;br /&gt;
As these rules are rather complicated, here are some examples:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border: solid 2px; padding: 2px 5px; margin-top: 3px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight:bold;line-height:1.6;&amp;quot;&amp;gt;Example uses of &amp;lt;code&amp;gt;@ObjectHolder&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot; style=&amp;quot;overflow: auto; white-space: nowrap;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
@ObjectHolder(&amp;quot;minecraft&amp;quot;) // Inheritable resource namespace: &amp;quot;minecraft&amp;quot;&lt;br /&gt;
class AnnotatedHolder {&lt;br /&gt;
    public static final Block diamond_block = null; // No annotation. [public static final] is required.&lt;br /&gt;
                                                    // Block has a corresponding registry: [Block]&lt;br /&gt;
                                                    // Name path is the name of the field: &amp;quot;diamond_block&amp;quot;&lt;br /&gt;
                                                    // Namespace is not explicitly defined.&lt;br /&gt;
                                                    // So, namespace is inherited from class annotation: &amp;quot;minecraft&amp;quot;&lt;br /&gt;
                                                    // To inject: &amp;quot;minecraft:diamond_block&amp;quot; from the [Block] registry&lt;br /&gt;
&lt;br /&gt;
    @ObjectHolder(&amp;quot;ambient.cave&amp;quot;)&lt;br /&gt;
    public static SoundEvent ambient_sound = null;  // Annotation present. [public static] is required.&lt;br /&gt;
                                                    // SoundEvent has a corresponding registry: [SoundEvent]&lt;br /&gt;
                                                    // Name path is the value of the annotation: &amp;quot;ambient.cave&amp;quot;&lt;br /&gt;
                                                    // Namespace is not explicitly defined.&lt;br /&gt;
                                                    // So, namespace is inherited from class annotation: &amp;quot;minecraft&amp;quot;&lt;br /&gt;
                                                    // To inject: &amp;quot;minecraft:ambient.cave&amp;quot; from the [SoundEvent] registry&lt;br /&gt;
&lt;br /&gt;
    // Assume for the next entry that [ManaType] is a valid registry.          &lt;br /&gt;
    @ObjectHolder(&amp;quot;neomagicae:coffeinum&amp;quot;)&lt;br /&gt;
    public static final ManaType coffeinum = null;  // Annotation present. [public static] is required. [final] is optional.&lt;br /&gt;
                                                    // ManaType has a corresponding registry: [ManaType] (custom registry)&lt;br /&gt;
                                                    // Resource location is explicitly defined: &amp;quot;neomagicae:coffeinum&amp;quot;&lt;br /&gt;
                                                    // To inject: &amp;quot;neomagicae:coffeinum&amp;quot; from the [ManaType] registry&lt;br /&gt;
&lt;br /&gt;
    public static final Item ENDER_PEARL = null;    // No annotation. [public static final] is required.&lt;br /&gt;
                                                    // Item has a corresponding registry: [Item].&lt;br /&gt;
                                                    // Name path is the name of the field: &amp;quot;ENDER_PEARL&amp;quot; -&amp;gt; &amp;quot;ender_pearl&amp;quot;&lt;br /&gt;
                                                    // !! ^ Field name is valid, because they are&lt;br /&gt;
                                                    //      converted to lowercase automatically.&lt;br /&gt;
                                                    // Namespace is not explicitly defined.&lt;br /&gt;
                                                    // So, namespace is inherited from class annotation: &amp;quot;minecraft&amp;quot;&lt;br /&gt;
                                                    // To inject: &amp;quot;minecraft:ender_pearl&amp;quot; from the [Item] registry&lt;br /&gt;
&lt;br /&gt;
    @ObjectHolder(&amp;quot;minecraft:arrow&amp;quot;)&lt;br /&gt;
    public static final ArrowItem arrow = null;     // Annotation present. [public static] is required. [final] is optional.&lt;br /&gt;
                                                    // ArrowItem does not have a corresponding registry.&lt;br /&gt;
                                                    // ArrowItem's supertype of Item has a corresponding registry: [Item]&lt;br /&gt;
                                                    // Resource location is explicitly defined: &amp;quot;minecraft:arrow&amp;quot;&lt;br /&gt;
                                                    // To inject: &amp;quot;minecraft:arrow&amp;quot; from the [Item] registry                                                    &lt;br /&gt;
&lt;br /&gt;
    public static Block bedrock = null;             // No annotation, so [public static final] is required.&lt;br /&gt;
                                                    // Therefore, the field is ignored.&lt;br /&gt;
    &lt;br /&gt;
    public static final ItemGroup group = null;     // No annotation. [public static final] is required.&lt;br /&gt;
                                                    // ItemGroup does not have a corresponding registry.&lt;br /&gt;
                                                    // No supertypes of ItemGroup has a corresponding registry.&lt;br /&gt;
                                                    // Therefore, THIS WILL PRODUCE AN EXCEPTION.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class UnannotatedHolder { // Note the lack of an @ObjectHolder annotation on this class.&lt;br /&gt;
    @ObjectHolder(&amp;quot;minecraft:flame&amp;quot;)&lt;br /&gt;
    public static final Enchantment flame = null;   // Annotation present. [public static] is required. [final] is optional.&lt;br /&gt;
                                                    // Enchantment has corresponding registry: [Enchantment].&lt;br /&gt;
                                                    // Resource location is explicitly defined: &amp;quot;minecraft:flame&amp;quot;&lt;br /&gt;
                                                    // To inject: &amp;quot;minecraft:flame&amp;quot; from the [Enchantment] registry&lt;br /&gt;
&lt;br /&gt;
    public static final Biome ice_flat = null;      // No annotation on the enclosing class.&lt;br /&gt;
                                                    // Therefore, the field is ignored.&lt;br /&gt;
&lt;br /&gt;
    @ObjectHolder(&amp;quot;minecraft:creeper&amp;quot;)&lt;br /&gt;
    public static Entity creeper = null;            // Annotation present. [public static] is required.&lt;br /&gt;
                                                    // Entity does not have a corresponding registry.&lt;br /&gt;
                                                    // No supertypes of Entity has a corresponding registry.&lt;br /&gt;
                                                    // Therefore, THIS WILL PRODUCE AN EXCEPTION.&lt;br /&gt;
&lt;br /&gt;
    @ObjectHolder(&amp;quot;levitation&amp;quot;)&lt;br /&gt;
    public static final Potion levitation = null;   // Annotation present. [public static] is required. [final] is optional.&lt;br /&gt;
                                                    // Potion has a corresponding registry: [Potion].&lt;br /&gt;
                                                    // Name path is the value of the annotation: &amp;quot;levitation&amp;quot;&lt;br /&gt;
                                                    // Namespace is not explicitly defined.&lt;br /&gt;
                                                    // No annotation in enclosing class.&lt;br /&gt;
                                                    // Therefore, THIS WILL PRODUCE AN EXCEPTION.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Creating Custom Registries ==&lt;br /&gt;
&lt;br /&gt;
You might want to create a new registry for your mod. This might be usefull if you want other mods to add new things to your system. For example you might have magic spells and want to allow other mods to add new spells. For this you will want to make a registry (eg. &amp;quot;mymagicmod:spells&amp;quot;). This way other mods will be able to register things to that list and you won't have to do anything else.&lt;br /&gt;
&lt;br /&gt;
Just like with registering a new item or block you have 2 ways of making a new registry.&lt;br /&gt;
&lt;br /&gt;
=== Using RegistryEvent.NewRegistry ===&lt;br /&gt;
&lt;br /&gt;
Custom registries are created by using &amp;lt;code&amp;gt;RegistryBuilder&amp;lt;/code&amp;gt; during the &amp;lt;code&amp;gt;RegistryEvent.NewRegistry&amp;lt;/code&amp;gt; event. The class &amp;lt;code&amp;gt;RegistryBuilder&amp;lt;/code&amp;gt; takes certain parameters (such as the registry name, the &amp;lt;code&amp;gt;Class&amp;lt;/code&amp;gt; of its values, and various callbacks for different events happening on the registry). Calling &amp;lt;code&amp;gt;RegistryBuilder#create&amp;lt;/code&amp;gt; will result in the registry being built, registered to the &amp;lt;code&amp;gt;RegistryManager&amp;lt;/code&amp;gt;, and returned to the caller for additional processing.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;Class&amp;lt;/code&amp;gt; of the value of the registry must implement &amp;lt;code&amp;gt;IForgeRegistryEntry&amp;lt;/code&amp;gt;, which defines that &amp;lt;code&amp;gt;#setRegistryName&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;#getRegistryName&amp;lt;/code&amp;gt; can be called on the objects of that class. For most custom objects, is recommended to extend the default implementation of &amp;lt;code&amp;gt;ForgeRegistryEntry&amp;lt;/code&amp;gt;, instead of implementing the interface directly. When &amp;lt;code&amp;gt;#setRegistryName(String)&amp;lt;/code&amp;gt; is called with a string, and that string does not have an explicit namespace, its namespace will be set to the current modid.&lt;br /&gt;
&lt;br /&gt;
The Forge registries can be accessed through the &amp;lt;code&amp;gt;ForgeRegistries&amp;lt;/code&amp;gt; class. All registries, Forge-provided or custom, can be retrieved by calling &amp;lt;code&amp;gt;GameRegistry.findRegistry(Class)&amp;lt;/code&amp;gt; with the appropriate class for the registry. For example, the registry for &amp;lt;code&amp;gt;Block&amp;lt;/code&amp;gt;s can be retrieved by calling &amp;lt;code&amp;gt;GameRegistry.findRegistry(Block.class)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Java&amp;quot;&amp;gt;&lt;br /&gt;
@SubscribeEvent&lt;br /&gt;
public static void onNewRegistry(RegistryEvent.NewRegistry registry){&lt;br /&gt;
    RegistryBuilder&amp;lt;ArcaneFuelType&amp;gt; registryBuilder = new RegistryBuilder&amp;lt;ArcaneFuelType&amp;gt;();&lt;br /&gt;
    registryBuilder.setName(ArcaneRituals.location(&amp;quot;arcane_fuel&amp;quot;));&lt;br /&gt;
    registryBuilder.setType(ArcaneFuelType.class);&lt;br /&gt;
    registryBuilder.create();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== With DeferredRegister ===&lt;br /&gt;
&lt;br /&gt;
TODO&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Sides&amp;diff=2276</id>
		<title>Sides</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Sides&amp;diff=2276"/>
		<updated>2020-12-21T13:20:42Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: modloading process is missing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Under construction}} &amp;lt;!-- modloading process is missing --&amp;gt; &lt;br /&gt;
A very important concept to understand when modding Minecraft are the two sides: '''client''' and '''server'''. There are many, many common misconceptions and mistakes regarding siding, which can lead to bugs that might not crash the game, but can rather have unintended and often unpredictable effects.&lt;br /&gt;
&lt;br /&gt;
== Different Kinds of Sides ==&lt;br /&gt;
&lt;br /&gt;
When we say &amp;quot;client&amp;quot; or &amp;quot;server&amp;quot;, it usually follows with a fairly intuitive understanding of what part of the game we’re talking about. After all, a client is what the user interacts with, and a server is where the user connects for a multiplayer game. Easy, right?&lt;br /&gt;
&lt;br /&gt;
But because of the structure of how Minecraft works, there can be some ambiguity even with two such terms. Here we disambiguate the four possible meanings of &amp;quot;client&amp;quot; and &amp;quot;server&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
* '''Physical Client''' - The ''physical client'' is the entire program that runs whenever you launch Minecraft from the launcher. All threads, processes, and services that run during the game’s graphical, interactable lifetime are part of the physical client.&lt;br /&gt;
* '''Physical Server''' - Often known as the dedicated server, the ''physical server'' is the entire program that runs whenever you launch any dedicated server executable or JAR (&amp;lt;code&amp;gt;minecraft_server.jar&amp;lt;/code&amp;gt;) that does not bring up a playable GUI.&lt;br /&gt;
* '''Logical Server''' - The ''logical server'' is what runs game logic: mob spawning, weather, updating inventories, health, AI, and all other game mechanics. The logical server is present within the physical server, but is also can run inside a physical client together with a logical client, as a single player world. The logical server always runs in a thread named the &amp;lt;code&amp;gt;Server Thread&amp;lt;/code&amp;gt;.&lt;br /&gt;
* '''Logical Client''' - The ''logical client'' is what accepts input from the player and relays it to the logical server. In addition, it also receives information from the logical server and makes it available graphically to the player. The logical client runs in the &amp;lt;code&amp;gt;Client Thread&amp;lt;/code&amp;gt;, though often several other threads are spawned to handle things like audio and chunk render batching.&lt;br /&gt;
&lt;br /&gt;
In the Minecraft codebase, the physical sides are represented by an enum called &amp;lt;code&amp;gt;Dist&amp;lt;/code&amp;gt;, while the logical sides are represented by an enum called &amp;lt;code&amp;gt;LogicalSide&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Tip|It is guaranteed that the logical cient always runs on the physical client; however, the same cannot be said of the logical server.}}&lt;br /&gt;
&lt;br /&gt;
== Performing Side-Specific Operations ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;World#isRemote&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt; check is the most common way (and the most recommended way) to check the currently running '''logical side'''. Querying this field on a &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt; object establishes the logical side that the world belongs to. That is, if this field is &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;, the world extends &amp;lt;code&amp;gt;ClientWorld&amp;lt;/code&amp;gt; and is currently running on the logical client, while if the field is &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;, the world extends &amp;lt;code&amp;gt;ServerWorld&amp;lt;/code&amp;gt; and is running on the logical server. &lt;br /&gt;
&lt;br /&gt;
It follows that the physical/dedicated server will always contain &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; in this field, but we cannot assume that &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; implies a physical server, since this field can also be &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; for the logical server inside a physical client (in other words, a single player world).&lt;br /&gt;
&lt;br /&gt;
Use this check whenever you need to determine if game logic and other mechanics should be run. For example, if you want to damage the player every time they click your block, or have your machine process dirt into diamonds, you should only do so after ensuring &amp;lt;code&amp;gt;world.isRemote&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. Applying game logic to the logical client can cause desynchronization (ghost entities, desynchronized stats, etc.) in the best case, and crashes in the worst case.&lt;br /&gt;
&lt;br /&gt;
This check should be used as your go-to default. Aside from the sided events and &amp;lt;code&amp;gt;DistExecutor&amp;lt;/code&amp;gt;, rarely will you need the other ways of determining sides and adjusting behavior.&lt;br /&gt;
&lt;br /&gt;
=== Sided Setup Events ===&lt;br /&gt;
&lt;br /&gt;
There are different events which are fired at different stages during the [[Modloading|modloading process]]. Most of these events are fired on both physical sides, except for the '''sided setup events''': &amp;lt;code&amp;gt;FMLClientSetupEvent&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FMLDedicatedServerSetupEvent&amp;lt;/code&amp;gt;, which is fired on the physical client and the physical/dedicated server respectively.&lt;br /&gt;
&lt;br /&gt;
These events should be used for running side-specific initialization code. It is recommended to either put your sided event handler registration behind a &amp;lt;code&amp;gt;DistExecutor&amp;lt;/code&amp;gt; call, or use the &amp;lt;code&amp;gt;@Mod.EventBusSubscriber&amp;lt;/code&amp;gt; anntoation with '&amp;lt;code&amp;gt;value = Dist.CLIENT&amp;lt;/code&amp;gt; for clients (or &amp;lt;code&amp;gt;value = Dist.DEDICATED_SERVER&amp;lt;/code&amp;gt; for the dedicated server) to conditionally register your event handlers and prevent the classes referenced within from crashing upon being loaded.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;DistExecutor&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Considering the use of a single &amp;quot;universal&amp;quot; jar for client and server mods, and the separation of the physical sides into two jars, an important question comes to mind: How do we use code that is only present on one physical side? All code in &amp;lt;code&amp;gt;net.minecraft.client&amp;lt;/code&amp;gt; (such as anything rendering-related) is only present on the physical client, and all code in &amp;lt;code&amp;gt;net.minecraft.server.dedicated&amp;lt;/code&amp;gt; is only present on the physical server. &lt;br /&gt;
&lt;br /&gt;
If any class you write references those names in any way, they will crash the game when that respective class is loaded in an environment where those names do not exist. For example, a very common mistake in beginners is to call &amp;lt;code&amp;gt;Minecraft.getMinecraft().&amp;lt;doStuff&amp;gt;()&amp;lt;/code&amp;gt; in block or tile entity classes, which will crash any physical/dedicated server as soon as the class is loaded.&lt;br /&gt;
&lt;br /&gt;
How do we resolve this? Forge provides the &amp;lt;code&amp;gt;DistExecutor&amp;lt;/code&amp;gt; utility class, which provides various methods to run and call different code depending on the physical side.&lt;br /&gt;
&lt;br /&gt;
{{Tip/Important|&lt;br /&gt;
It is important to understand that &amp;lt;code&amp;gt;DistExecutor&amp;lt;/code&amp;gt; checks the '''physical''' side. A single player world (logical server + logical client within a physical client) will always use &amp;lt;code&amp;gt;Dist.CLIENT&amp;lt;/code&amp;gt;!}}&lt;br /&gt;
&lt;br /&gt;
=== Thread Groups ===&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;Thread.currentThread().getThreadGroup() == SidedThreadGroups.SERVER&amp;lt;/code&amp;gt;, it is likely the current thread is on the logical server. Otherwise, it is likely on the logical client. This is useful to retrieve the '''logical''' side when you do not have access to a &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt; object to check &amp;lt;code&amp;gt;isRemote&amp;lt;/code&amp;gt;. It ''guesses'' which logical side you are on by looking at the thread group of the currently running thread. Because it is a guess, this method should only be used when other options have been exhausted. In all other cases, you should prefer checking &amp;lt;code&amp;gt;world.isRemote&amp;lt;/code&amp;gt; to this check.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;tt&amp;gt;FMLEnvironment.dist&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;FMLEnvironment.dist&amp;lt;/code&amp;gt; holds the '''physical''' side your code is running on, as a value of &amp;lt;code&amp;gt;Dist.CLIENT&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;Dist.DEDICATED_SERVER&amp;lt;/code&amp;gt;. This is determined by the mod loading code, so it always hold the correct value. However, there is little reason to directly query this variable, as most use-cases can use &amp;lt;code&amp;gt;DistExecutor&amp;lt;/code&amp;gt; instead (which uses this value internally).&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;tt&amp;gt;@OnlyIn&amp;lt;/tt&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Annotating a method or field with the &amp;lt;code&amp;gt;@OnlyIn(Dist)&amp;lt;/code&amp;gt; annotation indicates to the loader that the respective member should be completely stripped out of the definition not on the specified '''physical''' side. Usually, these are only seen when browsing through the decompiled Minecraft code, indicating methods that the Mojang obfuscator stripped out. &lt;br /&gt;
&lt;br /&gt;
{{Tip/Important|There is little to no reason for using this annotation directly. The only valid reason to use this annotation is if you are extending a vanilla class that is already annotated with &amp;lt;code&amp;gt;@OnlyIn&amp;lt;/code&amp;gt;. In all other cases where you need to dispatch behavior based on physical sides, use &amp;lt;code&amp;gt;DistExecutor&amp;lt;/code&amp;gt; or a check on &amp;lt;code&amp;gt;FMLEnvironment.dist&amp;lt;/code&amp;gt; instead.}}&lt;br /&gt;
&lt;br /&gt;
== Common Mistakes ==&lt;br /&gt;
&lt;br /&gt;
=== Reaching Across Logical Sides ===&lt;br /&gt;
&lt;br /&gt;
Whenever you want to send information from one logical side to another, you must '''always''' use network packets. It is incredibly tempting, when in a single player scenario, to directly transfer data from the logical server to the logical client.&lt;br /&gt;
&lt;br /&gt;
This is actually very commonly inadvertently done through static fields. Since the logical client and logical server share the same JVM instance in a single player scenario, both threads writing to and reading from static fields will cause all sorts of race conditions and classical issues associated with threading.&lt;br /&gt;
&lt;br /&gt;
This mistake can also be made explicitly by accessing physical client-only classes such as &amp;lt;code&amp;gt;Minecraft&amp;lt;/code&amp;gt; from common code that runs or can run on the logical server. This mistake is easy to miss for beginners, who debug in a physical client. The code will work there, but will immediately crash on a physical server. For this reason, it is always recommended to test your mod with the physical/dedicated server.&lt;br /&gt;
&lt;br /&gt;
=== Writing One-Sided Mods ===&lt;br /&gt;
&lt;br /&gt;
Your mods are expected to always load, regardless of if they are loaded on the client or the server. For one-sided mods, this means that they must still run on the opposite physical side.&lt;br /&gt;
&lt;br /&gt;
So for one-sided mods, you would typically register your event handlers using [[#DistExecutor|&amp;lt;code&amp;gt;DistExecutor&amp;lt;/code&amp;gt;]] or ''@EventBusSubscriber(value = Dist.*)'', instead of directly calling the relevant registration methods in the constructor. The idea is that, if your mod is loaded on the wrong side, it should simply do nothing: listen to no events, do no special behaviors, and so on. A one-sided mod by nature should not register blocks, items, … since they would need to be available on the other side, too.&lt;br /&gt;
&lt;br /&gt;
Additionally, if your mod is one-sided, it typically does not forbid the user from joining a server that is lacking that mod, but the server menu will display the server as being incompatible (with a red &amp;lt;code&amp;gt;X&amp;lt;/code&amp;gt; at the side). Therefore, you should override the &amp;lt;code&amp;gt;DISPLAYTEST&amp;lt;/code&amp;gt; extension point to make sure that Forge does not think your mod is required on the server: (this is usually done in the mod constructor)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
//Make sure the mod being absent on the other network side does not cause the client to display the server as incompatible&lt;br /&gt;
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -&amp;gt; Pair.of(() -&amp;gt; FMLNetworkConstants.IGNORESERVERONLY, (a, b) -&amp;gt; true));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tells the client that it should ignore the server version being absent, and tells the server that it should not tell the client this mod should be present.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Getting_Started&amp;diff=2275</id>
		<title>Getting Started</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Getting_Started&amp;diff=2275"/>
		<updated>2020-12-21T13:11:22Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: cookbook links do not work is there an alternative?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Under construction}} &amp;lt;!-- cookbook links do not work is there an alternative? --&amp;gt;&lt;br /&gt;
= Home = &lt;br /&gt;
== Getting Started with Forge ==&lt;br /&gt;
This is a simple guide to get you from nothing to a basic mod. The rest of this documentation is about where to go from here.&lt;br /&gt;
=== From Zero to Modding ===&lt;br /&gt;
# Obtain a source distribution from forge’s [https://files.minecraftforge.net/ files] site. (Look for the MDK file type)&lt;br /&gt;
# Extract the downloaded source distribution to an empty directory. You should see a bunch of files, and an example mod is placed in &amp;lt;code&amp;gt;src/main/java&amp;lt;/code&amp;gt; for you to look at. Only a few of these files are strictly necessary for mod development, and you may reuse these files for all your projects These files are:&lt;br /&gt;
#* &amp;lt;code&amp;gt;build.gradle&amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt;gradlew.bat&amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt;gradlew&amp;lt;/code&amp;gt;&lt;br /&gt;
#* the &amp;lt;code&amp;gt;gradle&amp;lt;/code&amp;gt; folder&lt;br /&gt;
# Move the files listed above to a new folder, this will be your mod project folder.&lt;br /&gt;
# Choose your IDE:&lt;br /&gt;
#* Forge explicitly supports developing with Eclipse or IntelliJ environments, but any environment, from Netbeans to vi/emacs, can be made to work.&lt;br /&gt;
#* For both Intellij IDEA and Eclipse their Gradle integration will handle the rest of the initial workspace setup, this includes downloading packages from Mojang, MinecraftForge, and a few other software sharing sites.&lt;br /&gt;
#* For most, if not all, changes to the build.gradle file to take effect Gradle will need to be invoked to re-evaluate the project, this can be done through Refresh buttons in the Gradle panels of both the previously mentioned IDEs.&lt;br /&gt;
# Generating IDE Launch/Run Configurations:&lt;br /&gt;
#*For Eclipse, run the &amp;lt;code&amp;gt;genEclipseRuns&amp;lt;/code&amp;gt; gradle task (&amp;lt;code&amp;gt;gradlew genEclipseRuns&amp;lt;/code&amp;gt;). This will generate the Launch Configurations and download any required assets for the game to run. After this has finished refresh your project.&lt;br /&gt;
#*or IntelliJ, run the &amp;lt;code&amp;gt;genIntellijRuns&amp;lt;/code&amp;gt; gradle task (&amp;lt;code&amp;gt;gradlew genIntellijRuns&amp;lt;/code&amp;gt;). This will generate the Run Configurations and download any required assets for the game to run. After this has finished edit your Configurations to fix the “module not specified” error by changing selecting your “main” module.&lt;br /&gt;
&lt;br /&gt;
=== Customizing Your Mod Information ===&lt;br /&gt;
Edit the &amp;lt;code&amp;gt;build.gradle&amp;lt;/code&amp;gt; file to customize how your mod is built (the file names, versions, and other things).&lt;br /&gt;
&lt;br /&gt;
{{Tip/Important|'''Do not''' edit the &amp;lt;code&amp;gt;buildscript {}&amp;lt;/code&amp;gt; section of the build.gradle file, its default text is necessary for ForgeGradle to function.}}&lt;br /&gt;
&lt;br /&gt;
Almost anything underneath the &amp;lt;code&amp;gt;// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.&amp;lt;/code&amp;gt; marker can be changed, many things can be removed and customized there as well.&lt;br /&gt;
&lt;br /&gt;
There is a whole site dedicated to customizing the forge &amp;lt;code&amp;gt;build.gradle&amp;lt;/code&amp;gt; files - the [https://forgegradle.readthedocs.org/en/latest/cookbook/ ForgeGradle cookbook]. Once you’re comfortable with your mod setup, you’ll find many useful recipes there.&lt;br /&gt;
&lt;br /&gt;
==== Simple build.gradle Customizations ====&lt;br /&gt;
These customizations are highly recommended for all projects.&lt;br /&gt;
* To change the name of the file you build - edit the value of &amp;lt;code&amp;gt;archivesBaseName&amp;lt;/code&amp;gt; to suit.&lt;br /&gt;
* To change your “maven coordinates” - edit the value of &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt; as well.&lt;br /&gt;
* To change the version number - edit the value of &amp;lt;code&amp;gt;version&amp;lt;/code&amp;gt;.&lt;br /&gt;
* To update the run configurations - replace all occurrences of &amp;lt;code&amp;gt;examplemod&amp;lt;/code&amp;gt; to the mod id of your mod.&lt;br /&gt;
&lt;br /&gt;
=== Building and Testing Your Mod ===&lt;br /&gt;
# To build your mod, run &amp;lt;code&amp;gt;gradlew build&amp;lt;/code&amp;gt;. This will output a file in &amp;lt;code&amp;gt;build/libs&amp;lt;/code&amp;gt; with the name &amp;lt;code&amp;gt;[archivesBaseName]-[version].jar&amp;lt;/code&amp;gt;. This file can be placed in the &amp;lt;code&amp;gt;mods&amp;lt;/code&amp;gt; folder of a forge enabled Minecraft setup, and distributed.&lt;br /&gt;
# To test run with your mod, the easiest way is to use the run configs that were generated when you set up your project. Otherwise, you can run &amp;lt;code&amp;gt;gradlew runClient&amp;lt;/code&amp;gt;. This will launch Minecraft from the &amp;lt;code&amp;gt;&amp;lt;runDir&amp;gt;&amp;lt;/code&amp;gt; location, including your mod code. There are various customizations to this command. Consult the [https://forgegradle.readthedocs.org/en/latest/cookbook/ ForgeGradle cookbook] for more information.&lt;br /&gt;
# You can also run a dedicated server using the server run config, or &amp;lt;code&amp;gt;gradlew runServer&amp;lt;/code&amp;gt;. This will launch the Minecraft server with its GUI.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Note|content=It is always advisable to test your mod in a dedicated server environment if it is intended to run there.}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Getting Started]]&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Datageneration/Loot_Tables&amp;diff=2268</id>
		<title>Datageneration/Loot Tables</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Datageneration/Loot_Tables&amp;diff=2268"/>
		<updated>2020-12-20T22:26:26Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: WIP and it is horriable&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Under construction}}&lt;br /&gt;
Loot Tables are not so polished like the other Providers. You need need to do some work to get them to a good state.&lt;br /&gt;
&lt;br /&gt;
== Preperation ==&lt;br /&gt;
First you would need a new Class that extend the &amp;lt;code&amp;gt;LootTableProvider&amp;lt;/code&amp;gt;. In this class you would override the &amp;lt;code&amp;gt;act&amp;lt;/code&amp;gt; and optionally &amp;lt;code&amp;gt;getName&amp;lt;/code&amp;gt; Method. &lt;br /&gt;
In the &amp;lt;code&amp;gt;getName&amp;lt;/code&amp;gt; you just return the Name shown in the Logs. &lt;br /&gt;
Also you should create a abstract Method which you would override in subclasses but this is not strickly needded.&lt;br /&gt;
Also you need a Gson constant. You would create it like this &amp;lt;code&amp;gt;   private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); &amp;lt;/code&amp;gt;&lt;br /&gt;
You should also save the &amp;lt;code&amp;gt;DataGenerator&amp;lt;/code&amp;gt; for later use since you can't access from the &amp;lt;code&amp;gt;LootTableProvider&amp;lt;/code&amp;gt;. &lt;br /&gt;
Also you would need two Maps, one with the the Class witch is used to get the Lootable Resource Location in this example the Block and one the Loot Table Builder.&lt;br /&gt;
The second Map consist of a &amp;lt;code&amp;gt;ResourceLocation&amp;lt;/code&amp;gt; and the actual &amp;lt;code&amp;gt;LootTable&amp;lt;/code&amp;gt;. Look at the Code for more info.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();&lt;br /&gt;
&lt;br /&gt;
  protected final Map&amp;lt;Block, LootTable.Builder&amp;gt; lootTables = new HashSet&amp;lt;&amp;gt;();&lt;br /&gt;
  public static Map&amp;lt;ResourceLocation, LootTable&amp;gt; tables = new HashMap&amp;lt;&amp;gt;();&lt;br /&gt;
  protected final DataGenerator generator;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also you would need a Function to save the Tables&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  private void writeTables(DirectoryCache cache, Map&amp;lt;ResourceLocation, LootTable&amp;gt; tables) {&lt;br /&gt;
    Path outputFolder = this.generator.getOutputFolder();&lt;br /&gt;
    tables.forEach((key, lootTable) -&amp;gt; {&lt;br /&gt;
      Path path = outputFolder.resolve(&amp;quot;data/&amp;quot; + key.getNamespace() + &amp;quot;/loot_tables/&amp;quot; + key.getPath() + &amp;quot;.json&amp;quot;);&lt;br /&gt;
      try {&lt;br /&gt;
        IDataProvider.save(GSON, cache, LootTableManager.toJson(lootTable), path);&lt;br /&gt;
      } catch (IOException e) {&lt;br /&gt;
        LOGGER.error(&amp;quot;Couldn't write loot table {}&amp;quot;, path, (Object) e);&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the writeTables method you would need to convert the First Map to the second map, for this we need to iterate over the first map.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
    lootTables.forEach(blockBuilderMap -&amp;gt; {&lt;br /&gt;
      for (Map.Entry&amp;lt;Block, LootTable.Builder&amp;gt; entry : blockBuilderMap.entrySet()) {&lt;br /&gt;
        tables.put(entry.getKey().getLootTable(), entry.getValue().build());&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in the act Method you would then first call the Method where you create the tables or just create them in there (if you do you can ignore the next section), then you would convert the Tables and at last you would save the loottables.&lt;br /&gt;
&lt;br /&gt;
== The actual Class for Lootables ==&lt;br /&gt;
=== Another class (Optional) ===&lt;br /&gt;
Create a new class that extends from the Class you created in the Section above and override the abstract function in there you can begin to create your Lootables&lt;br /&gt;
&lt;br /&gt;
=== The LootPool Builder ===&lt;br /&gt;
This is where the magic happens /s.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=DynamicOps&amp;diff=2249</id>
		<title>DynamicOps</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=DynamicOps&amp;diff=2249"/>
		<updated>2020-12-19T09:07:48Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Corret Link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;code&amp;gt;DynamicOps&amp;lt;/code&amp;gt; is a helper interface that's used to convert files into data types and vice versa. Their usages will probably never be explored by most modders. They are overshadowed by [[codecs]].&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;NBTDynamicOps&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;NBTDynamicOps&amp;lt;/code&amp;gt; is a handler that converts an NBT file to an &amp;lt;code&amp;gt;INBT&amp;lt;/code&amp;gt; tag. They are also used to parse information from codecs to send them across networks.&lt;br /&gt;
&lt;br /&gt;
There is only one public instance of &amp;lt;code&amp;gt;NBTDynamicOps&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;INSTANCE&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;JsonOps&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;JsonOps&amp;lt;/code&amp;gt; are similar in which they convert a JSON file into a &amp;lt;code&amp;gt;JsonElement&amp;lt;/code&amp;gt;. These are usually used in conjunction with codecs as well to serialize/deserialize instances.&lt;br /&gt;
&lt;br /&gt;
There are two public instances of &amp;lt;code&amp;gt;JsonOps&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;INSTANCE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;COMPRESSED&amp;lt;/code&amp;gt;. Compressed data is represented as a single string to read/write. However, this is never used within vanilla itself.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Recipes&amp;diff=2248</id>
		<title>Recipes</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Recipes&amp;diff=2248"/>
		<updated>2020-12-19T08:52:28Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: removed old Block&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;With the update to Minecraft 1.12, Mojang introduced a new data-driven recipe system based on JSON files. Since then it has been adopted by Forge as well and was expanded in Minecraft 1.13 into [https://mcforge.readthedocs.io/en/latest/utilities/recipes/datapacks.md datapacks]. &amp;lt;!-- needs wiki page --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Loading Recipes ==&lt;br /&gt;
Forge will load all recipes which can be found within the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;./data/&amp;lt;modid&amp;gt;/recipes/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; folder. You can call these files whatever you want, thought the vanilla convention is to name them after the output item. For multiple recipes from different sources (Smelting, Crafting, etc) one vanilla convention is to use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;item_name_from_smelting.json&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. This name is also used as the registration key, but does not affect the operation of the recipe.&lt;br /&gt;
&lt;br /&gt;
== The Recipe file ==&lt;br /&gt;
A basic recipe file might look like the following example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;type&amp;quot;: &amp;quot;minecraft:crafting_shaped&amp;quot;,&lt;br /&gt;
    &amp;quot;pattern&amp;quot;:&lt;br /&gt;
    [&lt;br /&gt;
        &amp;quot;xxa&amp;quot;,&lt;br /&gt;
        &amp;quot;x x&amp;quot;,&lt;br /&gt;
        &amp;quot;xxx&amp;quot;&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;key&amp;quot;:&lt;br /&gt;
    {&lt;br /&gt;
        &amp;quot;x&amp;quot;:&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;tag&amp;quot;: &amp;quot;forge:gems/diamond&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;a&amp;quot;:&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;item&amp;quot;: &amp;quot;mymod:myfirstitem&amp;quot;,&lt;br /&gt;
        }&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;result&amp;quot;:&lt;br /&gt;
    {&lt;br /&gt;
        &amp;quot;item&amp;quot;: &amp;quot;mymod:myitem&amp;quot;,&lt;br /&gt;
        &amp;quot;count&amp;quot;: 9,&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{Colored box|title=Tip|content=When you first obtain an ingredient to a vanilla recipe it will automatically unlock the recipe in the recipe book. To achieve the same effect, you have to use the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Advancement&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; system and create a new &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Advancement&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for each of your ingredients.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The advancement has to exist. This doesn’t mean it has to be visible in the advancement tree.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Type ===&lt;br /&gt;
The type of a recipe with the type field. You can think of this as the definition of which crafting layout is to be used, for example &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;minecraft:crafting_shaped&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;minecraft:crafting_shapeless&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Groups ===&lt;br /&gt;
Optionally you can add a group to your recipes to be displayed within the recipe helper interface. All recipes with the same group String will be shown in the same group. For example, this can be used to have all door recipes shown in the recipe helper interface as a single entry, even though there are different types of doors.&lt;br /&gt;
&lt;br /&gt;
== Types of crafting recipes ==&lt;br /&gt;
Within this section we will take a closer look on the differences between defining a shaped and a shapeless crafting recipe.&lt;br /&gt;
&lt;br /&gt;
=== Shaped crafting ===&lt;br /&gt;
Shaped recipes require the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;pattern&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;key&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; keywords. A pattern defines the slot an item must appear in using placeholder characters. You can choose whatever character you want to be a placeholder for an item. Keys on the other hand define what items are to be used instead of the placeholders. A key is defined by a placeholder character and the item.&lt;br /&gt;
&lt;br /&gt;
=== Shapeless crafting ===&lt;br /&gt;
A shapeless recipe doesn’t make use of the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;pattern&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;key&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; keywords.&lt;br /&gt;
&lt;br /&gt;
To define a shapeless recipe, you have to use the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ingredients&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; list. It defines which items have to be used for the crafting process. There are many more of these types which can be used here and you can even register your own. It is even possible to define multiple instances of the same item which means multiple of these items have to be in place for the crafting recipe to take place.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Tip|content=While there is no limit on how many ingredients your recipe requires the vanilla crafting table does only allow 9 items to be placed for each crafting recipe.}}&lt;br /&gt;
The following example shows how an ingredient list looks like within JSON.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;quot;ingredients&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;tag&amp;quot;: &amp;quot;forge:gems/diamond&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;item&amp;quot;: &amp;quot;minecraft:nether_star&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Recipe Elements ==&lt;br /&gt;
&lt;br /&gt;
=== Patterns ===&lt;br /&gt;
A pattern will be defined with the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;pattern&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; list. Each string represents one row in the crafting grid and each placeholder character within the String represents a column. As seen in the example above a space means that no item needs to be inserted at that position.&lt;br /&gt;
&lt;br /&gt;
=== Keys ===&lt;br /&gt;
A key set is used in combination with patterns and contains keys whose name is the same as the placeholder character in the pattern list which it represents. One key may be defined to represent multiply items as it is the case for the wooden button. This means that the player can use one of the defined items for the crafting recipe, for example different types of wood.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;quot;key&amp;quot;: {&lt;br /&gt;
     &amp;quot;#&amp;quot;: [&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;item&amp;quot;: &amp;quot;minecraft:oak_planks&amp;quot;&lt;br /&gt;
      },&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;item&amp;quot;: &amp;quot;minecraft:spruce_planks&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Results ===&lt;br /&gt;
&lt;br /&gt;
Every &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;recipe&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; has to have a result tag to define the output item.&lt;br /&gt;
&lt;br /&gt;
When crafting something, you can get out more than one item. This is achieved by defining the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;count&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; number. If this is left out, meaning it doesn’t exist within the result block, it defaults to 1. Negative values are not allowed here as an Itemstack cannot be smaller than 0. There is no option to use the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;count&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; number anywhere else than for the result.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Debug_Profiler&amp;diff=2247</id>
		<title>Debug Profiler</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Debug_Profiler&amp;diff=2247"/>
		<updated>2020-12-19T08:38:16Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: update Block to Colored Box&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Minecraft provides a Debug Profiler that can be used to find time consuming code. Specially considering things like TickEvents and Ticking TileEntities this can be very useful for modders and server owners that want to find a lag source.&lt;br /&gt;
&lt;br /&gt;
== Using the Debug Profiler ==&lt;br /&gt;
&lt;br /&gt;
The Debug Profiler is very simple to use. It requires two commands &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;/debug start&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, which starts the profiling process, and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;/debug stop&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, which ends it. The important part here is that the more time you give it to collect the data the better the results will be. It is recommended to at least let it collect data for a minute.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Tip|content=Naturally, you can only profile code paths that are actually being reached. Entities and TileEntities that you want to profile must exist in the world to show up in the results.}}&lt;br /&gt;
&lt;br /&gt;
After you’ve stopped the debugger it will create a new file, it can be found within the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;debug&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; subdirectory in your run directory. The file name will be formatted with the date and time as &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;profile-results-yyyy-mm-dd_hh.mi.ss.txt&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Reading a Profiling result ==&lt;br /&gt;
&lt;br /&gt;
At the top it first tells you how long in milliseconds it was running and how many ticks ran in that time.&lt;br /&gt;
&lt;br /&gt;
Below that, you will find information similar to the snippet below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
[00] levels - 96.70%/96.70%&lt;br /&gt;
[01] |   World Name - 99.76%/96.47%&lt;br /&gt;
[02] |   |   tick - 99.31%/95.81%&lt;br /&gt;
[03] |   |   |   entities - 47.72%/45.72%&lt;br /&gt;
[04] |   |   |   |   regular - 98.32%/44.95%&lt;br /&gt;
[04] |   |   |   |   blockEntities - 0.90%/0.41%&lt;br /&gt;
[05] |   |   |   |   |   unspecified - 64.26%/0.26%&lt;br /&gt;
[05] |   |   |   |   |   minecraft:furnace - 33.35%/0.14%&lt;br /&gt;
[05] |   |   |   |   |   minecraft:chest - 2.39%/0.01%&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a small explanation of what each part means&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
! [02]  !! tick  !! 99.31%  !! 95.81%  &lt;br /&gt;
|-&lt;br /&gt;
|  The Depth of the section  ||  The Name of the Section  ||  The percentage of time it took in relation to it’s parent. For Layer 0 it’s the percentage of the time a tick takes, while for Layer 1 it’s the percentage of the time its parent takes  ||  The second Percentage tells you how much Time it took from the entire tick. &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Profiling your own code ==&lt;br /&gt;
&lt;br /&gt;
The Debug Profiler has basic support for &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Entity&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;TileEntity&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. If you would like to profile something else, you may need to manually create your sections like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Java&amp;quot;&amp;gt;&lt;br /&gt;
  Profiler#startSection(yourSectionName : String);&lt;br /&gt;
  ''The code you want to profile&lt;br /&gt;
  Profiler#endSection();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can obtain the the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Profiler&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; instance from a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;World&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;MinecraftServer&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Minecraft&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; instance. Now you just need to search the File for your section name.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Block_Entities&amp;diff=2246</id>
		<title>Block Entities</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Block_Entities&amp;diff=2246"/>
		<updated>2020-12-19T08:33:01Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: update the Blocks with the Cplored Box&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Tile entities are like simplified entities that are bound to a &amp;lt;code&amp;gt;Block&amp;lt;/code&amp;gt;. They are used to store dynamic data, execute tick based tasks and for dynamic rendering. Some examples from vanilla Minecraft would be: handling of inventories (chests), smelting logic on furnaces, or area effects for beacons. More advanced examples exist in mods, such as quarries, sorting machines, pipes, and displays.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Tip|content=A &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; isn’t a solution for everything, and they can cause lag when used wrongly. When possible, try to avoid them.}}&lt;br /&gt;
&lt;br /&gt;
== Creating a &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In order to create a &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; you need to extend the &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; class. To register it, listen for the appropriate registry event and create a &amp;lt;code&amp;gt;TileEntityType&amp;lt;/code&amp;gt;: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
@SubscribeEvent&lt;br /&gt;
public static void registerTE(RegistryEvent.Register&amp;lt;TileEntityType&amp;lt;?&amp;gt;&amp;gt; evt) {&lt;br /&gt;
  TileEntityType&amp;lt;?&amp;gt; type = TileEntityType.Builder.create(factory, validBlocks).build(null);&lt;br /&gt;
  type.setRegistryName(&amp;quot;examplemod&amp;quot;, &amp;quot;myte&amp;quot;);&lt;br /&gt;
  evt.getRegistry().register(type);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
You can also use a &amp;lt;code&amp;gt;DeferredRegister&amp;lt;/code&amp;gt; instead.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public static final DeferredRegister&amp;lt;TileEntityType&amp;lt;?&amp;gt;&amp;gt; TILE_ENTITIES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, &amp;quot;examplemod&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
public static final RegistryObject&amp;lt;TileEntityType&amp;lt;?&amp;gt;&amp;gt; MY_TE = TILE_ENTITIES.register(&amp;quot;myte&amp;quot;, () -&amp;gt; TileEntityType.Builder.create(factory, validBlocks).build(null));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, &amp;lt;code&amp;gt;factory&amp;lt;/code&amp;gt; is a function that creates a new instance of your &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt;. A method reference or a lambda is commonly used. The variable &amp;lt;code&amp;gt;validBlocks&amp;lt;/code&amp;gt; is one or more blocks (&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;TileEntityType$Builder::create&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is varargs) that the tile entity can exist for.&lt;br /&gt;
&lt;br /&gt;
== Attaching a &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; to a &amp;lt;code&amp;gt;Block&amp;lt;/code&amp;gt; ==&lt;br /&gt;
To attach your new &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; to a &amp;lt;code&amp;gt;Block&amp;lt;/code&amp;gt; you need to override 2 (two) methods within the &amp;lt;code&amp;gt;Block&amp;lt;/code&amp;gt; class.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
IForgeBlock#hasTileEntity(BlockState state)&lt;br /&gt;
&lt;br /&gt;
IForgeBlock#createTileEntity(BlockState state, IBlockReader world)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Using the parameters you can choose if the block should have a &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; or not. Usually you will return true in the first method and a new instance of your &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; in the second method.&lt;br /&gt;
&lt;br /&gt;
== Storing Data within your &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; ==&lt;br /&gt;
In order to save data, override the following two methods &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
TileEntity#write(CompoundNBT nbt)&lt;br /&gt;
&lt;br /&gt;
TileEntity#read(BlockState state, CompoundNBT nbt)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods are called whenever the &amp;lt;code&amp;gt;Chunk&amp;lt;/code&amp;gt; containing the &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; gets loaded from/saved to NBT. Use them to read and write to the fields in your tile entity class.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Tip|content=Whenever your data changes you need to call &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;TileEntity#markDirty()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, otherwise the &amp;lt;code&amp;gt;Chunk&amp;lt;/code&amp;gt; containing your &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; might be skipped while the world is saved.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Important|content=It is important that you call the super methods!&lt;br /&gt;
&lt;br /&gt;
The tag names &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;y&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;z&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ForgeData&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ForgeCaps&amp;lt;/code&amp;gt; are reserved by the super methods.}}&lt;br /&gt;
&lt;br /&gt;
== Ticking &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; ==&lt;br /&gt;
If you need a ticking &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt;, for example to keep track of the progress during a smelting process, you need to add the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ITickableTileEntity&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; interface to your &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt;. Now you can implement all your calculations within&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
ITickableTileEntity#tick()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Tip|content=This method is called each tick. Therefore, you should avoid having complicated calculations in here. If possible, you should make more complex calculations just every X ticks. (The amount of ticks in a second may be lower than 20 (twenty) but won’t be higher)}}&lt;br /&gt;
&lt;br /&gt;
== Synchronizing the Data to the Client ==&lt;br /&gt;
There are 3 (three) ways of syncing data to the client. Synchronizing on chunk load, synchronizing on block updates and synchronizing with a custom network message.&lt;br /&gt;
=== Synchronizing on chunk load  ===&lt;br /&gt;
For this you need to override &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
TileEntity#getUpdateTag()&lt;br /&gt;
&lt;br /&gt;
IForgeTileEntity#handleUpdateTag(BlockState state, CompoundNBT tag)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Again, this is pretty simple, the first method collects the data that should be send to the client, while the second one processes that data. If your &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; doesn’t contain much data you might be able to use the methods out of the [[#storing_data|Storing Data]] section.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Important|content=Synchronizing excessive/useless data for tile entities can lead to network congestion. You should optimize your network usage by sending only the information the client needs when the client needs it. For instance, it is more often than not unnecessary to send the inventory of a tile entity in the update tag, as this can be synchronized via its GUI.)}}&lt;br /&gt;
&lt;br /&gt;
=== Synchronizing on block update  ===&lt;br /&gt;
This method is a bit more complicated, but again you just need to override 2 methods. Here is a tiny example implementation of it &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
@Override&lt;br /&gt;
public SUpdateTileEntityPacket getUpdatePacket(){&lt;br /&gt;
    CompoundNBT nbtTag = new CompoundNBT();&lt;br /&gt;
    //Write your data into the nbtTag&lt;br /&gt;
    return new SUpdateTileEntityPacket(getPos(), -1, nbtTag);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@Override&lt;br /&gt;
public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt){&lt;br /&gt;
    CompoundNBT tag = pkt.getNbtCompound();&lt;br /&gt;
    //Handle your Data&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The Constructor of &amp;lt;code&amp;gt;SUpdateTileEntityPacket&amp;lt;/code&amp;gt; takes:&lt;br /&gt;
* The position of your &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt;.&lt;br /&gt;
* An ID, though it isn’t really used besides by Vanilla, therefore you can just put a -1 in there.&lt;br /&gt;
* An &amp;lt;code&amp;gt;CompoundNBT&amp;lt;/code&amp;gt; which should contain your data.&lt;br /&gt;
&lt;br /&gt;
Now, to send the packet, an update notification must be given on the server. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
World#notifyBlockUpdate(BlockPos pos, BlockState oldState, BlockState newState, int flags)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;pos&amp;lt;/code&amp;gt; should be your &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt;’s position. For &amp;lt;code&amp;gt;oldState&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;newState&amp;lt;/code&amp;gt; you can pass the current &amp;lt;code&amp;gt;BlockState&amp;lt;/code&amp;gt; at that position. The &amp;lt;code&amp;gt;flags&amp;lt;/code&amp;gt; are a bitmask and should contain &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;, which will sync the changes to the client. See &amp;lt;code&amp;gt;Constants$BlockFlags&amp;lt;/code&amp;gt; for more info as well as the rest of the flags. The flag &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; is equivalent to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Constants$BlockFlags#BLOCK_UPDATE&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Synchronizing using a custom network message ===&lt;br /&gt;
&lt;br /&gt;
This way of synchronizing is probably the most complicated one, but is usually also the most optimized one, as you can make sure that only the data you need to be synchronized is actually synchronized. You should first check out the &amp;lt;code&amp;gt;[[latest:advanced:networking:start|Networking]]&amp;lt;/code&amp;gt; section and especially &amp;lt;code&amp;gt;[[latest:advanced:networking:simplechannel|SimpleImpl]]&amp;lt;/code&amp;gt; before attempting this. Once you’ve created your custom network message, you can send it to all users that have the &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; loaded with: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
SimpleChannel#send(PacketDistributor.TRACKING_CHUNK.with(() -&amp;gt; chunk), MSG);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{Colored box|title=Alert|content=It is important that you do safety checks, the TileEntity might already be destroyed/replaced when the message arrives at the player! You should also check if the area is loaded using (&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;World#isAreaLoaded(BlockPos, int)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;)}}&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Datageneration/I18n&amp;diff=2214</id>
		<title>Datageneration/I18n</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Datageneration/I18n&amp;diff=2214"/>
		<updated>2020-11-11T21:04:10Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Creation short but the most important info should be there&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Lang Files can be generated by creating an extension of the File &amp;lt;code&amp;gt;LangurageProvider&amp;lt;/code&amp;gt; class. From there you can add the Translations in the &amp;lt;code&amp;gt;addTranslations&amp;lt;/code&amp;gt; Method, you must override.&lt;br /&gt;
&lt;br /&gt;
To add a Translation you call the &amp;lt;code&amp;gt;LanguageProvider#add&amp;lt;/code&amp;gt; method, this method takes the [[Internationalization|translation key]] and a String which is the displayname for the key.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Access_Transformers&amp;diff=2213</id>
		<title>Access Transformers</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Access_Transformers&amp;diff=2213"/>
		<updated>2020-11-11T15:58:30Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: changed old Block to new Colored box&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Access Transformers are Forge's native way of allowing you to access (read &amp;lt;code&amp;gt;and &amp;lt;/code&amp;gt;write) functions that have a lower-than-ideal visibility, and/or removing finality.&lt;br /&gt;
&lt;br /&gt;
== Visibility ==&lt;br /&gt;
&lt;br /&gt;
Here's a quick rundown of the visibility options offered by Java 8:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;public&amp;lt;/code&amp;gt; visible to all classes inside and outside its package&lt;br /&gt;
* &amp;lt;code&amp;gt;protected&amp;lt;/code&amp;gt; visible only to classes inside the package and subclasses&lt;br /&gt;
* &amp;lt;code&amp;gt;default&amp;lt;/code&amp;gt; visible only to classes inside the package&lt;br /&gt;
* &amp;lt;code&amp;gt;private&amp;lt;/code&amp;gt; visible only to inside the class&lt;br /&gt;
&lt;br /&gt;
Additionally, there are final variants of each of these, each represented by the phrase &amp;quot;-f&amp;quot; on the end of the access specifier.&lt;br /&gt;
&lt;br /&gt;
== How It Works ==&lt;br /&gt;
&lt;br /&gt;
As Forge is loading, it scans the jar file for the META-INF/accesstransformers.cfg file. if it's found, it is parsed according to the specification:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code -&amp;gt;&lt;br /&gt;
NewAccessSpecifier MemberSignature # comment&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A random example to understand the syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code -&amp;gt;&lt;br /&gt;
public net.minecraft.util.palette.IResizeCallback # makes IResizeCallback public&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a valid entry is found on a line, Forge will look into the bytecode of the file where that member is defined, and change its access to whatever you desire it to be.&lt;br /&gt;
&lt;br /&gt;
This startup modification means accessing is O(1) for all accesses after this initial change, which makes it a great option for performance if you're looking at something a &amp;lt;code&amp;gt;lot.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using Access Transformers in your mod ==&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Important|content=You should avoid using ATs if a private variable / function you're looking at has a getter or a setter. Variables are usually private for a reason.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 1: Uncomment the access transformer line in your build.gradle&lt;br /&gt;
&lt;br /&gt;
[[File:Access-transformers-uncomment-this-line-in-build-gradle.png|600px|frameless]]&lt;br /&gt;
&lt;br /&gt;
Step 2: Create a new file called &amp;quot;accesstransformer.cfg&amp;quot; in the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;src/main/resources/META-INF/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
Step 3: Refresh the Gradle project. This can be done natively in IDEA and Eclipse.&lt;br /&gt;
&lt;br /&gt;
== When not to use Access Transformers ==&lt;br /&gt;
* Unnecessary access transformations (e.g. using ATs to make something &amp;lt;code&amp;gt;public&amp;lt;/code&amp;gt; when it's already &amp;lt;code&amp;gt;public&amp;lt;/code&amp;gt;)&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Datageneration/Tags&amp;diff=2199</id>
		<title>Datageneration/Tags</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Datageneration/Tags&amp;diff=2199"/>
		<updated>2020-11-05T14:39:39Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: some style fixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Under construction}}&lt;br /&gt;
&lt;br /&gt;
Tags can be generated by extending the &amp;lt;code&amp;gt;ItemTagsProvider&amp;lt;/code&amp;gt; for Items or &amp;lt;code&amp;gt;BlockTagsProvider&amp;lt;/code&amp;gt; for Blocks. For Custom Objects you would need to expand &amp;lt;code&amp;gt;TagsProvider&amp;lt;/code&amp;gt; and give it the Object you want tags for. For the registration of you Tags you need to override the &amp;lt;code&amp;gt;TagsProvider#registerTags&amp;lt;/code&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Information|content=You can still use &amp;lt;code&amp;gt;TagsProvider&amp;lt;/code&amp;gt; for Items and Blocks but you would need to implement a lot of stuff that is already done in &amp;lt;code&amp;gt;ItemTagsProvider&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;BlockTagsProvider&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Items/Blocks==&lt;br /&gt;
First you should make a &amp;lt;code&amp;gt;ITag.INamedTag&amp;lt;/code&amp;gt;(NamedTag) with &amp;lt;code&amp;gt;ItemTags#makeWrapperTag&amp;lt;/code&amp;gt; for Items or &amp;lt;code&amp;gt;BlockTags#makeWrapperTag&amp;lt;/code&amp;gt; for blocks, this will take the name of you Tag, see [[Tags#Conventions]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 for more info. After you have the &amp;lt;code&amp;gt;NamedTag&amp;lt;/code&amp;gt; you can start with the actual creation of the Tag, you would first call &amp;lt;code&amp;gt;TagsProvider#getOrCreateBuilder&amp;lt;/code&amp;gt; which takes the NamedTag as an Argument, this returns a &amp;lt;code&amp;gt;TagsProvider.Builder&amp;lt;/code&amp;gt;. Now you can with &amp;lt;code&amp;gt;TagsProvider.Builder#add&amp;lt;/code&amp;gt; add one or more Items/Blocks or other Tags to your own Tags. &lt;br /&gt;
&lt;br /&gt;
Example for an Item Tag:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
ITag.INamedTag&amp;lt;Item&amp;gt; copperTag = ItemTags.makeWrapperTag(&amp;quot;forge:ore/copper&amp;quot;);&lt;br /&gt;
getOrCreateBuilder(copperTag).add(Init.COPPER_ORE_ITEM.get());&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Custom Type for Tags==&lt;br /&gt;
TBD&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Datageneration/Tags&amp;diff=2198</id>
		<title>Datageneration/Tags</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Datageneration/Tags&amp;diff=2198"/>
		<updated>2020-11-05T14:38:22Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: added {{Under construction}}&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;color: rgb(220, 221, 222); --darkreader-inline-color:#d3cfc9;&amp;quot; andale=&amp;quot;&amp;quot; mono=&amp;quot;&amp;quot; wt&amp;quot;,=&amp;quot;&amp;quot; &amp;quot;andale=&amp;quot;&amp;quot; mono&amp;quot;,=&amp;quot;&amp;quot; &amp;quot;lucida=&amp;quot;&amp;quot; console&amp;quot;,=&amp;quot;&amp;quot; sans=&amp;quot;&amp;quot; typewriter&amp;quot;,=&amp;quot;&amp;quot; &amp;quot;dejavu=&amp;quot;&amp;quot; &amp;quot;bitstream=&amp;quot;&amp;quot; vera=&amp;quot;&amp;quot; &amp;quot;liberation=&amp;quot;&amp;quot; &amp;quot;nimbus=&amp;quot;&amp;quot; l&amp;quot;,=&amp;quot;&amp;quot; monaco,=&amp;quot;&amp;quot; &amp;quot;courier=&amp;quot;&amp;quot; new&amp;quot;,=&amp;quot;&amp;quot; courier,=&amp;quot;&amp;quot; monospace;=&amp;quot;&amp;quot; font-size:=&amp;quot;&amp;quot; 13.6px;=&amp;quot;&amp;quot; font-style:=&amp;quot;&amp;quot; normal;=&amp;quot;&amp;quot; font-variant-ligatures:=&amp;quot;&amp;quot; font-variant-caps:=&amp;quot;&amp;quot; font-weight:=&amp;quot;&amp;quot; 400;=&amp;quot;&amp;quot; letter-spacing:=&amp;quot;&amp;quot; orphans:=&amp;quot;&amp;quot; 2;=&amp;quot;&amp;quot; text-align:=&amp;quot;&amp;quot; start;=&amp;quot;&amp;quot; text-indent:=&amp;quot;&amp;quot; 0px;=&amp;quot;&amp;quot; text-transform:=&amp;quot;&amp;quot; none;=&amp;quot;&amp;quot; white-space:=&amp;quot;&amp;quot; pre-wrap;=&amp;quot;&amp;quot; widows:=&amp;quot;&amp;quot; word-spacing:=&amp;quot;&amp;quot; -webkit-text-stroke-width:=&amp;quot;&amp;quot; background-color:=&amp;quot;&amp;quot; rgb(47,=&amp;quot;&amp;quot; 49,=&amp;quot;&amp;quot; 54);=&amp;quot;&amp;quot; text-decoration-style:=&amp;quot;&amp;quot; initial;=&amp;quot;&amp;quot; text-decoration-color:=&amp;quot;&amp;quot; display:=&amp;quot;&amp;quot; inline=&amp;quot;&amp;quot; !important;=&amp;quot;&amp;quot; float:=&amp;quot;&amp;quot; none;&amp;quot;=&amp;quot;&amp;quot; data-darkreader-inline-color=&amp;quot;&amp;quot;&amp;gt;{{Under construction}}&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;style data-mw-deduplicate=&amp;quot;TemplateStyles:r2197&amp;quot;&amp;gt;.mw-parser-output .mw-tpl-construction{display:flex;align-items:center;width:75%;margin:auto;border-radius:0.2em;background:rgb(27,32,35);box-shadow:0 0 0.2em #999999;overflow:auto}.mw-parser-output .mw-tpl-construction-title{color:#FFFFFF;font-size:120%;font-weight:bold;padding:0.25em 1em}.mw-parser-output .mw-tpl-construction-title-icon{float:left;opacity:0.8;margin:1em}.mw-parser-output .mw-tpl-construction-content{padding:0.5em 1em 0.5em 1em;color:#FFFFFF}&amp;lt;/style&amp;gt;&amp;lt;style class=&amp;quot;darkreader darkreader--sync&amp;quot; media=&amp;quot;screen&amp;quot;&amp;gt;&amp;lt;/style&amp;gt;&amp;lt;img alt=&amp;quot;&amp;quot; src=&amp;quot;/images/d/dc/Under_construction.svg&amp;quot; class=&amp;quot;mw-tpl-construction-title-icon&amp;quot; width=&amp;quot;60&amp;quot; height=&amp;quot;60&amp;quot;&amp;gt;This page is under construction.This page is incomplete, and needs more work. Feel free to edit and improve this page!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tags can be generated by extending the &amp;lt;code&amp;gt;ItemTagsProvider&amp;lt;/code&amp;gt; for Items or &amp;lt;code&amp;gt;BlockTagsProvider&amp;lt;/code&amp;gt; for Blocks. For Custom Objects you would need to expand &amp;lt;code&amp;gt;TagsProvider&amp;lt;/code&amp;gt; and give it the Object you want tags for. For the registration of you Tags you need to override the &amp;lt;code&amp;gt;TagsProvider#registerTags&amp;lt;/code&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Information|content=You can still use &amp;lt;code&amp;gt;TagsProvider&amp;lt;/code&amp;gt; for Items and Blocks but you would need to implement a lot of stuff that is already done in &amp;lt;code&amp;gt;ItemTagsProvider&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;BlockTagsProvider&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;style data-mw-deduplicate=&amp;quot;TemplateStyles:r2068&amp;quot;&amp;gt;.mw-parser-output .mw-tpl-colorbox{box-sizing:border-box;margin:0.5em 0.5em 1em 0.5em;border-radius:0.2em;background:rgb(27,32,35);box-shadow:0 0 0.2em #999999}.mw-parser-output .mw-tpl-colorbox-title{background:rgb(0,71,127);color:#FFFFFF;border-radius:0.2em 0.2em 0 0;padding:0.5em 1em 0.5em 1em}.mw-parser-output .mw-tpl-colorbox-title-icon{opacity:0.8}.mw-parser-output .mw-tpl-colorbox-title-corner{float:right;font-size:0.7em}.mw-parser-output .mw-tpl-colorbox-content{padding:0.5em 1em 0.5em 1em;color:#FFFFFF}&amp;lt;/style&amp;gt;&amp;lt;style class=&amp;quot;darkreader darkreader--sync&amp;quot; media=&amp;quot;screen&amp;quot;&amp;gt;&amp;lt;/style&amp;gt;&amp;lt;strong style=&amp;quot;&amp;quot;&amp;gt;Information&amp;lt;/strong&amp;gt;You can still use &amp;lt;code&amp;gt;TagsProvider&amp;lt;/code&amp;gt; for Items and Blocks but you would need to implement a lot of stuff that is already done in &amp;lt;code&amp;gt;ItemTagsProvider&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;BlockTagsProvider&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Items/Blocks==&lt;br /&gt;
First you should make a &amp;lt;code&amp;gt;ITag.INamedTag&amp;lt;/code&amp;gt;(NamedTag) with &amp;lt;code&amp;gt;ItemTags#makeWrapperTag&amp;lt;/code&amp;gt; for Items or &amp;lt;code&amp;gt;BlockTags#makeWrapperTag&amp;lt;/code&amp;gt; for blocks, this will take the name of you Tag, see [[Tags#Conventions]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 for more info. After you have the &amp;lt;code&amp;gt;NamedTag&amp;lt;/code&amp;gt; you can start with the actual creation of the Tag, you would first call &amp;lt;code&amp;gt;TagsProvider#getOrCreateBuilder&amp;lt;/code&amp;gt; which takes the NamedTag as an Argument, this returns a &amp;lt;code&amp;gt;TagsProvider.Builder&amp;lt;/code&amp;gt;. Now you can with &amp;lt;code&amp;gt;TagsProvider.Builder#add&amp;lt;/code&amp;gt; add one or more Items/Blocks or other Tags to your own Tags. &lt;br /&gt;
&lt;br /&gt;
Example for an Item Tag:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
ITag.INamedTag&amp;lt;Item&amp;gt; copperTag = ItemTags.makeWrapperTag(&amp;quot;forge:ore/copper&amp;quot;);&lt;br /&gt;
getOrCreateBuilder(copperTag).add(Init.COPPER_ORE_ITEM.get());&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Custom Type for Tags==&lt;br /&gt;
TBD&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Datageneration/Tags&amp;diff=2189</id>
		<title>Datageneration/Tags</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Datageneration/Tags&amp;diff=2189"/>
		<updated>2020-11-04T17:45:46Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital write up still needs work in the Custom Type Section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Tags can be generated by extending the &amp;lt;code&amp;gt;ItemTagsProvider&amp;lt;/code&amp;gt; for Items or &amp;lt;code&amp;gt;BlockTagsProvider&amp;lt;/code&amp;gt; for Blocks. For Custom Objects you would need to expand &amp;lt;code&amp;gt;TagsProvider&amp;lt;/code&amp;gt; and give it the Object you want tags for. For the registration of you Tags you need to override the &amp;lt;code&amp;gt;TagsProvider#registerTags&amp;lt;/code&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Information|content=You can still use &amp;lt;code&amp;gt;TagsProvider&amp;lt;/code&amp;gt; for Items and Blocks but you would need to implement a lot of stuff that is already done in &amp;lt;code&amp;gt;ItemTagsProvider&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;BlockTagsProvider&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Items/Blocks ==&lt;br /&gt;
First you should make a &amp;lt;code&amp;gt;ITag.INamedTag&amp;lt;/code&amp;gt;(NamedTag) with &amp;lt;code&amp;gt;ItemTags#makeWrapperTag&amp;lt;/code&amp;gt; for Items or &amp;lt;code&amp;gt;BlockTags#makeWrapperTag&amp;lt;/code&amp;gt; for blocks, this will take the name of you Tag, see [[Tags#Conventions]] for more info. After you have the &amp;lt;code&amp;gt;NamedTag&amp;lt;/code&amp;gt; you can start with the actual creation of the Tag, you would first call &amp;lt;code&amp;gt;TagsProvider#getOrCreateBuilder&amp;lt;/code&amp;gt; which takes the NamedTag as an Argument, this returns a &amp;lt;code&amp;gt;TagsProvider.Builder&amp;lt;/code&amp;gt;. Now you can with &amp;lt;code&amp;gt;TagsProvider.Builder#add&amp;lt;/code&amp;gt; add one or more Items/Blocks or other Tags to your own Tags. &lt;br /&gt;
&lt;br /&gt;
Example for an Item Tag:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
ITag.INamedTag&amp;lt;Item&amp;gt; copperTag = ItemTags.makeWrapperTag(&amp;quot;forge:ore/copper&amp;quot;);&lt;br /&gt;
getOrCreateBuilder(copperTag).add(Init.COPPER_ORE_ITEM.get());&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Custom Type for Tags ==&lt;br /&gt;
TBD&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Datageneration/Recipes&amp;diff=2188</id>
		<title>Datageneration/Recipes</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Datageneration/Recipes&amp;diff=2188"/>
		<updated>2020-11-04T16:44:52Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: changed the old block tag to colored box&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Recipes can be generated by creating an extension of Minecraft's &amp;lt;code&amp;gt;RecipeProvider&amp;lt;/code&amp;gt; class. From there, recipes can be registered by overriding &amp;lt;code&amp;gt;RecipeProvider#registerRecipes&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Info|content=Remove the &amp;lt;code&amp;gt;super&amp;lt;/code&amp;gt; call within the method. Otherwise, you will generate all recipes from Minecraft as well.}}&lt;br /&gt;
&lt;br /&gt;
== Recipe Builders ==&lt;br /&gt;
&lt;br /&gt;
All recipes need to be formatted as an &amp;lt;code&amp;gt;IFinishedRecipe&amp;lt;/code&amp;gt;. Each vanilla recipe has a static constructor builder that can be used to create a finished recipe. These can be built by passing the required parameters and then calling &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;#build&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=important|content=All recipes must have a different path. If two recipes have the same result, use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;#build(Consumer&amp;lt;IFinishedRecipe&amp;gt;, ResourceLocation)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; instead. This will allow you to specify a different name for the recipe such that it will not override the other.}}&lt;br /&gt;
&lt;br /&gt;
There are six vanilla recipe builders: &amp;lt;code&amp;gt;ShapedRecipeBuilder&amp;lt;/code&amp;gt; for shaped recipes, &amp;lt;code&amp;gt;ShapelessRecipeBuilder&amp;lt;/code&amp;gt; for shapeless recipes, &amp;lt;code&amp;gt;CookingRecipeBuilder&amp;lt;/code&amp;gt; for furnace type recipes, &amp;lt;code&amp;gt;CustomRecipeBuilder&amp;lt;/code&amp;gt; for nondeterministic logic, &amp;lt;code&amp;gt;SingleItemRecipeBuilder&amp;lt;/code&amp;gt; for stonecutting recipes, and &amp;lt;code&amp;gt;SmithingRecipeBuilder&amp;lt;/code&amp;gt; for smithing recipes.&lt;br /&gt;
&lt;br /&gt;
For any recipe to be valid, a criterion must be met to obtain the recipe within the recipe book. This can be attached via &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;#addCriterion&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;RecipeProvider&amp;lt;/code&amp;gt; class has some basic criteria creators to check whether a player's inventory has a certain item or whether a player has entered into a specific block.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;ConditionalRecipe&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
To specify if a recipe should be loaded at runtime, a &amp;lt;code&amp;gt;ConditionalRecipe&amp;lt;/code&amp;gt; can be used in conjunction with a recipe builder. Conditions must be added before the recipe via &amp;lt;code&amp;gt;ConditionalRecipe$Builder#addCondition&amp;lt;/code&amp;gt;. Then, once a recipe is added, all previous conditions are cleared for the next to be added. There are a few helper methods for conditions that can be implemented via &amp;lt;code&amp;gt;IConditionBuilder&amp;lt;/code&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=User:Unbekannt&amp;diff=2187</id>
		<title>User:Unbekannt</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=User:Unbekannt&amp;diff=2187"/>
		<updated>2020-11-04T16:38:12Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Created page with &amp;quot;Hi, i will mostly do back end stuff and Moderation in this wiki.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi,&lt;br /&gt;
i will mostly do back end stuff and Moderation in this wiki.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=FCWMeta:Wiki_Policy&amp;diff=2183</id>
		<title>FCWMeta:Wiki Policy</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=FCWMeta:Wiki_Policy&amp;diff=2183"/>
		<updated>2020-10-25T18:46:48Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Wiki Policy =&lt;br /&gt;
&lt;br /&gt;
This Community Wiki is governed by the same principles and follows a similar policy to the official [https://forums.minecraftforge.net/ Forge Forums] and the official [https://discord.gg/UvedJ9m Forge Discord].&lt;br /&gt;
&lt;br /&gt;
== Staff ==&lt;br /&gt;
The staff is responsible for the whole wiki, and forms policies. The staff is divided into two groups: the Admins and the Mods.&lt;br /&gt;
&lt;br /&gt;
The Admins are responsible for maintaining the site, and enforcing decisions through user rights management. &lt;br /&gt;
The Mods are responsible for curating the wiki and its contents, and can revert edits and delete pages.&lt;br /&gt;
&lt;br /&gt;
=== Conflict of Interest ===&lt;br /&gt;
Staff members who are involved in a dispute or conflict may not use their powers to enforce their decision. An uninvolved Admin must be present to make and enforce a decision. If there are no uninvolved Admins, the decision must be made by deliberation of the staff, and this decision is final.&lt;br /&gt;
&lt;br /&gt;
=== Admin Discretion ===&lt;br /&gt;
Admins may immediately respond and apply any action they deem necessary to any situation not covered under this policy. After any situation in which this policy is applied, Admins may deliberate with the staff to clarify this policy.&lt;br /&gt;
&lt;br /&gt;
=== Appeals ===&lt;br /&gt;
If a user is unsatisfied with the decision made by any staff member, they may appeal to an uninvolved Admin, who may either maintain or overturn the decision, or if necessary deliberate with the staff to make a final decision. Any decision made by staff deliberation is final.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Supported Versions ==&lt;br /&gt;
In keeping with the official policy of the Forge project, this wiki will only support and include information relating to the '''Latest''' and '''LTS''' versions. The currently supported versions are listed on the [https://github.com/MinecraftForge/MinecraftForge/blob/1.16.x/docs/README.md#minecraftforge README of the MinecraftForge repository].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Violations ==&lt;br /&gt;
Users who violate this policy will be given an increasing amount of warnings and sanctions.  These sanctions are not set in stone; they may vary from case to case, depending on the judgement of the acting Administrator, and the severity of the infraction.&lt;br /&gt;
&lt;br /&gt;
In increasing order of severity, here are the applicable sanctions:&lt;br /&gt;
&lt;br /&gt;
* Verbal warning&lt;br /&gt;
* Revocation of rights&lt;br /&gt;
** From the involved page/namespace&lt;br /&gt;
** From the site &amp;lt;code&amp;gt;(a.k.a read-only purgatory)&amp;lt;/code&amp;gt;&lt;br /&gt;
* Deletion of account&lt;br /&gt;
* IP block&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Sending_Packets&amp;diff=2182</id>
		<title>Sending Packets</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Sending_Packets&amp;diff=2182"/>
		<updated>2020-10-25T12:41:34Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Once a packet has been added to the network, it can be called to send a message to the side it refers to. Usually there are four different directions a packet can be sent:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!Direction !!Description &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;PLAY_TO_CLIENT&amp;lt;/code&amp;gt;   ||  A packet is sent from the server to the client during gameplay. &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;PLAY_TO_SERVER&amp;lt;/code&amp;gt;   ||  A packet is sent from the client to the server during gameplay. &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;LOGIN_TO_CLIENT&amp;lt;/code&amp;gt;   ||  A packet is sent to the client on initial login. &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;LOGIN_TO_SERVER&amp;lt;/code&amp;gt;   ||  A packet is sent to the server on initial login. &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The two login packets are handled internally by forge itself. However, the other two need to be sent using &amp;lt;code&amp;gt;SimpleChannel#send&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;SimpleChannel#sendToServer&amp;lt;/code&amp;gt;. Each method takes a new instance of the message to send.&lt;br /&gt;
&lt;br /&gt;
== Client Packet Locations ==&lt;br /&gt;
&lt;br /&gt;
It might not always be necessary to update every single client with a packet if they are not viewing the entity or are not affected by it. To specify which clients to send a packet from the server to, a &amp;lt;code&amp;gt;PacketDistributor$PacketTarget&amp;lt;/code&amp;gt; must also be passed in as a parameter. There are many helpful fields that hold simple implementations of where to send which packet within &amp;lt;code&amp;gt;PacketDistributor&amp;lt;/code&amp;gt;. However, they must be supplied with the required input either via &amp;lt;code&amp;gt;PacketDistributor#with&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PacketDistributor#noArg&amp;lt;/code&amp;gt; if it is going to all players.&lt;br /&gt;
&lt;br /&gt;
Here is a list of distributors available:&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Using_FriendlyByteBuf&amp;diff=2181</id>
		<title>Using FriendlyByteBuf</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Using_FriendlyByteBuf&amp;diff=2181"/>
		<updated>2020-10-25T12:35:39Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Created page with &amp;quot;&amp;lt;code&amp;gt;PacketBuffer&amp;lt;/code&amp;gt;s are essentially a byte array of zero or more bytes to sync information across a network. It works similarly to a queue: the information is written i...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;code&amp;gt;PacketBuffer&amp;lt;/code&amp;gt;s are essentially a byte array of zero or more bytes to sync information across a network. It works similarly to a queue: the information is written in to a specific order and read in the order it was written.&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;PacketBuffer&amp;lt;/code&amp;gt;s ==&lt;br /&gt;
&lt;br /&gt;
In most cases, one will use a premade &amp;lt;code&amp;gt;PacketBuffer&amp;lt;/code&amp;gt; passed in from some network. Most of the time this is a heap buffer of some sort; however, understanding how it works is best left as an explanation of data structures.&lt;br /&gt;
&lt;br /&gt;
When you are &amp;lt;code&amp;gt;writing&amp;lt;/code&amp;gt; to a &amp;lt;code&amp;gt;PacketBuffer&amp;lt;/code&amp;gt;, you are calling one of the many write functions to store information as bytes (e.g. &amp;lt;code&amp;gt;writeBlockPos&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;writeVarInt&amp;lt;/code&amp;gt;). There are a couple of helpers for objects like &amp;lt;code&amp;gt;CompoundNBT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ItemStack&amp;lt;/code&amp;gt;s, etc. if they are needed.&lt;br /&gt;
&lt;br /&gt;
When you are &amp;lt;code&amp;gt;reading&amp;lt;/code&amp;gt; from a &amp;lt;code&amp;gt;PacketBuffer&amp;lt;/code&amp;gt;, you are calling the equivalent read function in the same order. For example, if you call &amp;lt;code&amp;gt;writeBlockPos&amp;lt;/code&amp;gt; and then &amp;lt;code&amp;gt;writeVarInt&amp;lt;/code&amp;gt;, you would call &amp;lt;code&amp;gt;readBlockPos&amp;lt;/code&amp;gt; and then &amp;lt;code&amp;gt;readVarInt&amp;lt;/code&amp;gt; in that order. Each of these method returns the value from the buffer.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Named_Binary_Tag&amp;diff=2180</id>
		<title>Named Binary Tag</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Named_Binary_Tag&amp;diff=2180"/>
		<updated>2020-10-25T12:31:41Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Information between two points are passed in many different ways in Minecraft. The most common of them is known as NBTs. NBTs are a structured binary file used to store information on the disk. They are also used as intermediaries to hold information that will be sent across a network. Understanding and utilizing NBTs properly is a good start to understanding disk storage in general.&lt;br /&gt;
&lt;br /&gt;
== NBT Types ==&lt;br /&gt;
There are a total of fourteen different nbt data types that can be parsed. The most common one to use is &amp;lt;code&amp;gt;CompoundNBT&amp;lt;/code&amp;gt;s within a &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;Entity&amp;lt;/code&amp;gt; when it comes to writing to the disk. However, on capabilities, other types can be specified to reduce the space it takes on a file.&lt;br /&gt;
&lt;br /&gt;
All types implement &amp;lt;code&amp;gt;INBT&amp;lt;/code&amp;gt; in some fashion. This interface holds basic methods for writing to a file and copying itself. It also holds basic methods to determine the output to a chat line.&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!Id !!Name !!Description &lt;br /&gt;
|-&lt;br /&gt;
|   0   ||   &amp;lt;code&amp;gt;EndNBT&amp;lt;/code&amp;gt;   ||  Specifies the end of an nbt file. &lt;br /&gt;
|-&lt;br /&gt;
|   1   ||   &amp;lt;code&amp;gt;ByteNBT&amp;lt;/code&amp;gt;   ||  Holds a byte. Also used to store a boolean value. &lt;br /&gt;
|-&lt;br /&gt;
|   2   ||   &amp;lt;code&amp;gt;ShortNBT&amp;lt;/code&amp;gt;   ||  Holds a short. &lt;br /&gt;
|-&lt;br /&gt;
|   3   ||   &amp;lt;code&amp;gt;IntNBT&amp;lt;/code&amp;gt;   ||  Holds an integer. &lt;br /&gt;
|-&lt;br /&gt;
|   4   ||   &amp;lt;code&amp;gt;LongNBT&amp;lt;/code&amp;gt;   ||  Holds a long. &lt;br /&gt;
|-&lt;br /&gt;
|   5   ||   &amp;lt;code&amp;gt;FloatNBT&amp;lt;/code&amp;gt;   ||  Holds a float. &lt;br /&gt;
|-&lt;br /&gt;
|   6   ||   &amp;lt;code&amp;gt;DoubleNBT&amp;lt;/code&amp;gt;   ||  Holds a double. &lt;br /&gt;
|-&lt;br /&gt;
|   7   ||   &amp;lt;code&amp;gt;ByteArrayNBT&amp;lt;/code&amp;gt;   ||  Holds a byte array. Can be parsed from an array of primitive bytes or a list of byte objects. &lt;br /&gt;
|-&lt;br /&gt;
|   8   ||   &amp;lt;code&amp;gt;StringNBT&amp;lt;/code&amp;gt;   ||  Holds a string. &lt;br /&gt;
|-&lt;br /&gt;
|   9   ||   &amp;lt;code&amp;gt;ListNBT&amp;lt;/code&amp;gt;   ||  Holds a list of a specific &amp;lt;code&amp;gt;INBT&amp;lt;/code&amp;gt;. &lt;br /&gt;
|-&lt;br /&gt;
|   10   ||   &amp;lt;code&amp;gt;CompoundNBT&amp;lt;/code&amp;gt;   ||  Holds an object comprised of &amp;lt;code&amp;gt;INBT&amp;lt;/code&amp;gt;s. It works similarly to a java object where it can store other primitives, objects, or itself inside. &lt;br /&gt;
|-&lt;br /&gt;
|   11   ||   &amp;lt;code&amp;gt;IntArrayNBT&amp;lt;/code&amp;gt;   ||  Holds an integer array. Can be parsed from an array of primitive integers or a list of integer objects. &lt;br /&gt;
|-&lt;br /&gt;
|   12   ||   &amp;lt;code&amp;gt;LongArrayNBT&amp;lt;/code&amp;gt;   ||  Holds an long array. Can be parsed from an array of primitive long, a list of long objects, or a &amp;lt;code&amp;gt;LongSet&amp;lt;/code&amp;gt;. &lt;br /&gt;
|-&lt;br /&gt;
|   99   ||   &amp;lt;code&amp;gt;NumberNBT&amp;lt;/code&amp;gt;   ||  Holds a generic number. Used when the specific &amp;lt;code&amp;gt;INBT&amp;lt;/code&amp;gt; for a number is not specified. All numbers can be converted to each other. &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In most cases, you will only have to deal with &amp;lt;code&amp;gt;CompoundNBT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ListNBT&amp;lt;/code&amp;gt;. The others are usually handled internally by whichever type uses them.&lt;br /&gt;
&lt;br /&gt;
== Common Usages ==&lt;br /&gt;
&amp;lt;code&amp;gt;CompoundNBT&amp;lt;/code&amp;gt;s are used similar to objects. You can &amp;lt;code&amp;gt;put&amp;lt;/code&amp;gt; and value within them using a key. You can then retrieve the value once again with that same key. It has specific methods for putting and getting most of the different types of data (e.g. an integer using &amp;lt;code&amp;gt;putInt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;getInt&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ListNBT&amp;lt;/code&amp;gt;s are functionally the same as &amp;lt;code&amp;gt;ArrayList&amp;lt;/code&amp;gt;s. You can &amp;lt;code&amp;gt;add&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;remove&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;set&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;get&amp;lt;/code&amp;gt; a specific NBT type.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Capabilities/Attaching&amp;diff=2179</id>
		<title>Capabilities/Attaching</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Capabilities/Attaching&amp;diff=2179"/>
		<updated>2020-10-25T12:22:56Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;As mentioned, attaching capabilities to objects that you have not created can be done using &amp;lt;code&amp;gt;AttachCapabilitiesEvent&amp;lt;/code&amp;gt;. The same event is used for all objects that can provide capabilities. &amp;lt;code&amp;gt;AttachCapabilitiesEvent&amp;lt;/code&amp;gt; has five valid generic types providing the following events:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;AttachCapabilitiesEvent&amp;lt;Entity&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;: Fires only for entities.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;AttachCapabilitiesEvent&amp;lt;TileEntity&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;: Fires only for tile entities.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;AttachCapabilitiesEvent&amp;lt;ItemStack&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;: Fires only for item stacks.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;AttachCapabilitiesEvent&amp;lt;World&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;: Fires only for worlds.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;AttachCapabilitiesEvent&amp;lt;Chunk&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;: Fires only for chunks.&lt;br /&gt;
&lt;br /&gt;
The generic type cannot be more specific than the above types. For example: If you want to attach capabilities to &amp;lt;code&amp;gt;PlayerEntity&amp;lt;/code&amp;gt;, you have to subscribe to the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;AttachCapabilitiesEvent&amp;lt;Entity&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, and then determine that the provided object is an &amp;lt;code&amp;gt;PlayerEntity&amp;lt;/code&amp;gt; before attaching the capability.&lt;br /&gt;
&lt;br /&gt;
In all cases, the event has a method &amp;lt;code&amp;gt;addCapability&amp;lt;/code&amp;gt;, which can be used to attach capabilities to the target object. Instead of adding capabilities themselves to the list, you add capability providers, which have the chance to return capabilities only from certain sides. While the provider only needs to implement &amp;lt;code&amp;gt;ICapabilityProvider&amp;lt;/code&amp;gt;, if the capability needs to store data persistently it is possible to implement &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ICapabilitySerializable&amp;lt;T extends INBT&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; which, on top of returning the capabilities, will allow providing NBT save/load functions.&lt;br /&gt;
&lt;br /&gt;
For information on how to implement &amp;lt;code&amp;gt;ICapabilityProvider&amp;lt;/code&amp;gt;, refer to the [[Capabilities|a Capability]] section.&lt;br /&gt;
&lt;br /&gt;
== Creating Your Own Capability ==&lt;br /&gt;
In general terms, a capability is declared and registered through a single method call to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;CapabilityManager#INSTANCE#register&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. One possibility is to define a static &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;register&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; method inside a dedicated class for the capability, but this is not required by the capability system. For the purpose of this documentation we will be describing each part as a separate named class, although anonymous classes are an option.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
CapabilityManager.INSTANCE.register(capability_interface_class, storage, default_implementation_factory);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The first parameter to this method, is the type that describes the capability feature. In our example, this will be &amp;lt;code&amp;gt;IExampleCapability.class&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second parameter is an instance of a class that implements &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Capability.IStorage&amp;lt;T&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, where T is the same class we specified in the first parameter. This storage class will help manage saving and loading for the default implementation, and it can, optionally, also support other implementations.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
private static class Storage&lt;br /&gt;
    implements Capability.IStorage&amp;lt;IExampleCapability&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
  @Override&lt;br /&gt;
  public INBT writeNBT(Capability&amp;lt;IExampleCapability&amp;gt; capability, IExampleCapability instance, Direction side) {&lt;br /&gt;
    // return an NBT tag&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  @Override&lt;br /&gt;
  public void readNBT(Capability&amp;lt;IExampleCapability&amp;gt; capability, IExampleCapability instance, Direction side, INBT nbt) {&lt;br /&gt;
    // load from the NBT tag&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The last parameter is a callable factory that will return new instances of the default implementation.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
private static class Factory implements Callable&amp;lt;IExampleCapability&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
  @Override&lt;br /&gt;
  public IExampleCapability call() throws Exception {&lt;br /&gt;
    return new Implementation();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Finally, we will need the default implementation itself, to be able to instantiate it in the factory. Designing this class is up to you, but it should at least provide a basic skeleton that people can use to test the capability, if it’s not a fully usable implementation on itself.&lt;br /&gt;
&lt;br /&gt;
== Persisting Chunk and TileEntity capabilities ==&lt;br /&gt;
Unlike &amp;lt;code&amp;gt;Worlds&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Entities&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ItemStacks&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Chunks&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;TileEntities&amp;lt;/code&amp;gt; are only written to disk when they have been marked as dirty. A &amp;lt;code&amp;gt;capability&amp;lt;/code&amp;gt; implementation with persistent state for a &amp;lt;code&amp;gt;Chunk&amp;lt;/code&amp;gt; or a &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; should therefore ensure that whenever its state changes, its owner is marked as dirty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ItemStackHandler&amp;lt;/code&amp;gt;, commonly used for inventories in &amp;lt;code&amp;gt;TileEntities&amp;lt;/code&amp;gt;, has an overridable method &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;void onContentsChanged(int slot)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; designed to be used to mark the &amp;lt;code&amp;gt;TileEntity&amp;lt;/code&amp;gt; as dirty.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public class MyTileEntity extends TileEntity {&lt;br /&gt;
&lt;br /&gt;
  private final IItemHandler inventory = new ItemStackHandler(...) {&lt;br /&gt;
    @Override&lt;br /&gt;
    protected void onContentsChanged(int slot) {&lt;br /&gt;
      super.onContentsChanged(slot);&lt;br /&gt;
      markDirty();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Synchronizing Data with Clients  ==&lt;br /&gt;
By default, Capability data is not sent to clients. In order to change this, the mods have to manage their own synchronization code using packets.&lt;br /&gt;
&lt;br /&gt;
There are three different situation in which you may want to send synchronization packets, all of them optional:&lt;br /&gt;
# When the entity spawns in the world, or the block is placed, you may want to share the initialization-assigned values with the clients.&lt;br /&gt;
# When the stored data changes, you may want to notify some or all of the watching clients.&lt;br /&gt;
# When a new client starts viewing the entity or block, you may want to notify it of the existing data.&lt;br /&gt;
&lt;br /&gt;
Refer to the [[Understanding Networking|Networking]] page for more information on implementing network packets.&lt;br /&gt;
&lt;br /&gt;
== Persisting across Player Deaths ==&lt;br /&gt;
By default, the capability data does not persist on death. In order to change this, the data has to be manually copied when the player entity is cloned during the respawn process.&lt;br /&gt;
&lt;br /&gt;
This can be done by handling the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;PlayerEvent.Clone&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; event, reading the data from the original entity, and assigning it to the new entity. In this event, the &amp;lt;code&amp;gt;wasDead&amp;lt;/code&amp;gt; field can be used to distinguish between respawning after death, and returning from the End. This is important because the data will already exist when returning from the End, so care has to be taken to not duplicate values in this case.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Capabilities&amp;diff=2178</id>
		<title>Capabilities</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Capabilities&amp;diff=2178"/>
		<updated>2020-10-25T12:11:14Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Capabilities allow exposing features in a dynamic and flexible way, without having to resort to directly implementing many interfaces.&lt;br /&gt;
&lt;br /&gt;
In general terms, each capability provides a feature in the form of an interface, alongside with a default implementation which can be requested, and a storage handler for at least this default implementation. The storage handler can support other implementations, but this is up to the capability implementor, so look it up in their documentation before trying to use the default storage with non-default implementations.&lt;br /&gt;
&lt;br /&gt;
Forge adds capability support to &amp;lt;code&amp;gt;TileEntities&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Entities&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ItemStack&amp;lt;/code&amp;gt;s, &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt;s and &amp;lt;code&amp;gt;Chunk&amp;lt;/code&amp;gt;s, which can be exposed either by attaching them through an event or by overriding the capability methods in your own implementations of the objects. This will be explained in more detail in the following sections.&lt;br /&gt;
&lt;br /&gt;
== Forge-provided Capabilities ==&lt;br /&gt;
Forge provides three capabilities: &amp;lt;code&amp;gt;IItemHandler&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;IFluidHandler&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;IEnergyStorage&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;IItemHandler&amp;lt;/code&amp;gt; exposes an interface for handling inventory slots. It can be applied to &amp;lt;code&amp;gt;TileEntities&amp;lt;/code&amp;gt; (chests, machines, etc.), &amp;lt;code&amp;gt;Entities&amp;lt;/code&amp;gt; (extra player slots, mob/creature inventories/bags), or &amp;lt;code&amp;gt;ItemStacks&amp;lt;/code&amp;gt; (portable backpacks and such). It replaces the old &amp;lt;code&amp;gt;IInventory&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ISidedInventory&amp;lt;/code&amp;gt; with an automation-friendly system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;IFluidHandler&amp;lt;/code&amp;gt; exposes an interface for handling fluid inventories. It can also be applied to &amp;lt;code&amp;gt;TileEntities&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;Entities&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;ItemStacks&amp;lt;/code&amp;gt;. It replaces the old &amp;lt;code&amp;gt;IFluidHandler&amp;lt;/code&amp;gt; with a more consistent and automation-friendly system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;IEnergyStorage&amp;lt;/code&amp;gt; exposes an interface for handling energy containers. It can be applied to &amp;lt;code&amp;gt;TileEntities&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Entities&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ItemStacks&amp;lt;/code&amp;gt;. It is based on the RedstoneFlux API by TeamCoFH.&lt;br /&gt;
&lt;br /&gt;
== Using an Existing Capability  ==&lt;br /&gt;
As mentioned earlier, &amp;lt;code&amp;gt;TileEntities&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Entities&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;ItemStacks&amp;lt;/code&amp;gt; implement the capability provider feature, through the &amp;lt;code&amp;gt;ICapabilityProvider&amp;lt;/code&amp;gt; interface. This interface adds the method &amp;lt;code&amp;gt;getCapability&amp;lt;/code&amp;gt;, which can be used to query the capabilities present in the objects.&lt;br /&gt;
&lt;br /&gt;
In order to obtain a capability, you will need to refer it by its unique instance. In the case of the &amp;lt;code&amp;gt;IItemHandler&amp;lt;/code&amp;gt;, this capability is primarily stored in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;CapabilityItemHandler#ITEM_HANDLER_CAPABILITY&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, but it is possible to get other instance references by using the &amp;lt;code&amp;gt;@CapabilityInject&amp;lt;/code&amp;gt; annotation.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
@CapabilityInject(IItemHandler.class)&lt;br /&gt;
static Capability&amp;lt;IItemHandler&amp;gt; ITEM_HANDLER_CAPABILITY = null;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This annotation can be applied to fields and methods. When applied to a field, it will assign the instance of the capability (the same one gets assigned to all fields) upon registration of the capability, and left to the existing value (&amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;), if the capability was never registered. Because local static field accesses are fast, it is a good idea to keep your own local copy of the reference for objects that work with capabilities. This annotation can also be used on a method, in order to get notified when a capability is registered, so that certain features can be enabled conditionally.&lt;br /&gt;
&lt;br /&gt;
Both the &amp;lt;code&amp;gt;getCapability&amp;lt;/code&amp;gt; methods have a second parameter, of type &amp;lt;code&amp;gt;Direction&amp;lt;/code&amp;gt;, which can be used in the to request the specific instance for that one face. If passed &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, it can be assumed that the request comes either from within the block, or from some place where the side has no meaning, such as a different dimension. In this case a general capability instance that does not care about sides will be requested instead. The return type of &amp;lt;code&amp;gt;getCapability&amp;lt;/code&amp;gt; will correspond to the type declared in the capability passed to the method. For the item handler capability, this is indeed &amp;lt;code&amp;gt;IItemHandler&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Exposing a Capability ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to expose a capability, you will first need an instance of the underlying capability type. Note that you should assign a separate instance to each object that keeps the capability, since the capability will most probably be tied to the containing object.&lt;br /&gt;
&lt;br /&gt;
There’s two ways to obtain such an instance, through the &amp;lt;code&amp;gt;Capability&amp;lt;/code&amp;gt; itself, or by explicitly instantiating an implementation of it. The first method is designed to use a default implementation via &amp;lt;code&amp;gt;Capability#getDefaultInstance&amp;lt;/code&amp;gt;, if those default values are useful for you. In the case of the item handler capability, the default implementation will expose a single slot inventory, which is most probably not what you want.&lt;br /&gt;
&lt;br /&gt;
The second method can be used to provide custom implementations. In the case of &amp;lt;code&amp;gt;IItemHandler&amp;lt;/code&amp;gt;, the default implementation uses the &amp;lt;code&amp;gt;ItemStackHandler&amp;lt;/code&amp;gt; class, which has an optional argument in the constructor, to specify a number of slots. However, relying on the existence of these default implementations should be avoided, as the purpose of the capability system is to prevent loading errors in contexts where the capability is not present, so instantiation should be protected behind a check testing if the capability has been registered (see the remarks about &amp;lt;code&amp;gt;@CapabilityInject&amp;lt;/code&amp;gt; in the previous section).&lt;br /&gt;
&lt;br /&gt;
Once you have your own instance of the capability interface, you will want to notify users of the capability system that you expose this capability and provide a holder of the instance. This is done by overriding the &amp;lt;code&amp;gt;getCapability&amp;lt;/code&amp;gt; method, and comparing the instance with the capability you are exposing. If your machine has different slots based on which side is being queried, you can test this with the &amp;lt;code&amp;gt;side&amp;lt;/code&amp;gt; parameter. For &amp;lt;code&amp;gt;Entities&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ItemStack&amp;lt;/code&amp;gt;s, this parameter can be ignored, but it is still possible to have side as a context, such as different armor slots on a player (top side =&amp;gt; head slot?), or about the surrounding blocks in the inventory (west =&amp;gt; slot on the left?). Don’t forget to fall back to &amp;lt;code&amp;gt;super&amp;lt;/code&amp;gt;, otherwise the attached capabilities will stop working. Make sure to invalidate the holder of the instance at the end of the provider's lifecycle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
// Somewhere in your TileEntity subclass&lt;br /&gt;
LazyOptional&amp;lt;IItemHandler&amp;gt; inventoryHandlerLazyOptional;&lt;br /&gt;
&lt;br /&gt;
// After initializing inventoryHandler&lt;br /&gt;
inventoryHandlerLazyOptional = LazyOptional.of(() -&amp;gt; inventoryHandler);&lt;br /&gt;
&lt;br /&gt;
public &amp;lt;T&amp;gt; LazyOptional&amp;lt;T&amp;gt; getCapability(Capability&amp;lt;T&amp;gt; cap, Direction side) {&lt;br /&gt;
  if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {&lt;br /&gt;
    return inventoryHandlerLazyOptional.cast();&lt;br /&gt;
  }&lt;br /&gt;
  return super.getCapability(cap, side);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@Override&lt;br /&gt;
public void remove() {&lt;br /&gt;
  super.remove();&lt;br /&gt;
  inventoryHandlerLazyOptional.invalidate();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Item&amp;lt;/code&amp;gt;s are a special case since their capability providers are stored on an &amp;lt;code&amp;gt;ItemStack&amp;lt;/code&amp;gt;. Instead, a provider should be attached through &amp;lt;code&amp;gt;Item#initCapabilities&amp;lt;/code&amp;gt; when applicable. This should hold your capabilities for the lifecycle of the stack.&lt;br /&gt;
&lt;br /&gt;
It is strongly suggested that direct checks in code are used to test for capabilities instead of attempting to rely on maps or other data structures, since capability tests can be done by many objects every tick, and they need to be as fast as possible in order to avoid slowing down the game.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Sounds&amp;diff=2177</id>
		<title>Sounds</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Sounds&amp;diff=2177"/>
		<updated>2020-10-25T12:04:03Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: update page links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Although not essential, sounds bring a greater immersion into the Minecraft world. Their usages within and outside the development environment gives a bit more polish to an already existing mod from background music to a single block break.&lt;br /&gt;
&lt;br /&gt;
== Creating a Sound ==&lt;br /&gt;
&lt;br /&gt;
Sounds in Minecraft are comprised of two things: an audio file and a reference pointer to that audio file.&lt;br /&gt;
&lt;br /&gt;
The reference pointer is known as &amp;lt;code&amp;gt;sounds.json&amp;lt;/code&amp;gt; which should be created at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;assets/&amp;lt;modid&amp;gt;/sounds.json&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. This JSON defines resource names to point to the audio files added by a specific mod. The only thing necessary to define a sound is by creating an object, naming it, and then defining the location of the sound within a list.&lt;br /&gt;
&lt;br /&gt;
By default, the only supported audio format is [https://xiph.org/vorbis/ Ogg Vorbis] represented by the extension &amp;lt;code&amp;gt;.ogg&amp;lt;/code&amp;gt;. The file &amp;lt;code&amp;gt;namespace:path&amp;lt;/code&amp;gt; when referenced in the JSON will be located within &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;assets/&amp;lt;namespace&amp;gt;/sounds/&amp;lt;path&amp;gt;.ogg&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;example_sound&amp;quot;: {&lt;br /&gt;
    &amp;quot;sounds&amp;quot;: [ &amp;quot;examplemod:example_sound_file&amp;quot; ]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using the example above, it creates a sound called &amp;lt;code&amp;gt;example_sound&amp;lt;/code&amp;gt; and references the file &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;assets/&amp;lt;modid&amp;gt;/sounds/example_sound_file.ogg&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Instead of being constructed as a list of strings, each entry could also be an object which allows a greater control over what and how it is played.&lt;br /&gt;
&lt;br /&gt;
Here are some variables that could be defined:&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!Parameter !!Description &lt;br /&gt;
|-&lt;br /&gt;
|   name   ||  Sets the path to the sound file excluding the &amp;lt;code&amp;gt;.ogg&amp;lt;/code&amp;gt; extension. &lt;br /&gt;
|-&lt;br /&gt;
|   stream   ||  Determines whether the sound should be streamed from the file. When true, it reduces the amount of lag from loading a large file; however, it only allows four instances of the sound to be played at once. &lt;br /&gt;
|-&lt;br /&gt;
|   volume   ||  A value between 0 and 1 to determine the volume of the sound played. &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;example_sound&amp;quot;: {&lt;br /&gt;
    &amp;quot;sounds&amp;quot;: [ &amp;quot;examplemod:example_sound_file&amp;quot; ]&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;example_sound_complex&amp;quot;: {&lt;br /&gt;
    &amp;quot;sounds&amp;quot;:&lt;br /&gt;
    [&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;name&amp;quot;: &amp;quot;examplemod:complex/example_complex&amp;quot;,&lt;br /&gt;
        &amp;quot;pitch&amp;quot;: 0.6,&lt;br /&gt;
        &amp;quot;stream&amp;quot;: true&lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now there is a new sound within our JSON called &amp;lt;code&amp;gt;example_sound_complex&amp;lt;/code&amp;gt;. This points to the audio file at &amp;lt;code&amp;gt;assets/examplemod/sounds/complex/example_complex.json&amp;lt;/code&amp;gt;. The sound's pitch is lowered to 0.6 of its original value. The &amp;lt;code&amp;gt;stream&amp;lt;/code&amp;gt; parameter is also set to true.&lt;br /&gt;
&lt;br /&gt;
There are many more parameters that can give greater control on how sounds are played. However, this is left as an exercise to the reader to try and construct with the [https://minecraft.gamepedia.com/Sounds.json wiki].&lt;br /&gt;
&lt;br /&gt;
== Creating &amp;lt;code&amp;gt;SoundEvent&amp;lt;/code&amp;gt;s ==&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;sounds.json&amp;lt;/code&amp;gt; left in its current state would only be defined in-game. There is currently no way to reference the sound within a mod. To do this, we utilize the &amp;lt;code&amp;gt;SoundEvent&amp;lt;/code&amp;gt; class. Each &amp;lt;code&amp;gt;SoundEvent&amp;lt;/code&amp;gt; class holds a &amp;lt;code&amp;gt;ResourceLocation&amp;lt;/code&amp;gt; to reference a sound pointer defined in the &amp;lt;code&amp;gt;sounds.json&amp;lt;/code&amp;gt; file. The &amp;lt;code&amp;gt;sounds.json&amp;lt;/code&amp;gt; file used is determined by the namespace or the resource location passed into the class.&lt;br /&gt;
&lt;br /&gt;
For example, to reference &amp;lt;code&amp;gt;example_complex.ogg&amp;lt;/code&amp;gt;, you would store the reference name (e.g. &amp;lt;code&amp;gt;example_sound_complex&amp;lt;/code&amp;gt;) within a &amp;lt;code&amp;gt;new SoundEvent(new ResourceLocation(&amp;quot;examplemod&amp;quot;, &amp;quot;example_sound_complex&amp;quot;))&amp;lt;/code&amp;gt;. This will locate &amp;lt;code&amp;gt;assets/examplemod/sounds.json&amp;lt;/code&amp;gt; and try to find an &amp;lt;code&amp;gt;example_sound_complex&amp;lt;/code&amp;gt; object nested within it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SoundEvent&amp;lt;/code&amp;gt;s must be [[Registration|registered]] to be referenced in code. &lt;br /&gt;
&lt;br /&gt;
== Playing Sounds ==&lt;br /&gt;
&lt;br /&gt;
Vanilla has lots of methods for playing sounds that can be used in different scenarios.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(PlayerEntity, BlockPos, SoundEvent, SoundCategory, volume, pitch)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Simply forwards to overload (2), adding 0.5 to each coordinate of the BlockPos given.&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(PlayerEntity, double x, double y, double z, SoundEvent, SoundCategory, volume, pitch)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt;Client Behavior&amp;lt;/code&amp;gt;: If the passed in player is the client player, plays the sound event to the client player.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Server Behavior&amp;lt;/code&amp;gt;: Plays the sound event to everyone nearby except the passed in player. Player can be &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Usage&amp;lt;/code&amp;gt;: The correspondence between the behaviors implies that these two methods are to be called from some player-initiated code that will be run on both logical sides at the same time - the logical client handles playing it to the user and the logical server handles everyone else hearing it without re-playing it to the original user. They can also be used to play any sound in general at any position server-side by calling it on the logical server and passing in a &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; player, thus letting everyone hear it.&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(double x, double y, double z, SoundEvent, SoundCategory, volume, pitch, distanceDelay)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt;Client Behavior&amp;lt;/code&amp;gt;: Just plays the sound event in the client world. If distanceDelay is true, then delays the sound based on how far it is from the player.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Server Behavior&amp;lt;/code&amp;gt;: Does nothing.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Usage&amp;lt;/code&amp;gt;: This method only works client-side, and thus is useful for sounds sent in custom packets, or other client-only effect-type sounds. Used for thunder.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt; ClientWorld &amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(BlockPos, SoundEvent, SoundCategory, volume, pitch, distanceDelay)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Simply forwards to &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt;‘s overload (3), adding 0.5 to each coordinate of the &amp;lt;code&amp;gt;BlockPos&amp;lt;/code&amp;gt; given.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt; Entity &amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(SoundEvent, volume, pitch)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Forwards to &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt;‘s overload (2), passing in &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; as the player.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Client Behavior&amp;lt;/code&amp;gt;: Does nothing.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Server Behavior&amp;lt;/code&amp;gt;: Plays the sound event to everyone at this entity’s position.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Usage&amp;lt;/code&amp;gt;: Emitting any sound from any non-player entity server-side.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt; PlayerEntity&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(SoundEvent, volume, pitch)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; (overriding the one in &amp;lt;code&amp;gt;[[Sounds#Entity|Entity]]&amp;lt;/code&amp;gt;)&lt;br /&gt;
#* Forwards to &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt;‘s overload (2), passing in &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; as the player.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Client Behavior&amp;lt;/code&amp;gt;: Does nothing, see override in &amp;lt;code&amp;gt;[[Sounds#clientplayerentity|ClientPlayerEntity]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Server Behavior&amp;lt;/code&amp;gt;: Plays the sound to everyone nearby &amp;lt;code&amp;gt;except&amp;lt;/code&amp;gt; this player.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Usage&amp;lt;/code&amp;gt;: See &amp;lt;code&amp;gt;[[Sounds#clientplayerentity|ClientPlayerEntity]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt; ClientPlayerEntity&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(SoundEvent, volume, pitch)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; (overriding the one in &amp;lt;code&amp;gt;[[Sounds#playerentity|PlayerEntity]]&amp;lt;/code&amp;gt;)&lt;br /&gt;
#* Forwards to &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt;‘s overload (2), passing in &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; as the player.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Client Behavior&amp;lt;/code&amp;gt;: Just plays the Sound Event.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Server Behavior&amp;lt;/code&amp;gt;: Method is client-only.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Usage&amp;lt;/code&amp;gt;: Just like the ones in &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt;, these two overrides in the player classes seem to be for code that runs together on both sides. The client handles playing the sound to the user, while the server handles everyone else hearing it without re-playing to the original user.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Sounds&amp;diff=2176</id>
		<title>Sounds</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Sounds&amp;diff=2176"/>
		<updated>2020-10-25T12:00:17Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Although not essential, sounds bring a greater immersion into the Minecraft world. Their usages within and outside the development environment gives a bit more polish to an already existing mod from background music to a single block break.&lt;br /&gt;
&lt;br /&gt;
== Creating a Sound ==&lt;br /&gt;
&lt;br /&gt;
Sounds in Minecraft are comprised of two things: an audio file and a reference pointer to that audio file.&lt;br /&gt;
&lt;br /&gt;
The reference pointer is known as &amp;lt;code&amp;gt;sounds.json&amp;lt;/code&amp;gt; which should be created at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;assets/&amp;lt;modid&amp;gt;/sounds.json&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. This JSON defines resource names to point to the audio files added by a specific mod. The only thing necessary to define a sound is by creating an object, naming it, and then defining the location of the sound within a list.&lt;br /&gt;
&lt;br /&gt;
By default, the only supported audio format is [https://xiph.org/vorbis/ Ogg Vorbis] represented by the extension &amp;lt;code&amp;gt;.ogg&amp;lt;/code&amp;gt;. The file &amp;lt;code&amp;gt;namespace:path&amp;lt;/code&amp;gt; when referenced in the JSON will be located within &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;assets/&amp;lt;namespace&amp;gt;/sounds/&amp;lt;path&amp;gt;.ogg&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;example_sound&amp;quot;: {&lt;br /&gt;
    &amp;quot;sounds&amp;quot;: [ &amp;quot;examplemod:example_sound_file&amp;quot; ]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using the example above, it creates a sound called &amp;lt;code&amp;gt;example_sound&amp;lt;/code&amp;gt; and references the file &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;assets/&amp;lt;modid&amp;gt;/sounds/example_sound_file.ogg&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Instead of being constructed as a list of strings, each entry could also be an object which allows a greater control over what and how it is played.&lt;br /&gt;
&lt;br /&gt;
Here are some variables that could be defined:&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!Parameter !!Description &lt;br /&gt;
|-&lt;br /&gt;
|   name   ||  Sets the path to the sound file excluding the &amp;lt;code&amp;gt;.ogg&amp;lt;/code&amp;gt; extension. &lt;br /&gt;
|-&lt;br /&gt;
|   stream   ||  Determines whether the sound should be streamed from the file. When true, it reduces the amount of lag from loading a large file; however, it only allows four instances of the sound to be played at once. &lt;br /&gt;
|-&lt;br /&gt;
|   volume   ||  A value between 0 and 1 to determine the volume of the sound played. &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;example_sound&amp;quot;: {&lt;br /&gt;
    &amp;quot;sounds&amp;quot;: [ &amp;quot;examplemod:example_sound_file&amp;quot; ]&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;example_sound_complex&amp;quot;: {&lt;br /&gt;
    &amp;quot;sounds&amp;quot;:&lt;br /&gt;
    [&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;name&amp;quot;: &amp;quot;examplemod:complex/example_complex&amp;quot;,&lt;br /&gt;
        &amp;quot;pitch&amp;quot;: 0.6,&lt;br /&gt;
        &amp;quot;stream&amp;quot;: true&lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now there is a new sound within our JSON called &amp;lt;code&amp;gt;example_sound_complex&amp;lt;/code&amp;gt;. This points to the audio file at &amp;lt;code&amp;gt;assets/examplemod/sounds/complex/example_complex.json&amp;lt;/code&amp;gt;. The sound's pitch is lowered to 0.6 of its original value. The &amp;lt;code&amp;gt;stream&amp;lt;/code&amp;gt; parameter is also set to true.&lt;br /&gt;
&lt;br /&gt;
There are many more parameters that can give greater control on how sounds are played. However, this is left as an exercise to the reader to try and construct with the [https://minecraft.gamepedia.com/Sounds.json wiki].&lt;br /&gt;
&lt;br /&gt;
== Creating &amp;lt;code&amp;gt;SoundEvent&amp;lt;/code&amp;gt;s ==&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;sounds.json&amp;lt;/code&amp;gt; left in its current state would only be defined in-game. There is currently no way to reference the sound within a mod. To do this, we utilize the &amp;lt;code&amp;gt;SoundEvent&amp;lt;/code&amp;gt; class. Each &amp;lt;code&amp;gt;SoundEvent&amp;lt;/code&amp;gt; class holds a &amp;lt;code&amp;gt;ResourceLocation&amp;lt;/code&amp;gt; to reference a sound pointer defined in the &amp;lt;code&amp;gt;sounds.json&amp;lt;/code&amp;gt; file. The &amp;lt;code&amp;gt;sounds.json&amp;lt;/code&amp;gt; file used is determined by the namespace or the resource location passed into the class.&lt;br /&gt;
&lt;br /&gt;
For example, to reference &amp;lt;code&amp;gt;example_complex.ogg&amp;lt;/code&amp;gt;, you would store the reference name (e.g. &amp;lt;code&amp;gt;example_sound_complex&amp;lt;/code&amp;gt;) within a &amp;lt;code&amp;gt;new SoundEvent(new ResourceLocation(&amp;quot;examplemod&amp;quot;, &amp;quot;example_sound_complex&amp;quot;))&amp;lt;/code&amp;gt;. This will locate &amp;lt;code&amp;gt;assets/examplemod/sounds.json&amp;lt;/code&amp;gt; and try to find an &amp;lt;code&amp;gt;example_sound_complex&amp;lt;/code&amp;gt; object nested within it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SoundEvent&amp;lt;/code&amp;gt;s must be [[Registration|registered]] to be referenced in code. &lt;br /&gt;
&lt;br /&gt;
== Playing Sounds ==&lt;br /&gt;
&lt;br /&gt;
Vanilla has lots of methods for playing sounds that can be used in different scenarios.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(PlayerEntity, BlockPos, SoundEvent, SoundCategory, volume, pitch)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Simply forwards to overload (2), adding 0.5 to each coordinate of the BlockPos given.&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(PlayerEntity, double x, double y, double z, SoundEvent, SoundCategory, volume, pitch)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt;Client Behavior&amp;lt;/code&amp;gt;: If the passed in player is the client player, plays the sound event to the client player.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Server Behavior&amp;lt;/code&amp;gt;: Plays the sound event to everyone nearby except the passed in player. Player can be &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Usage&amp;lt;/code&amp;gt;: The correspondence between the behaviors implies that these two methods are to be called from some player-initiated code that will be run on both logical sides at the same time - the logical client handles playing it to the user and the logical server handles everyone else hearing it without re-playing it to the original user. They can also be used to play any sound in general at any position server-side by calling it on the logical server and passing in a &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; player, thus letting everyone hear it.&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(double x, double y, double z, SoundEvent, SoundCategory, volume, pitch, distanceDelay)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt;Client Behavior&amp;lt;/code&amp;gt;: Just plays the sound event in the client world. If distanceDelay is true, then delays the sound based on how far it is from the player.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Server Behavior&amp;lt;/code&amp;gt;: Does nothing.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Usage&amp;lt;/code&amp;gt;: This method only works client-side, and thus is useful for sounds sent in custom packets, or other client-only effect-type sounds. Used for thunder.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt; ClientWorld &amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(BlockPos, SoundEvent, SoundCategory, volume, pitch, distanceDelay)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Simply forwards to &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt;‘s overload (3), adding 0.5 to each coordinate of the &amp;lt;code&amp;gt;BlockPos&amp;lt;/code&amp;gt; given.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt; Entity &amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(SoundEvent, volume, pitch)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Forwards to &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt;‘s overload (2), passing in &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; as the player.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Client Behavior&amp;lt;/code&amp;gt;: Does nothing.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Server Behavior&amp;lt;/code&amp;gt;: Plays the sound event to everyone at this entity’s position.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Usage&amp;lt;/code&amp;gt;: Emitting any sound from any non-player entity server-side.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt; PlayerEntity&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(SoundEvent, volume, pitch)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; (overriding the one in &amp;lt;code&amp;gt;[[latest:advanced:effects:sounds#Entity|Entity]]&amp;lt;/code&amp;gt;)&lt;br /&gt;
#* Forwards to &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt;‘s overload (2), passing in &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; as the player.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Client Behavior&amp;lt;/code&amp;gt;: Does nothing, see override in &amp;lt;code&amp;gt;[[latest:advanced:effects:sounds#clientplayerentity|ClientPlayerEntity]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Server Behavior&amp;lt;/code&amp;gt;: Plays the sound to everyone nearby &amp;lt;code&amp;gt;except&amp;lt;/code&amp;gt; this player.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Usage&amp;lt;/code&amp;gt;: See [[latest:advanced:effects:sounds#clientplayerentity|ClientPlayerEntity]].&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt; ClientPlayerEntity&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;playSound(SoundEvent, volume, pitch)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; (overriding the one in &amp;lt;code&amp;gt;[[latest:advanced:effects:sounds#playerentity|PlayerEntity]]&amp;lt;/code&amp;gt;)&lt;br /&gt;
#* Forwards to &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt;‘s overload (2), passing in &amp;lt;code&amp;gt;this&amp;lt;/code&amp;gt; as the player.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Client Behavior&amp;lt;/code&amp;gt;: Just plays the Sound Event.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Server Behavior&amp;lt;/code&amp;gt;: Method is client-only.&lt;br /&gt;
#* &amp;lt;code&amp;gt;Usage&amp;lt;/code&amp;gt;: Just like the ones in &amp;lt;code&amp;gt;World&amp;lt;/code&amp;gt;, these two overrides in the player classes seem to be for code that runs together on both sides. The client handles playing the sound to the user, while the server handles everyone else hearing it without re-playing to the original user.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Particles&amp;diff=2175</id>
		<title>Particles</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Particles&amp;diff=2175"/>
		<updated>2020-10-25T11:37:19Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Particles are one of the few effects within the game that are used as polish to better improve immersion. Their usefulness also requires great caution due to how they are created and referenced in the game.&lt;br /&gt;
&lt;br /&gt;
== Sided Issues ==&lt;br /&gt;
Particles are problematic due to their presence only on the [[Sides|physical client]]. They have no existence on a server whatsoever. This means that if specific data from a server is needed, it needs to be synced from the server to create the particle on the client.&lt;br /&gt;
&lt;br /&gt;
== Creating a Particle ==&lt;br /&gt;
A particle can be broken up into four distinct classes. On the server, a &amp;lt;code&amp;gt;ParticleType&amp;lt;?&amp;gt;&amp;lt;/code&amp;gt; holds an &amp;lt;code&amp;gt;IParticleData&amp;lt;/code&amp;gt; to sync the information. On the client, an &amp;lt;code&amp;gt;IParticleFactory&amp;lt;/code&amp;gt; is used to generate a &amp;lt;code&amp;gt;Particle&amp;lt;/code&amp;gt; from the synced &amp;lt;code&amp;gt;IParticleData&amp;lt;/code&amp;gt;. To be more specific, a &amp;lt;code&amp;gt;ParticleType&amp;lt;?&amp;gt;&amp;lt;/code&amp;gt; holds the registry reference of the particle itself. An &amp;lt;code&amp;gt;IParticleData&amp;lt;/code&amp;gt; hooks into a &amp;lt;code&amp;gt;ParticleType&amp;lt;?&amp;gt;&amp;lt;/code&amp;gt; to send information to the &amp;lt;code&amp;gt;IParticleFactory&amp;lt;/code&amp;gt;. An &amp;lt;code&amp;gt;IParticleFactory&amp;lt;/code&amp;gt; creates the specified particle in some place within the world. Then, the &amp;lt;code&amp;gt;Particle&amp;lt;/code&amp;gt; goes and handles the rendering logic to make it appear in game.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;ParticleType&amp;lt;/code&amp;gt;s ===&lt;br /&gt;
&lt;br /&gt;
While there are a lot of different particles in vanilla, in almost all cases vanilla uses &amp;lt;code&amp;gt;BasicParticleType&amp;lt;/code&amp;gt;, a basic implementation of &amp;lt;code&amp;gt;ParticleType&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;IParticleData&amp;lt;/code&amp;gt;. This is used whenever server data is not necessary to spawn the particle. The only vanilla particles that do not use &amp;lt;code&amp;gt;BasicParticleType&amp;lt;/code&amp;gt; are redstone dust and block/item texture dependent particles. When requiring server data, a direct implementation of &amp;lt;code&amp;gt;IParticleData&amp;lt;/code&amp;gt; is needed. A good way is to extend &amp;lt;code&amp;gt;ParticleType&amp;lt;?&amp;gt;&amp;lt;/code&amp;gt; and implement &amp;lt;code&amp;gt;IParticleData&amp;lt;/code&amp;gt; on the same class. In the case of a more generic solution, an implementation of &amp;lt;code&amp;gt;IParticleData&amp;lt;/code&amp;gt; can be referenced while the standard &amp;lt;code&amp;gt;ParticleType&amp;lt;?&amp;gt;&amp;lt;/code&amp;gt; class is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ParticleType&amp;lt;/code&amp;gt;s must be [[Registration#registering-things|registered]]. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;IParticleData&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Beside the standard reference to a &amp;lt;code&amp;gt;ParticleType&amp;lt;?&amp;gt;&amp;lt;/code&amp;gt;, an &amp;lt;code&amp;gt;IParticleData&amp;lt;/code&amp;gt; is made up of two main methods and two accessory methods for compatibility across Minecraft usage.&lt;br /&gt;
&lt;br /&gt;
First there are the sync methods:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
IParticleData#write(PacketBuffer)&lt;br /&gt;
&lt;br /&gt;
IParticleData$IDeserializer#read(ParticleType, PacketBuffer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These two are used to sync information across the network. All information from the server should be synced in this fashion.&lt;br /&gt;
&lt;br /&gt;
The other two are for compatibility with other Minecraft systems:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
IParticleData#getParameters&lt;br /&gt;
&lt;br /&gt;
IParticleData$IDeserializer#deserialize(ParticleType, StringReader)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These two are used to read/write data to NBT as well as get information to spawn the particle in the world using a command.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;Particle&amp;lt;/code&amp;gt;s === &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Particle&amp;lt;/code&amp;gt;s will be left as an exercise to the reader as it is mainly about deciding what the reader wants to render to the screen. One of the most common classes to subclass, however, is &amp;lt;code&amp;gt;SpriteTexturedParticle&amp;lt;/code&amp;gt;. This abstract class renders a texture specified by the user as the particle to go according to the logic rendered.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;IParticleFactory&amp;lt;/code&amp;gt;s ===&lt;br /&gt;
Finally, a particle must be created using an &amp;lt;code&amp;gt;IParticleFactory&amp;lt;/code&amp;gt;. This simply just decides where the particle should be placed in the world at some speed in most cases. Since a &amp;lt;code&amp;gt;Particle&amp;lt;/code&amp;gt; is not beholden to any particular &amp;lt;code&amp;gt;ParticleType&amp;lt;?&amp;gt;&amp;lt;/code&amp;gt;, it can be reused over and over again in different factories if necessary.&lt;br /&gt;
&lt;br /&gt;
An &amp;lt;code&amp;gt;IParticleFactory&amp;lt;/code&amp;gt; must be attached to a &amp;lt;code&amp;gt;ParticleType&amp;lt;/code&amp;gt; using &amp;lt;code&amp;gt;ParticleManager#registerFactory&amp;lt;/code&amp;gt;. This should be called during &amp;lt;code&amp;gt;ParticleFactoryRegisterEvent&amp;lt;/code&amp;gt; on the mod event bus.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Important|content=&amp;lt;code&amp;gt;IParticleFactory&amp;lt;/code&amp;gt; is only present on the client, so the event needs to be isolated via &amp;lt;code&amp;gt;DistExecutor&amp;lt;/code&amp;gt; or some other method.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Spawning Particles ==&lt;br /&gt;
Particles can be spawned from a world instance. Each side, however, has a specific way of calling them. The &amp;lt;code&amp;gt;ClientWorld&amp;lt;/code&amp;gt; can call either &amp;lt;code&amp;gt;addParticle&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;addOptionalParticle&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;ServerWorld&amp;lt;/code&amp;gt; must call &amp;lt;code&amp;gt;spawnParticle&amp;lt;/code&amp;gt; as it sends a packet to the client world to call one of the other two methods. Calling the two &amp;lt;code&amp;gt;ClientWorld&amp;lt;/code&amp;gt; methods on the server will result in nothing happening.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Potions&amp;diff=2174</id>
		<title>Potions</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Potions&amp;diff=2174"/>
		<updated>2020-10-25T11:27:19Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &amp;lt;code&amp;gt;Potion&amp;lt;/code&amp;gt; is simply a list of &amp;lt;code&amp;gt;Effect&amp;lt;/code&amp;gt;s to be applied when used. Each &amp;lt;code&amp;gt;Potion&amp;lt;/code&amp;gt; gets applied to every &amp;lt;code&amp;gt;Items#POTION&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Items#SPLASH_POTION&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Items#LINGERING_POTION&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;Items#TIPPED_ARROW&amp;lt;/code&amp;gt;. Like effects, potions need to be [[Registration|registered]].&lt;br /&gt;
&lt;br /&gt;
== Creating a &amp;lt;code&amp;gt;Potion&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;Potion&amp;lt;/code&amp;gt; requires a passed in list of &amp;lt;code&amp;gt;EffectInstance&amp;lt;/code&amp;gt;s to apply to the player when the potion is &amp;quot;consumed&amp;quot;. There is also a nullable parameter called &amp;lt;code&amp;gt;baseName&amp;lt;/code&amp;gt; that can be set if you would like to use the same name for multiple potions (e.g. a &amp;lt;code&amp;gt;SWIFTNESS&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LONG_SWIFTNESS&amp;lt;/code&amp;gt; entry can be both &amp;lt;code&amp;gt;swiftness&amp;lt;/code&amp;gt; potions).&lt;br /&gt;
&lt;br /&gt;
== Adding a Brewing Recipe ==&lt;br /&gt;
&lt;br /&gt;
Brewing Recipes can be added using &amp;lt;code&amp;gt;BrewingRecipeRegistry::addRecipe&amp;lt;/code&amp;gt;. The most common constructor takes in an &amp;lt;code&amp;gt;Ingredient&amp;lt;/code&amp;gt; input, an &amp;lt;code&amp;gt;Ingredient&amp;lt;/code&amp;gt; reactant, and an &amp;lt;code&amp;gt;ItemStack&amp;lt;/code&amp;gt; output. This can be registered during &amp;lt;code&amp;gt;FMLCommonSetupEvent&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Important|content=If you want to use NBT information in your inputs (e.g. create a potion from another potion), you need to pass in an &amp;lt;code&amp;gt;NBTIngredient&amp;lt;/code&amp;gt; instead.}}&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Alert|content=&amp;lt;code&amp;gt;BrewingRecipeRegistry&amp;lt;/code&amp;gt; is '''not''' thread-safe. It should be called within &amp;lt;code&amp;gt;enqueueWork&amp;lt;/code&amp;gt; in the specified parallel dispatch event.}}&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Mob_Effects&amp;diff=2173</id>
		<title>Mob Effects</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Mob_Effects&amp;diff=2173"/>
		<updated>2020-10-25T11:20:38Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An &amp;lt;code&amp;gt;Effect&amp;lt;/code&amp;gt; is what handles the specific logic on the entity it is on. For example, &amp;lt;code&amp;gt;Effects#SPEED&amp;lt;/code&amp;gt; adds an attribute modifier that affects the movement speed while &amp;lt;code&amp;gt;Effects#WITHER&amp;lt;/code&amp;gt; attacks the entity from a &amp;lt;code&amp;gt;DamageSource&amp;lt;/code&amp;gt; whenever the potion effect is ready to be applied.&lt;br /&gt;
&lt;br /&gt;
== Creating an &amp;lt;code&amp;gt;Effect&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
You can create an &amp;lt;code&amp;gt;Effect&amp;lt;/code&amp;gt; using two methods. The first creates a regular &amp;lt;code&amp;gt;Effect&amp;lt;/code&amp;gt; and applies the logic in some event method. The other method involves extending the &amp;lt;code&amp;gt;Effect&amp;lt;/code&amp;gt; class and overriding specific methods when needed. This documentation will focus on the second method.&lt;br /&gt;
&lt;br /&gt;
There are four methods that are important depending on the type of effect you are creating. In each scenario, you should take into account whether you should extend &amp;lt;code&amp;gt;Effect&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;InstantEffect&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here are the classes and methods to review:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!Class !!Usage &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;Effect&amp;lt;/code&amp;gt;   ||  The basic effect class. Should be used if the effect happens over time. &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;InstantEffect&amp;lt;/code&amp;gt;   ||  An extended version of the effect class. Should be used if the effect happens only once and instantly. &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!Method !!Description &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;isReady&amp;lt;/code&amp;gt;   ||  Determines how fast an effect should call &amp;lt;code&amp;gt;performEffect&amp;lt;/code&amp;gt; while applied. This is overridden by &amp;lt;code&amp;gt;InstantEffect&amp;lt;/code&amp;gt; to occur after one tick. If too fast, the server will not have enough time to execute the damage on the entity. &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;performEffect&amp;lt;/code&amp;gt;   ||  Executes the logic on the entity when called. &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;isInstant&amp;lt;/code&amp;gt;   ||  Determines if the effect is instant. Returns true in &amp;lt;code&amp;gt;InstantEffect&amp;lt;/code&amp;gt;. &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;affectEntity&amp;lt;/code&amp;gt;   ||  Executes the logic on the entity when called. &amp;lt;code&amp;gt;isInstant&amp;lt;/code&amp;gt; must return true for this to be called. &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you are only modifying an entity &amp;lt;code&amp;gt;Attribute&amp;lt;/code&amp;gt;, then there is no need to extend the class. When constructing the effect instance, chain &amp;lt;code&amp;gt;addAttributeModifier&amp;lt;/code&amp;gt; and select the specific attribute, it's unique id, the amount to affect by, and the operation to apply the amount with.&lt;br /&gt;
&lt;br /&gt;
Effects need to be [[Registration|registered]].&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;EffectInstance&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
To allow greater customization, each effect is passed in as an &amp;lt;code&amp;gt;EffectInstance&amp;lt;/code&amp;gt; which allows the user to specify additional information for what the effect should do.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=DynamicOps&amp;diff=2172</id>
		<title>DynamicOps</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=DynamicOps&amp;diff=2172"/>
		<updated>2020-10-25T11:14:31Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;code&amp;gt;DynamicOps&amp;lt;/code&amp;gt; is a helper interface that's used to convert files into data types and vice versa. Their usages will probably never be explored by most modders. They are overshadowed by [[latest:advanced:handle:codecs|codecs]].&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;NBTDynamicOps&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;NBTDynamicOps&amp;lt;/code&amp;gt; is a handler that converts an NBT file to an &amp;lt;code&amp;gt;INBT&amp;lt;/code&amp;gt; tag. They are also used to parse information from codecs to send them across networks.&lt;br /&gt;
&lt;br /&gt;
There is only one public instance of &amp;lt;code&amp;gt;NBTDynamicOps&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;INSTANCE&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;JsonOps&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;JsonOps&amp;lt;/code&amp;gt; are similar in which they convert a JSON file into a &amp;lt;code&amp;gt;JsonElement&amp;lt;/code&amp;gt;. These are usually used in conjunction with codecs as well to serialize/deserialize instances.&lt;br /&gt;
&lt;br /&gt;
There are two public instances of &amp;lt;code&amp;gt;JsonOps&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;INSTANCE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;COMPRESSED&amp;lt;/code&amp;gt;. Compressed data is represented as a single string to read/write. However, this is never used within vanilla itself.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Datageneration/States_and_Models&amp;diff=2171</id>
		<title>Datageneration/States and Models</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Datageneration/States_and_Models&amp;diff=2171"/>
		<updated>2020-10-25T11:10:56Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The model providers are a specific type of data generators for defining models. All model providers are a subclass of &amp;lt;code&amp;gt;ModelProvider&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ModelProvider&amp;lt;/code&amp;gt; provides methods to define models for blocks and items alike: cubes, single textures, doors, slabs, and even custom non-data-generated models as parent models.&lt;br /&gt;
&lt;br /&gt;
== Existing Files  ==&lt;br /&gt;
All references to textures or other data files not generated for data generation must reference existing files on the system. This is to ensure that all referenced textures are in the correct places, so typos can be found and corrected.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ExistingFileHelper&amp;lt;/code&amp;gt; is the class responsible for validating the existence of those data files. An instance can be retrieved from &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;GatherDataEvent#getExistingFileHelper()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--existing &amp;lt;folderpath&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; argument allows the specified folder and its subfolders to be used when validating the existence of files. By default, only the vanilla datapack and resources are available to the &amp;lt;code&amp;gt;ExistingFileHelper&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
There are three main abstract implementations of &amp;lt;code&amp;gt;ModelProvider&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;ItemModelProvider&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BlockModelProvider&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;BlockStateProvider&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For items, use &amp;lt;code&amp;gt;ItemModelProvider&amp;lt;/code&amp;gt; to define their models: override &amp;lt;code&amp;gt;#generateModels&amp;lt;/code&amp;gt; and use the helper methods.&lt;br /&gt;
&lt;br /&gt;
For blocks, it is recommended to use &amp;lt;code&amp;gt;BlockStateProvider&amp;lt;/code&amp;gt; to define the blockstates, models, and their item models in a single class. It contains an instance of both &amp;lt;code&amp;gt;BlockModelProvider&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ItemModelProvider&amp;lt;/code&amp;gt;, which can be accessed through &amp;lt;code&amp;gt;#models()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;#itemModels()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;BlockModelProvider&amp;lt;/code&amp;gt; is used to define only block models.&lt;br /&gt;
&lt;br /&gt;
Call &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;#getVariantBuilder(Block)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to get a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;VariantBlockStateBuilder&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for building a blockstate with different variants, or &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;#getMultipartBuilder(Block)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to get a &amp;lt;code&amp;gt;MultiPartBlockStateBuilder&amp;lt;/code&amp;gt; for building a blockstate using multiparts.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Datageneration/Recipes&amp;diff=2170</id>
		<title>Datageneration/Recipes</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Datageneration/Recipes&amp;diff=2170"/>
		<updated>2020-10-25T11:04:02Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Recipes can be generated by creating an extension of Minecraft's &amp;lt;code&amp;gt;RecipeProvider&amp;lt;/code&amp;gt; class. From there, recipes can be registered by overriding &amp;lt;code&amp;gt;RecipeProvider#registerRecipes&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Info|content=Remove the &amp;lt;code&amp;gt;super&amp;lt;/code&amp;gt; call within the method. Otherwise, you will generate all recipes from Minecraft as well.}}&lt;br /&gt;
&lt;br /&gt;
== Recipe Builders ==&lt;br /&gt;
&lt;br /&gt;
All recipes need to be formatted as an &amp;lt;code&amp;gt;IFinishedRecipe&amp;lt;/code&amp;gt;. Each vanilla recipe has a static constructor builder that can be used to create a finished recipe. These can be built by passing the required parameters and then calling &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;#build&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;block important&amp;gt;All recipes must have a different path. If two recipes have the same result, use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;#build(Consumer&amp;lt;IFinishedRecipe&amp;gt;, ResourceLocation)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; instead. This will allow you to specify a different name for the recipe such that it will not override the other.&amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are six vanilla recipe builders: &amp;lt;code&amp;gt;ShapedRecipeBuilder&amp;lt;/code&amp;gt; for shaped recipes, &amp;lt;code&amp;gt;ShapelessRecipeBuilder&amp;lt;/code&amp;gt; for shapeless recipes, &amp;lt;code&amp;gt;CookingRecipeBuilder&amp;lt;/code&amp;gt; for furnace type recipes, &amp;lt;code&amp;gt;CustomRecipeBuilder&amp;lt;/code&amp;gt; for nondeterministic logic, &amp;lt;code&amp;gt;SingleItemRecipeBuilder&amp;lt;/code&amp;gt; for stonecutting recipes, and &amp;lt;code&amp;gt;SmithingRecipeBuilder&amp;lt;/code&amp;gt; for smithing recipes.&lt;br /&gt;
&lt;br /&gt;
For any recipe to be valid, a criterion must be met to obtain the recipe within the recipe book. This can be attached via &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;#addCriterion&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;RecipeProvider&amp;lt;/code&amp;gt; class has some basic criteria creators to check whether a player's inventory has a certain item or whether a player has entered into a specific block.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;ConditionalRecipe&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
To specify if a recipe should be loaded at runtime, a &amp;lt;code&amp;gt;ConditionalRecipe&amp;lt;/code&amp;gt; can be used in conjunction with a recipe builder. Conditions must be added before the recipe via &amp;lt;code&amp;gt;ConditionalRecipe$Builder#addCondition&amp;lt;/code&amp;gt;. Then, once a recipe is added, all previous conditions are cleared for the next to be added. There are a few helper methods for conditions that can be implemented via &amp;lt;code&amp;gt;IConditionBuilder&amp;lt;/code&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Datageneration&amp;diff=2169</id>
		<title>Datageneration</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Datageneration&amp;diff=2169"/>
		<updated>2020-10-25T10:50:46Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Intial Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Data generators are a way to programmatically generate the assets and data of mods. It allows the definition of the contents of these files in the code and their automatic generation, without worrying about the specifics.&lt;br /&gt;
&lt;br /&gt;
The data generator 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 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;
* &amp;lt;code&amp;gt;Client Assets&amp;lt;/code&amp;gt;&lt;br /&gt;
** Generates client-only files in &amp;lt;code&amp;gt;assets&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;block&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;item&amp;lt;/code&amp;gt; models, &amp;lt;code&amp;gt;blockstate JSON&amp;lt;/code&amp;gt;s, 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;
* &amp;lt;code&amp;gt;Server Data&amp;lt;/code&amp;gt;&lt;br /&gt;
** Generates server-only files in &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;recipes&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;advancements&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;tags&amp;lt;/code&amp;gt;, 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;
* &amp;lt;code&amp;gt;Development Tools&amp;lt;/code&amp;gt;&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;
* &amp;lt;code&amp;gt;Reports&amp;lt;/code&amp;gt;&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 actually define what data will be generated and provided. All data providers implement &amp;lt;code&amp;gt;IDataProvider&amp;lt;/code&amp;gt;. Minecraft has abstract implementations for most assets and data, so modders need only to extend 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;
=== 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;
&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;#registerRecipes&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;#registerTags&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Tip|content=An &amp;lt;code&amp;gt;AdvancementProvider&amp;lt;/code&amp;gt; class does exists, however it is hardcoded for only the vanilla advancements.}}&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Toolchain&amp;diff=2159</id>
		<title>Toolchain</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Toolchain&amp;diff=2159"/>
		<updated>2020-10-24T22:03:17Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: changed ref to right position&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will explain &amp;lt;code&amp;gt;decompile&amp;lt;/code&amp;gt;-&amp;gt;&amp;lt;code&amp;gt;deobfuscate&amp;lt;/code&amp;gt;-&amp;gt;&amp;lt;code&amp;gt;reobfuscate&amp;lt;/code&amp;gt; process that forge uses when you install the &amp;lt;code&amp;gt;MDK&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Why we need to do this ==&lt;br /&gt;
Minecraft is a commercial game, which means the source code is locked away, and not only is the source code unavailable to us, but they obfuscate the game code.&lt;br /&gt;
&lt;br /&gt;
If you look into the client/server JAR, you'll see that all the class names have short, nonsense names like &amp;lt;code&amp;gt;aa&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ab&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;xy&amp;lt;/code&amp;gt;, etc. This is called Obfuscating.&lt;br /&gt;
The problem is, we don't&amp;lt;ref name=&amp;quot;license&amp;quot;&amp;gt;Mojang recently released this information in what we call &amp;lt;code&amp;gt;mojmappings&amp;lt;/code&amp;gt;, but the licensing is a bit iffy [https://cpw.github.io/MinecraftMappingData For more info]&amp;lt;/ref&amp;gt; have the information to convert those nonsensical names to readable, understandable names.&lt;br /&gt;
So we need a toolchain to make it possible for us to read the source code so we can mod the game.&lt;br /&gt;
&lt;br /&gt;
For more information about [https://en.wikipedia.org/wiki/Obfuscation_(software) Obfiscating].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Deobfuscation ==&lt;br /&gt;
First the obfuscated names need unique names. Since there could be some methods with the same name, the resulting code then would not compile.&lt;br /&gt;
&lt;br /&gt;
For this all of these obfuscated classes/methods/fields are assigned a number. This number increments sequentially and is called the &amp;lt;code&amp;gt;SRG ID&amp;lt;/code&amp;gt;((SRG stands for Searge, which was one of the co-founders of the original set of scripts and programs which did this in the beginning)) of that class/method/field, this ensures all these classes/methods/fields (henceforth called members) have a unique name.\\&lt;br /&gt;
These IDs are converted to &amp;lt;code&amp;gt;SRG&amp;lt;/code&amp;gt; names, also called &amp;lt;code&amp;gt;Notch names&amp;lt;/code&amp;gt;, simply by combining their ID and the type of member\\&lt;br /&gt;
&amp;lt;code&amp;gt;class&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;c_XXX_&amp;lt;/code&amp;gt; (you won't ever see this because of reasons, explained later)\\&lt;br /&gt;
&amp;lt;code&amp;gt;function&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;func_XXX_&amp;lt;/code&amp;gt;\\&lt;br /&gt;
&amp;lt;code&amp;gt;field&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;field_XXX_&amp;lt;/code&amp;gt;\\&lt;br /&gt;
&amp;lt;code&amp;gt;parameter&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;p_XXX_X_&amp;lt;/code&amp;gt; (there are two types of parameter names, also explained later)\\&lt;br /&gt;
These Ids will be gernerated automatically.&lt;br /&gt;
&lt;br /&gt;
== Decompilation ==&lt;br /&gt;
More general [https://en.wikipedia.org/wiki/Decompiler  info]&lt;br /&gt;
&lt;br /&gt;
=== FernFlower/ForgeFlower ===&lt;br /&gt;
Forge uses [https://github.com/MinecraftForge/ForgeFlower ForgeFlower], which is a Fork of [https://github.com/MinecraftForge/FernFlower FernFlower]. &lt;br /&gt;
FernFlower is a decompiler that takes the compiled Minecraft Jar and turn it in to semi readable source code. &lt;br /&gt;
&lt;br /&gt;
Why semi readable?&amp;lt;br &amp;gt;&lt;br /&gt;
Because the decompiler has no sense of formatting or indentation.&lt;br /&gt;
&lt;br /&gt;
== Mappings ==&lt;br /&gt;
We don't need this step but coding with the &amp;lt;code&amp;gt;SRG&amp;lt;/code&amp;gt; names is hard and not really fun.&lt;br /&gt;
So we need to take the &amp;lt;code&amp;gt;SRG&amp;lt;/code&amp;gt; names and make them more user friendly, the user friendly names are community sourced names.&lt;br /&gt;
Since &amp;lt;code&amp;gt;SRG&amp;lt;/code&amp;gt; names are uniquely identifiable, due to the unique ID, it literally does a search-and-replace on all the source code text to do that &amp;lt;code&amp;gt;SRG&amp;lt;/code&amp;gt;-&amp;gt;&amp;lt;code&amp;gt;MCP&amp;lt;/code&amp;gt;(( &amp;lt;code&amp;gt;MCP&amp;lt;/code&amp;gt; stands for ModCoderPack (or previously, Minecraft Coder Pack) which was the toolchain that did all of this before the advent of ForgeGradle)) application.&lt;br /&gt;
&lt;br /&gt;
== Some additional Infos ==&lt;br /&gt;
# You will never see c_XXX_ for classes, because the class names are picked beforehand&lt;br /&gt;
#* this is still crowdsourced, but before a new version is ready for Forge, all classes are given an &amp;lt;code&amp;gt;MCP&amp;lt;/code&amp;gt; name&lt;br /&gt;
#* this &amp;lt;code&amp;gt;MCP&amp;lt;/code&amp;gt; name stays constant throughout the game version it was picked for; it can change between versions, but it usually wont for already-named classes (except for misspells, typos, and misnames)&lt;br /&gt;
# If you look into the JAR, you won't see any packages for the obfuscated classes, but the deobfuscated classes do have the packages, this is because the same process that names the classes, also decides what package they belong to&lt;br /&gt;
# parameters have special names&lt;br /&gt;
#* there are two types of parameter names: &amp;lt;code&amp;gt;p_XXX_X_&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;p_iXXX_X_&amp;lt;/code&amp;gt;&lt;br /&gt;
#* the one with the i means that it's a parameter for a constructor&lt;br /&gt;
#* the first set of numbers are the SRG ID of their parent method, and the second number denotes the index of the parameter&lt;br /&gt;
#* the index of the parameter is a bit more involved, but this will not be explained here&lt;br /&gt;
# If you look into the source, you'll see that parameters for lambdas don't have mapped names&lt;br /&gt;
#* This is because of a complication in how the lambdas are compiled/decompiled; it's a more advanced topic which involves how the compiler compiles lambdas which we will not explain here.&lt;br /&gt;
&lt;br /&gt;
== Reobfuscation ==&lt;br /&gt;
TBD&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Toolchain&amp;diff=2158</id>
		<title>Toolchain</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Toolchain&amp;diff=2158"/>
		<updated>2020-10-24T22:00:55Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will explain &amp;lt;code&amp;gt;decompile&amp;lt;/code&amp;gt;-&amp;gt;&amp;lt;code&amp;gt;deobfuscate&amp;lt;/code&amp;gt;-&amp;gt;&amp;lt;code&amp;gt;reobfuscate&amp;lt;/code&amp;gt; process that forge uses when you install the &amp;lt;code&amp;gt;MDK&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Why we need to do this ==&lt;br /&gt;
Minecraft is a commercial game, which means the source code is locked away, and not only is the source code unavailable to us, but they obfuscate the game code.&lt;br /&gt;
&lt;br /&gt;
If you look into the client/server JAR, you'll see that all the class names have short, nonsense names like &amp;lt;code&amp;gt;aa&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ab&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;xy&amp;lt;/code&amp;gt;, etc. This is called Obfuscating.&lt;br /&gt;
The problem is, we don't((Mojang recently released this information in what we call &amp;lt;code&amp;gt;mojmappings&amp;lt;/code&amp;gt;, but the licensing is a bit iffy&amp;lt;ref name=&amp;quot;license&amp;quot;&amp;gt;[https://cpw.github.io/MinecraftMappingData For more info]&amp;lt;/ref&amp;gt; have the information to convert those nonsensical names to readable, understandable names.&lt;br /&gt;
So we need a toolchain to make it possible for us to read the source code so we can mod the game.&lt;br /&gt;
&lt;br /&gt;
For more information about [https://en.wikipedia.org/wiki/Obfuscation_(software) Obfiscating].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Deobfuscation ==&lt;br /&gt;
First the obfuscated names need unique names. Since there could be some methods with the same name, the resulting code then would not compile.&lt;br /&gt;
&lt;br /&gt;
For this all of these obfuscated classes/methods/fields are assigned a number. This number increments sequentially and is called the &amp;lt;code&amp;gt;SRG ID&amp;lt;/code&amp;gt;((SRG stands for Searge, which was one of the co-founders of the original set of scripts and programs which did this in the beginning)) of that class/method/field, this ensures all these classes/methods/fields (henceforth called members) have a unique name.\\&lt;br /&gt;
These IDs are converted to &amp;lt;code&amp;gt;SRG&amp;lt;/code&amp;gt; names, also called &amp;lt;code&amp;gt;Notch names&amp;lt;/code&amp;gt;, simply by combining their ID and the type of member\\&lt;br /&gt;
&amp;lt;code&amp;gt;class&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;c_XXX_&amp;lt;/code&amp;gt; (you won't ever see this because of reasons, explained later)\\&lt;br /&gt;
&amp;lt;code&amp;gt;function&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;func_XXX_&amp;lt;/code&amp;gt;\\&lt;br /&gt;
&amp;lt;code&amp;gt;field&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;field_XXX_&amp;lt;/code&amp;gt;\\&lt;br /&gt;
&amp;lt;code&amp;gt;parameter&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;p_XXX_X_&amp;lt;/code&amp;gt; (there are two types of parameter names, also explained later)\\&lt;br /&gt;
These Ids will be gernerated automatically.&lt;br /&gt;
&lt;br /&gt;
== Decompilation ==&lt;br /&gt;
More general [https://en.wikipedia.org/wiki/Decompiler  info]&lt;br /&gt;
&lt;br /&gt;
=== FernFlower/ForgeFlower ===&lt;br /&gt;
Forge uses [https://github.com/MinecraftForge/ForgeFlower ForgeFlower], which is a Fork of [https://github.com/MinecraftForge/FernFlower FernFlower]. &lt;br /&gt;
FernFlower is a decompiler that takes the compiled Minecraft Jar and turn it in to semi readable source code. &lt;br /&gt;
&lt;br /&gt;
Why semi readable?&amp;lt;br &amp;gt;&lt;br /&gt;
Because the decompiler has no sense of formatting or indentation.&lt;br /&gt;
&lt;br /&gt;
== Mappings ==&lt;br /&gt;
We don't need this step but coding with the &amp;lt;code&amp;gt;SRG&amp;lt;/code&amp;gt; names is hard and not really fun.&lt;br /&gt;
So we need to take the &amp;lt;code&amp;gt;SRG&amp;lt;/code&amp;gt; names and make them more user friendly, the user friendly names are community sourced names.&lt;br /&gt;
Since &amp;lt;code&amp;gt;SRG&amp;lt;/code&amp;gt; names are uniquely identifiable, due to the unique ID, it literally does a search-and-replace on all the source code text to do that &amp;lt;code&amp;gt;SRG&amp;lt;/code&amp;gt;-&amp;gt;&amp;lt;code&amp;gt;MCP&amp;lt;/code&amp;gt;(( &amp;lt;code&amp;gt;MCP&amp;lt;/code&amp;gt; stands for ModCoderPack (or previously, Minecraft Coder Pack) which was the toolchain that did all of this before the advent of ForgeGradle)) application.&lt;br /&gt;
&lt;br /&gt;
== Some additional Infos ==&lt;br /&gt;
# You will never see c_XXX_ for classes, because the class names are picked beforehand&lt;br /&gt;
#* this is still crowdsourced, but before a new version is ready for Forge, all classes are given an &amp;lt;code&amp;gt;MCP&amp;lt;/code&amp;gt; name&lt;br /&gt;
#* this &amp;lt;code&amp;gt;MCP&amp;lt;/code&amp;gt; name stays constant throughout the game version it was picked for; it can change between versions, but it usually wont for already-named classes (except for misspells, typos, and misnames)&lt;br /&gt;
# If you look into the JAR, you won't see any packages for the obfuscated classes, but the deobfuscated classes do have the packages, this is because the same process that names the classes, also decides what package they belong to&lt;br /&gt;
# parameters have special names&lt;br /&gt;
#* there are two types of parameter names: &amp;lt;code&amp;gt;p_XXX_X_&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;p_iXXX_X_&amp;lt;/code&amp;gt;&lt;br /&gt;
#* the one with the i means that it's a parameter for a constructor&lt;br /&gt;
#* the first set of numbers are the SRG ID of their parent method, and the second number denotes the index of the parameter&lt;br /&gt;
#* the index of the parameter is a bit more involved, but this will not be explained here&lt;br /&gt;
# If you look into the source, you'll see that parameters for lambdas don't have mapped names&lt;br /&gt;
#* This is because of a complication in how the lambdas are compiled/decompiled; it's a more advanced topic which involves how the compiler compiles lambdas which we will not explain here.&lt;br /&gt;
&lt;br /&gt;
== Reobfuscation ==&lt;br /&gt;
TBD&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Access_Transformers&amp;diff=2157</id>
		<title>Access Transformers</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Access_Transformers&amp;diff=2157"/>
		<updated>2020-10-24T21:01:54Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Access Transformers are Forge's native way of allowing you to access (read &amp;lt;code&amp;gt;and &amp;lt;/code&amp;gt;write) functions that have a lower-than-ideal visibility, and/or removing finality.&lt;br /&gt;
&lt;br /&gt;
== Visibility ==&lt;br /&gt;
&lt;br /&gt;
Here's a quick rundown of the visibility options offered by Java 8:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;public&amp;lt;/code&amp;gt; visible to all classes inside and outside its package&lt;br /&gt;
* &amp;lt;code&amp;gt;protected&amp;lt;/code&amp;gt; visible only to classes inside the package and subclasses&lt;br /&gt;
* &amp;lt;code&amp;gt;default&amp;lt;/code&amp;gt; visible only to classes inside the package&lt;br /&gt;
* &amp;lt;code&amp;gt;private&amp;lt;/code&amp;gt; visible only to inside the class&lt;br /&gt;
&lt;br /&gt;
Additionally, there are final variants of each of these, each represented by the phrase &amp;quot;-f&amp;quot; on the end of the access specifier.&lt;br /&gt;
&lt;br /&gt;
== How It Works ==&lt;br /&gt;
&lt;br /&gt;
As Forge is loading, it scans the jar file for the META-INF/accesstransformers.cfg file. if it's found, it is parsed according to the specification:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code -&amp;gt;&lt;br /&gt;
NewAccessSpecifier MemberSignature # comment&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A random example to understand the syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code -&amp;gt;&lt;br /&gt;
public net.minecraft.util.palette.IResizeCallback # makes IResizeCallback public&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a valid entry is found on a line, Forge will look into the bytecode of the file where that member is defined, and change its access to whatever you desire it to be.&lt;br /&gt;
&lt;br /&gt;
This startup modification means accessing is O(1) for all accesses after this initial change, which makes it a great option for performance if you're looking at something a &amp;lt;code&amp;gt;lot.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using Access Transformers in your mod ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;block important&amp;gt;&lt;br /&gt;
You should avoid using ATs if a private variable / function you're looking at has a getter or a setter. Variables are usually private for a reason.&lt;br /&gt;
&amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 1: Uncomment the access transformer line in your build.gradle&lt;br /&gt;
&lt;br /&gt;
[[File:Access-transformers-uncomment-this-line-in-build-gradle.png|600px|frameless]]&lt;br /&gt;
&lt;br /&gt;
Step 2: Create a new file called &amp;quot;accesstransformer.cfg&amp;quot; in the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;src/main/resources/META-INF/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
Step 3: Refresh the Gradle project. This can be done natively in IDEA and Eclipse.&lt;br /&gt;
&lt;br /&gt;
== When not to use Access Transformers ==&lt;br /&gt;
* Unnecessary access transformations (e.g. using ATs to make something &amp;lt;code&amp;gt;public&amp;lt;/code&amp;gt; when it's already &amp;lt;code&amp;gt;public&amp;lt;/code&amp;gt;)&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=File:Access-transformers-uncomment-this-line-in-build-gradle.png&amp;diff=2156</id>
		<title>File:Access-transformers-uncomment-this-line-in-build-gradle.png</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=File:Access-transformers-uncomment-this-line-in-build-gradle.png&amp;diff=2156"/>
		<updated>2020-10-24T20:59:37Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Licencing ==&lt;br /&gt;
{{subst:uwl}}&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Networking_with_Entities&amp;diff=2155</id>
		<title>Networking with Entities</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Networking_with_Entities&amp;diff=2155"/>
		<updated>2020-10-24T20:48:11Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In addition to regular network messages, there are various other systems provided to handle synchronizing entity data.&lt;br /&gt;
&lt;br /&gt;
== Spawn Data ==&lt;br /&gt;
&lt;br /&gt;
In general, the spawning of modded entities is handled seperately, by Forge.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Info|content=This means that simply extending a vanilla entity class may not inherit all its behaviour here. You may need to implement certain vanilla behaviours yourself.}}&lt;br /&gt;
&lt;br /&gt;
You can add extra data to the spawn packet Forge sends by implementing the following interface.&lt;br /&gt;
&lt;br /&gt;
=== IEntityAdditionalSpawnData ===&lt;br /&gt;
&lt;br /&gt;
If your entity has data that is needed on the client, but doesn't change over time, then it can be added to the entity spawn packet using this interface. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;writeSpawnData()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;readSpawnData()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; control how the data should be en/decoded to/from the network buffer.&lt;br /&gt;
&lt;br /&gt;
== Dynamic Data ==&lt;br /&gt;
&lt;br /&gt;
=== Data Parameters ===&lt;br /&gt;
&lt;br /&gt;
This is the main vanilla system for synchronizing entity data from the server to the client. As such, a number of vanilla examples are available to refer to.&lt;br /&gt;
&lt;br /&gt;
Firstly you need a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;DataParameter&amp;lt;T&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for the data you wish to keep synchronized. This should be stored as a static final field in your entity class, obtained by calling &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;EntityDataManager.createKey()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and passing the entity class and a serializer for that type of data. The available serializer implementations can be found as static constants within the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;DataSerializers&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; class.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Alert|content=You should '''only''' create data parameters for your own entities, ''within that entity's class''. Adding parameters to entities you do not control can cause the IDs used to send that data over the network to become desynchronized, causing difficult to debug crashes.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, override &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;registerData()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and call &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;this.dataManager.register()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for each of your data parameters, passing the parameter and an initial value to use. Remember to always call &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;super.registerData()&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; first!&lt;br /&gt;
&lt;br /&gt;
You can then get and set these values via your entity's &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;dataManager&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; instance. Changes made will be synchronized to the client automatically.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Networking&amp;diff=2154</id>
		<title>Networking</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Networking&amp;diff=2154"/>
		<updated>2020-10-24T20:44:25Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: update Link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Communication between servers and clients is the backbone of a successful mod implementation.&lt;br /&gt;
&lt;br /&gt;
Read an [[Understanding Networking#overview|overview]] of why networking matters and the basic strategies in thinking about networking.&lt;br /&gt;
&lt;br /&gt;
There are a variety of techniques provided by Forge to facilitate communication - mostly built on top of [https://netty.io netty].&lt;br /&gt;
&lt;br /&gt;
The simplest, for a new mod, would be [[Using SimpleChannel|SimpleImpl]], where most of the complexity of the netty system is&lt;br /&gt;
abstracted away. It uses a message and handler style system.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
There are two primary goals in network communication:&lt;br /&gt;
&lt;br /&gt;
# Making sure the client view is &amp;quot;in sync&amp;quot; with the server view&lt;br /&gt;
#* The flower at coordinates X, Y, Z just grew&lt;br /&gt;
# Giving the client a way to tell the server that something has changed about the player&lt;br /&gt;
#* the player pressed a key&lt;br /&gt;
&lt;br /&gt;
The most common way to accomplish these goals is to pass messages between the client and the server. These messages will&lt;br /&gt;
usually be structured, containing data in a particular arrangement, for easy sending and receiving.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=SimpleChannel&amp;diff=2153</id>
		<title>SimpleChannel</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=SimpleChannel&amp;diff=2153"/>
		<updated>2020-10-24T20:42:31Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SimpleChannel is the name given to the packet system that revolves around the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;SimpleChannel&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; class. Using this system is by far the easiest way to send custom data between clients and the server.&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
First you need to create your &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;SimpleChannel&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; object. We recommend that you do this in a separate class, possibly something like &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ModidPacketHandler&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. Create your &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;SimpleChannel&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; as a static field in this class, like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
private static final String PROTOCOL_VERSION = &amp;quot;1&amp;quot;;&lt;br /&gt;
public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(&lt;br /&gt;
    new ResourceLocation(&amp;quot;mymodid&amp;quot;, &amp;quot;main&amp;quot;),&lt;br /&gt;
    () -&amp;gt; PROTOCOL_VERSION,&lt;br /&gt;
    PROTOCOL_VERSION::equals,&lt;br /&gt;
    PROTOCOL_VERSION::equals&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first argument is a name for the channel. The second argument is a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Supplier&amp;lt;String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; returning the current network protocol version. The third and fourth arguments respectively are &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Predicate&amp;lt;String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; checking whether an incoming connection protocol version is network-compatible with the client or server, respectively.&lt;br /&gt;
Here, we simply compare with the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;PROTOCOL_VERSION&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; field directly, meaning that the client and server &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;PROTOCOL_VERSION&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;s must always match or FML will deny login.&lt;br /&gt;
&lt;br /&gt;
== Protocol Versions ==&lt;br /&gt;
If your mod does not require the other side to have a specific network channel, or to be a Forge instance at all, you should take care that you properly define your version compatibility checkers (the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Predicate&amp;lt;String&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; parameters) to handle additional &amp;quot;meta-versions&amp;quot; (defined in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;NetworkRegistry&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;) that can be received by the version checker. These are:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ABSENT&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; - if this channel is missing on the other endpoint. Note that in this case, the endpoint is still a Forge endpoint, and may have other mods.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ACCEPTVANILLA&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; - if the endpoint is a vanilla (or non-Forge) endpoint.&lt;br /&gt;
&lt;br /&gt;
Returning &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;false&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for both means that this channel must be present on the other endpoint. If you just copy the code above, this is what it does. Note that these values are also used during the list ping compatibility check, which is responsible for showing the green check / red cross in the multiplayer server select screen.&lt;br /&gt;
&lt;br /&gt;
== Registering Packets ==&lt;br /&gt;
&lt;br /&gt;
Next, we must declare the types of messages that we would like to send and receive. This is done using the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;INSTANCE.registerMessage&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; method, which takes 5 parameters.&lt;br /&gt;
&lt;br /&gt;
* The first parameter is the discriminator for the packet. This is a per-channel unique ID for the packet. We recommend you use a local variable to hold the ID, and then call registerMessage using &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;id++&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. This will guarantee 100% unique IDs.&lt;br /&gt;
* The second parameter is the actual packet class &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;MSG&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
* The third parameter is a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BiConsumer&amp;lt;MSG, PacketBuffer&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; responsible for encoding the message into the provided &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;PacketBuffer&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* The fourth parameter is a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Function&amp;lt;PacketBuffer, MSG&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; responsible for decoding the message from the provided &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;PacketBuffer&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* The final parameter is a &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BiConsumer&amp;lt;MSG, Supplier&amp;lt;NetworkEvent.Context&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; responsible for handling the message itself&lt;br /&gt;
&lt;br /&gt;
The last three parameters can be method references to either static or instance methods in Java. Remember that an instance method &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;MSG.encode(PacketBuffer)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; still satisfies &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;BiConsumer&amp;lt;MSG, PacketBuffer&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;MSG&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; simply becomes the implicit first argument.&lt;br /&gt;
&lt;br /&gt;
== Handling Packets ==&lt;br /&gt;
&lt;br /&gt;
There are a couple things to highlight in a packet handler. A packet handler has both the message object and the network context available to it. The context allows access to the player that sent the packet (if on the server), and a way to enqueue threadsafe work.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public static void handle(MyMessage msg, Supplier&amp;lt;NetworkEvent.Context&amp;gt; ctx) {&lt;br /&gt;
    ctx.get().enqueueWork(() -&amp;gt; {&lt;br /&gt;
        // Work that needs to be threadsafe (most work)&lt;br /&gt;
        EntityPlayerMP sender = ctx.get().getSender(); // the client that sent this packet&lt;br /&gt;
        // do stuff&lt;br /&gt;
    });&lt;br /&gt;
    ctx.get().setPacketHandled(true);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the presence of &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;setPacketHandled&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, which used to tell the network system that the packet has successfully completed handling.&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Alert|content=Packets are by default handled on the network thread.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
That means that your handler can _not_ interact with most game objects directly.&lt;br /&gt;
Forge provides a convenient way to make your code execute on the main thread instead using &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;IThreadListener.addScheduledTask&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
Simply call &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ctx.get().enqueueWork(Runnable)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, which will call the given &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Runnable&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; on the main thread at the next opportunity.}}&lt;br /&gt;
&lt;br /&gt;
{{Colored box|title=Alert|content=Be defensive when handling packets on the server. A client could attempt to exploit the packet handling by sending unexpected data.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
A common problem is vulnerability to &amp;lt;code&amp;gt;arbitrary chunk generation&amp;lt;/code&amp;gt;. This typically happens when the server is trusting a block position sent by a client to access blocks and tile entities. When accessing blocks and tile entities in unloaded areas of the world, the server will either generate or load this area from disk, then promply write it to disk. This can be exploited to cause &amp;lt;code&amp;gt;catastrophic damage&amp;lt;/code&amp;gt; to a server's performance and storage space without leaving a trace.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To avoid this problem, a general rule of thumb is to only access blocks and tile entities if &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;world.isBlockLoaded(pos)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is true.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Sending Packets ==&lt;br /&gt;
&lt;br /&gt;
=== Sending to the Server ===&lt;br /&gt;
&lt;br /&gt;
There is but one way to send a packet to the server. This is because there is only ever *one* server the client can be connected to at once. To do so, we must again use that &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;SimpleChannel&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; that was defined earlier. Simply call &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;INSTANCE.sendToServer(new MyMessage())&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. The message will be sent to the handler for its type, if one exists.&lt;br /&gt;
&lt;br /&gt;
=== Sending to Clients ===&lt;br /&gt;
&lt;br /&gt;
Packets can be sent directly to a client using the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;SimpleChannel&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;HANDLER.sendTo(MSG, entityPlayerMP.connection.getNetworkManager(), NetworkDirection.PLAY_TO_CLIENT)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. However, this can be quite inconvenient. Forge has some convenience functions that can be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
// Sending to one player&lt;br /&gt;
INSTANCE.send(PacketDistributor.PLAYER.with(playerMP), new MyMessage());&lt;br /&gt;
&lt;br /&gt;
// Send to all players tracking this chunk&lt;br /&gt;
INSTANCE.send(PacketDistributor.TRACKING_CHUNK.with(chunk), new MyMessage());&lt;br /&gt;
&lt;br /&gt;
// Sending to all connected players&lt;br /&gt;
INSTANCE.send(PacketDistributor.ALL.noArg(), new MyMessage());&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are additional &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;PacketDistributor&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; types available, check the documentation on the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;PacketDistributor&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; class for more details.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Networking&amp;diff=2152</id>
		<title>Networking</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Networking&amp;diff=2152"/>
		<updated>2020-10-24T20:32:10Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: fixed links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Communication between servers and clients is the backbone of a successful mod implementation.&lt;br /&gt;
&lt;br /&gt;
Read an [[Understanding Networking#overview|overview]] of why networking matters and the basic strategies in thinking about networking.&lt;br /&gt;
&lt;br /&gt;
There are a variety of techniques provided by Forge to facilitate communication - mostly built on top of [https://netty.io netty].&lt;br /&gt;
&lt;br /&gt;
The simplest, for a new mod, would be [[latest:advanced:networking:simplechannel|SimpleImpl]], where most of the complexity of the netty system is&lt;br /&gt;
abstracted away. It uses a message and handler style system.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
There are two primary goals in network communication:&lt;br /&gt;
&lt;br /&gt;
# Making sure the client view is &amp;quot;in sync&amp;quot; with the server view&lt;br /&gt;
#* The flower at coordinates X, Y, Z just grew&lt;br /&gt;
# Giving the client a way to tell the server that something has changed about the player&lt;br /&gt;
#* the player pressed a key&lt;br /&gt;
&lt;br /&gt;
The most common way to accomplish these goals is to pass messages between the client and the server. These messages will&lt;br /&gt;
usually be structured, containing data in a particular arrangement, for easy sending and receiving.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Networking&amp;diff=2151</id>
		<title>Networking</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Networking&amp;diff=2151"/>
		<updated>2020-10-24T20:29:17Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Communication between servers and clients is the backbone of a successful mod implementation.&lt;br /&gt;
&lt;br /&gt;
Read an [[Understanding Networking#overview|overview]] of why networking matters and the basic strategies in thinking about networking.&lt;br /&gt;
&lt;br /&gt;
There are a variety of techniques provided by Forge to facilitate communication - mostly built on top of [[https://netty.io|netty]].&lt;br /&gt;
&lt;br /&gt;
The simplest, for a new mod, would be [[latest:advanced:networking:simplechannel|SimpleImpl]], where most of the complexity of the netty system is&lt;br /&gt;
abstracted away. It uses a message and handler style system.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
There are two primary goals in network communication:&lt;br /&gt;
&lt;br /&gt;
1. Making sure the client view is &amp;quot;in sync&amp;quot; with the server view&lt;br /&gt;
## The flower at coordinates X, Y, Z just grew&lt;br /&gt;
2. Giving the client a way to tell the server that something has changed about the player&lt;br /&gt;
## the player pressed a key&lt;br /&gt;
&lt;br /&gt;
The most common way to accomplish these goals is to pass messages between the client and the server. These messages will&lt;br /&gt;
usually be structured, containing data in a particular arrangement, for easy sending and receiving.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=BlockEntityWithoutLevelRenderer&amp;diff=2150</id>
		<title>BlockEntityWithoutLevelRenderer</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=BlockEntityWithoutLevelRenderer&amp;diff=2150"/>
		<updated>2020-10-24T20:26:10Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;code&amp;gt;ItemStackTileEntityRenderer&amp;lt;/code&amp;gt; is a class that allows custom usages of &amp;lt;code&amp;gt;MatrixStack&amp;lt;/code&amp;gt;s and &amp;lt;code&amp;gt;IRenderTypeBuffer&amp;lt;/code&amp;gt;s to render items.&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;ItemStackTileEntityRenderer&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;ItemStackTileEntityRenderer&amp;lt;/code&amp;gt; allows you to render your item by extending the class and overriding &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ItemStackTileEntityRenderer#func_239207_a_&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In order to use a ISTER, the Item must first return true for &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;IBakedModel#isBuiltInRenderer&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. It is also recommended that if you are using a block that &amp;lt;code&amp;gt;AbstractBlock#getRenderType&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;BlockRenderType#ENTITYBLOCK_ANIMATED&amp;lt;/code&amp;gt; so that it will render correctly in layers and minecarts. Once that returns true, the Item’s ISTER will be accessed for rendering. If it does not have one, it will use the default &amp;lt;code&amp;gt;ItemStackTileEntityRenderer#instance&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To set the ISTER for an Item, use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Item.Properties#setISTER&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. Each Item can only ever provide one ISTER, and the getter is final so that mods do not return new instances each frame.&lt;br /&gt;
&lt;br /&gt;
That’s it, no additional setup is necessary to use a ISTER.&lt;br /&gt;
&lt;br /&gt;
If you need to access the &amp;lt;code&amp;gt;TransformType&amp;lt;/code&amp;gt; for rendering, you can store the one passed through &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;IBakedModel#handlePerspective&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and use it during rendering. This method will always be called before &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ItemStackTileEntityRenderer#func_239207_a_&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Dynamic_Loot_Modification&amp;diff=2149</id>
		<title>Dynamic Loot Modification</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Dynamic_Loot_Modification&amp;diff=2149"/>
		<updated>2020-10-24T20:20:26Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Global Loot Modifiers are a data-driven method of handling modification of harvested drops without the need to overwrite dozens to hundreds of vanilla loot tables or to handle effects that would require interactions with another mod's loot tables without knowing what mods may be loaded. Global Loot Modifiers are also stacking, rather than last-load-wins as modifications to loot tables would be.&lt;br /&gt;
&lt;br /&gt;
== Registering a Global Loot Modifier ==&lt;br /&gt;
&lt;br /&gt;
You will need 3 things:&lt;br /&gt;
# Create a &amp;lt;code&amp;gt;global_loot_modifiers.json&amp;lt;/code&amp;gt; file at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;/data/forge/loot_modifiers/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* This will tell Forge about your modifiers and works similar to [[Tags|tags]].&lt;br /&gt;
# A serialized json representing your modifier&lt;br /&gt;
#* This will contain all of the data about your modification and allows data packs to tweak your effect.&lt;br /&gt;
# A class that extends &amp;lt;code&amp;gt;LootModifier&amp;lt;/code&amp;gt;&lt;br /&gt;
#* The operational code that makes your modifier work and associated serializer.&lt;br /&gt;
&lt;br /&gt;
Finally, the serializer for your operational class is [[Registration|registered]] as any other &amp;lt;code&amp;gt;ForgeRegistryEntry&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== The global_loot_modifiers.json ==&lt;br /&gt;
&lt;br /&gt;
All you need to add here are the registry names of your loot modifiers.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;replace&amp;quot;: false,&lt;br /&gt;
  &amp;quot;entries&amp;quot;: [&lt;br /&gt;
    &amp;quot;global_loot_test:silk_touch_bamboo&amp;quot;,&lt;br /&gt;
    &amp;quot;global_loot_test:smelting&amp;quot;,&lt;br /&gt;
    &amp;quot;global_loot_test:wheat_harvest&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;replace&amp;lt;/code&amp;gt; causes the cache of modifiers to be cleared fully when this asset loads (mods are loaded in an order that may be specified by a data pack). For modders you will want to use &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; while data pack makers may want to specify their overrides with &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;entries&amp;lt;/code&amp;gt; is an *ordered list* of the modifiers that will be loaded. Any modifier that is not listed will not be loaded and the ones listed are called in the order listed. This is primarily relevant to data pack makers for resolving conflicts between modifiers from separate mods.&lt;br /&gt;
&lt;br /&gt;
== The serialized json ==&lt;br /&gt;
&lt;br /&gt;
This file contains all of the potential variables related to your modifier, including the conditions that must be met prior to modifying any loot as well as any other parameters your modifier might have. Avoid hard-coded values where ever possible so that data pack makers can adjust balance if they wish to.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;conditions&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;condition&amp;quot;: &amp;quot;minecraft:match_tool&amp;quot;,&lt;br /&gt;
      &amp;quot;predicate&amp;quot;: {&lt;br /&gt;
        &amp;quot;item&amp;quot;: &amp;quot;minecraft:shears&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;condition&amp;quot;: &amp;quot;block_state_property&amp;quot;,&lt;br /&gt;
      &amp;quot;block&amp;quot;:&amp;quot;minecraft:wheat&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ],&lt;br /&gt;
  &amp;quot;seedItem&amp;quot;: &amp;quot;minecraft:wheat_seeds&amp;quot;,&lt;br /&gt;
  &amp;quot;numSeeds&amp;quot;: 3,&lt;br /&gt;
  &amp;quot;replacement&amp;quot;: &amp;quot;minecraft:wheat&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above example, the modification only happens if the player harvests wheat when using shears (specified by the two &amp;lt;code&amp;gt;conditions&amp;lt;/code&amp;gt; which are automatically &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt;ed together). The &amp;lt;code&amp;gt;seedsItem&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;numSeeds&amp;lt;/code&amp;gt; values are then used to count how many seeds were generated by the vanilla loot table, and if matched, are substituted for an additional &amp;lt;code&amp;gt;replacement&amp;lt;/code&amp;gt; item instead. The operation code will be shown below.&lt;br /&gt;
&amp;lt;code&amp;gt;conditions&amp;lt;/code&amp;gt; is the only object needed by the system specification, everything else is the mod maker's data.&lt;br /&gt;
&lt;br /&gt;
== The LootModifier Subclass ==&lt;br /&gt;
&lt;br /&gt;
You will also need a static child class that extends &amp;lt;code&amp;gt;GlobalLootModifierSerializer&amp;lt;T&amp;gt;&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;T&amp;lt;/code&amp;gt; is your LootModifier subclass in order to deserialize your json data file into operational code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
private static class WheatSeedsConverterModifier extends LootModifier {&lt;br /&gt;
	private final int numSeedsToConvert;&lt;br /&gt;
	private final Item itemToCheck;&lt;br /&gt;
	private final Item itemReward;&lt;br /&gt;
	public WheatSeedsConverterModifier(ILootCondition[] conditionsIn, int numSeeds, Item itemCheck, Item reward) {&lt;br /&gt;
		super(conditionsIn);&lt;br /&gt;
		numSeedsToConvert = numSeeds;&lt;br /&gt;
		itemToCheck = itemCheck;&lt;br /&gt;
		itemReward = reward;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	@Nonnull&lt;br /&gt;
	@Override&lt;br /&gt;
	public List&amp;lt;ItemStack&amp;gt; doApply(List&amp;lt;ItemStack&amp;gt; generatedLoot, LootContext context) {&lt;br /&gt;
		//*&lt;br /&gt;
		* Additional conditions can be checked, though as much as possible should be parameterized via JSON data.&lt;br /&gt;
		* It is better to write a new ILootCondition implementation than to do things here.&lt;br /&gt;
		*//&lt;br /&gt;
		int numSeeds = 0;&lt;br /&gt;
		for(ItemStack stack : generatedLoot) {&lt;br /&gt;
			if(stack.getItem() == itemToCheck)&lt;br /&gt;
				numSeeds+=stack.getCount();&lt;br /&gt;
		}&lt;br /&gt;
		if(numSeeds &amp;gt;= numSeedsToConvert) {&lt;br /&gt;
			generatedLoot.removeIf(x -&amp;gt; x.getItem() == itemToCheck);&lt;br /&gt;
			generatedLoot.add(new ItemStack(itemReward, (numSeeds/numSeedsToConvert)));&lt;br /&gt;
			numSeeds = numSeeds%numSeedsToConvert;&lt;br /&gt;
			if(numSeeds &amp;gt; 0)&lt;br /&gt;
				generatedLoot.add(new ItemStack(itemToCheck, numSeeds));&lt;br /&gt;
		}&lt;br /&gt;
		return generatedLoot;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	private static class Serializer extends GlobalLootModifierSerializer&amp;lt;WheatSeedsConverterModifier&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
		@Override&lt;br /&gt;
		public WheatSeedsConverterModifier read(ResourceLocation name, JsonObject object, ILootCondition[] conditionsIn) {&lt;br /&gt;
			int numSeeds = JSONUtils.getInt(object, &amp;quot;numSeeds&amp;quot;);&lt;br /&gt;
			Item seed = ForgeRegistries.ITEMS.getValue(new ResourceLocation((JSONUtils.getString(object, &amp;quot;seedItem&amp;quot;))));&lt;br /&gt;
			Item wheat = ForgeRegistries.ITEMS.getValue(new ResourceLocation(JSONUtils.getString(object, &amp;quot;replacement&amp;quot;)));&lt;br /&gt;
			return new WheatSeedsConverterModifier(conditionsIn, numSeeds, seed, wheat);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The critical portion is the &amp;lt;code&amp;gt;doApply&amp;lt;/code&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
This method is only called if the &amp;lt;code&amp;gt;conditions&amp;lt;/code&amp;gt; specified return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; and the modder is now able to make the modifications they desire. In this case we can see that the number of &amp;lt;code&amp;gt;itemToCheck&amp;lt;/code&amp;gt; meets or exceeds the &amp;lt;code&amp;gt;numSeedsToConvert&amp;lt;/code&amp;gt; before modifying the list by adding an &amp;lt;code&amp;gt;itemReward&amp;lt;/code&amp;gt; and removing any excess &amp;lt;code&amp;gt;itemToCheck&amp;lt;/code&amp;gt; stacks, matching the previously mentioned effects: When a wheat block is harvested with shears, if enough seeds are generated as loot, they are converted to additional wheat instead.&lt;br /&gt;
&lt;br /&gt;
Also take note of the &amp;lt;code&amp;gt;read&amp;lt;/code&amp;gt; method in the serializer. The conditions are already deserialized for you and if you have no other data, simply &amp;lt;code&amp;gt;return new MyModifier(conditionsIn)&amp;lt;/code&amp;gt;. However, the full &amp;lt;code&amp;gt;JsonObject&amp;lt;/code&amp;gt; is available if needed.&lt;br /&gt;
&lt;br /&gt;
Additional [https://github.com/MinecraftForge/MinecraftForge/blob/1.15.x/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java examples] can be found on the Forge Git repository, including silk touch and smelting effects.&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Item_Properties&amp;diff=2148</id>
		<title>Item Properties</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Item_Properties&amp;diff=2148"/>
		<updated>2020-10-24T20:02:37Z</updated>

		<summary type="html">&lt;p&gt;Unbekannt: Inital Import dokuwiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Item properties are a way for the &amp;quot;properties&amp;quot; of items to be exposed to the model system. An example is the bow, where the most important property is how far the bow has been pulled. This information is then used to choose a model for the bow, creating an animation for pulling it.&lt;br /&gt;
&lt;br /&gt;
An item property assigns a certain &amp;lt;code&amp;gt;float&amp;lt;/code&amp;gt; value to every &amp;lt;code&amp;gt;ItemStack&amp;lt;/code&amp;gt; it is registered for, and vanilla item model definitions can use these values to define “overrides”, where an item defaults to a certain model, but if an override matches, it overrides the model and uses another. They are useful mainly because of the fact that they are continuous. For example, bows use item properties to define their pull animation. Since the value of the property is a &amp;lt;code&amp;gt;float&amp;lt;/code&amp;gt;, it increases continuously from 0 to 1. This allows resource packs to add as many models as they want for the bow pulling animation along that spectrum, instead of being stuck with four “slots” for their models in the animation. The same is true of the compass and clock.&lt;br /&gt;
&lt;br /&gt;
== Adding Properties to Items  ==&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ItemModelsProperties::registerProperty&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; is used to add a property to a specific item. The &amp;lt;code&amp;gt;ResourceLocation&amp;lt;/code&amp;gt; parameter is the name given to the property (e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;new ResourceLocation(&amp;quot;pull&amp;quot;)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;). The &amp;lt;code&amp;gt;IItemPropertyGetter&amp;lt;/code&amp;gt; is a function that takes the &amp;lt;code&amp;gt;ItemStack&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;ClientWorld&amp;lt;/code&amp;gt; it’s in, and the &amp;lt;code&amp;gt;LivingEntity&amp;lt;/code&amp;gt; that holds it, returning the &amp;lt;code&amp;gt;float&amp;lt;/code&amp;gt; value for the property. Some examples are the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;pulling&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;pull&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; properties for &amp;lt;code&amp;gt;Items#BOW&amp;lt;/code&amp;gt;, and the several default ones in &amp;lt;code&amp;gt;ItemModelProperties&amp;lt;/code&amp;gt;. For modded item properties, it is recommended that the modid of the mod is used as the namespace (e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;examplemod:property&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and not just &amp;lt;code&amp;gt;property&amp;lt;/code&amp;gt;, as that really means &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;minecraft:property&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Using Overrides ==&lt;br /&gt;
A good example can be found in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;model/item/bow.json&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. For reference, here is a hypothetical example of an item with an &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;examplemod:power&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; property. If the values have no match, the default is the current model.&lt;br /&gt;
&amp;lt;block important&amp;gt;A predicate applies to all values greater than or equal to the given value.&amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;parent&amp;quot;: &amp;quot;item/generated&amp;quot;,&lt;br /&gt;
  &amp;quot;textures&amp;quot;: {&lt;br /&gt;
    &amp;quot;__comment&amp;quot;: &amp;quot;Default&amp;quot;,&lt;br /&gt;
    &amp;quot;layer0&amp;quot;: &amp;quot;examplemod:items/examplePartial&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;overrides&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;__comment&amp;quot;: &amp;quot;power &amp;gt;= .75&amp;quot;,&lt;br /&gt;
      &amp;quot;predicate&amp;quot;: {&lt;br /&gt;
        &amp;quot;examplemod:power&amp;quot;: 0.75&lt;br /&gt;
      },&lt;br /&gt;
      &amp;quot;model&amp;quot;: &amp;quot;examplemod:item/examplePowered&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
And here’s a hypothetical snippet from the supporting code. (This does not have to be client-only; it will work on a server too. In vanilla, properties are registered in the item’s constructor.)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public void clientSetup(final FMLCLientSetupEvent event) {&lt;br /&gt;
  ItemModelProperties.registerProperty(item, new ResourceLocation(&amp;quot;examplemod:power&amp;quot;), new IItemPropertyGetter() {&lt;br /&gt;
    @Override&lt;br /&gt;
    public float call(ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) {&lt;br /&gt;
      return (float)getPowerLevel(stack) / (float)getMaxPower(stack); // Some external methods&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Unbekannt</name></author>
	</entry>
</feed>