User Tools

Site Tools


tutorial:registry

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
tutorial:registry [2020/08/26 09:30] – Fix getId description elisezerotwotutorial:registry [2022/03/27 07:32] – Updated to the use of yarncode in place of normal code. stormyfabric
Line 23: Line 23:
 Use ''%%Registry.register%%'' for adding content to registries: Use ''%%Registry.register%%'' for adding content to registries:
  
-<code java> +<yarncode java> 
-public static <T> T register(Registry<? super T> registry, Identifier id, T entry) { +public static <T> T register(class_2378<? super T> registry, class_2960 id, T entry) { 
-    return ((MutableRegistry)registry).add(id, entry);+    return ((class_2385)registry)method_10272(id, entry);
 } }
-</code>+</yarncode>
 **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. **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.
  
Line 38: Line 38:
 ''%%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. ''%%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>+<yarncode java>
 @Nullable @Nullable
-public abstract T get(@Nullable Identifier id); +public abstract T get(@Nullable class_2960 id); 
-</code>+</yarncode>
  
 ---- ----
Line 47: Line 47:
 ''%%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. ''%%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>+<yarncode java>
 @Nullable @Nullable
-public abstract Identifier getId(T entry); +public abstract class_2960 getId(T entry); 
-</code>+</yarncode>
  
 ---- ----
Line 56: Line 56:
 ''%%getRawId%%'' - returns the internal integer ID associated with an entry inside a registry. If the entry doesn’t exist, ''%%DefaultedRegistry%%'' returns the raw ID of the default registry value, and ''%%SimpleRegistry%%'' returns -1. ''%%getRawId%%'' - returns the internal integer ID associated with an entry inside a registry. If the entry doesn’t exist, ''%%DefaultedRegistry%%'' returns the raw ID of the default registry value, and ''%%SimpleRegistry%%'' returns -1.
  
-<code java> +<yarncode java> 
-public abstract int getRawId(@Nullable T entry); +public abstract int method_7880(@Nullable T entry); 
-</code>+</yarncode>
  
tutorial/registry.txt · Last modified: 2023/05/15 03:31 by phanabani