User Tools

Site Tools


tutorial:registry

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:registry [2020/01/10 21:43] – created draylartutorial:registry [2020/08/26 09:30] – Fix getId description elisezerotwo
Line 17: Line 17:
 When registering content, you need to specify which registry you are adding content to. The base game provides registries for all vanilla content, which can be found in ''%%Registry%%''. Two examples of registries you may use include ''%%Registry.ITEM%%'' for items and ''%%Registry.BLOCK%%'' for blocks. When registering content, you need to specify which registry you are adding content to. The base game provides registries for all vanilla content, which can be found in ''%%Registry%%''. Two examples of registries you may use include ''%%Registry.ITEM%%'' for items and ''%%Registry.BLOCK%%'' for blocks.
  
-For a deeper overview and description of all available registries, read the [[#registry-types|registry types]] page.+For a deeper overview and description of all available registries, read the [[tutorial:registry_types|registry types]] page.
  
 ===== Registering Content ===== ===== Registering Content =====
Line 28: Line 28:
 } }
 </code> </code>
-**registry** - an instance of the registry you want to add content to. A list of all vanilla registries, located in ''%%Registry%%'', can be found in the [[#registry-types|registry types]] page.+**registry** - an instance of the registry you want to add content to. A list of all vanilla registries, located in ''%%Registry%%'', can be found in the [[tutorial:registry_types|registry types]] page.
  
 **id** - an identifying label for your content inside the registry. Standard convention is ''%%modid:name%%'', as seen with ''%%minecraft:dirt%%''. **id** - an identifying label for your content inside the registry. Standard convention is ''%%modid:name%%'', as seen with ''%%minecraft:dirt%%''.
Line 36: Line 36:
 ===== Registry Methods ===== ===== Registry Methods =====
  
-''%%getId%%'' - returns the ''%%Identifier%%'' associated with an entry inside a registry. If the entry doesn’t exist, ''%%DefaultedRegistry%%'' returns the default registry value, and ''%%SimpleRegistry%%'' returns null.+''%%get%%'' - returns the entry associated with an ID inside a registry. If the entry doesn’t exist, ''%%DefaultedRegistry%%'' returns the default registry value, and ''%%SimpleRegistry%%'' returns null. 
 + 
 +<code java> 
 +@Nullable 
 +public abstract T get(@Nullable Identifier id); 
 +</code> 
 + 
 +---- 
 + 
 +''%%getId%%'' - returns the ''%%Identifier%%'' associated with an entry inside a registry. If the entry doesn’t exist, ''%%DefaultedRegistry%%'' returns the default registry identifier, and ''%%SimpleRegistry%%'' returns null.
  
 <code java> <code java>
tutorial/registry.txt · Last modified: 2023/05/15 03:31 by phanabani