Skip to content

Commit

Permalink
Fix inconsistency between custom registry ID getters and the vanilla …
Browse files Browse the repository at this point in the history
…one (#414)
  • Loading branch information
XFactHD authored Dec 23, 2023
1 parent 36783f0 commit 2b70b17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions patches/net/minecraft/core/MappedRegistry.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@
+
+ @Override
+ public int getId(ResourceLocation name) {
+ return toId.getOrDefault(get(name), -1);
+ return getId(get(name));
+ }
+
+ @Override
+ public int getId(ResourceKey<T> key) {
+ return toId.getOrDefault(get(key), -1);
+ return getId(get(key));
+ }
+
+ @Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,20 @@ default <C extends RegistryCallback<T>> void addCallback(Class<C> type, C callba
ResourceKey<T> resolve(ResourceKey<T> key);

/**
* Gets the integer id linked to the given key.
* Gets the integer id linked to the given key. If the key is not present in the registry, the default entry's
* integer id is returned if the registry is defaulted or {@code -1} if the registry is not defaulted
*
* @param key the resource key to lookup
* @return the integer id linked to the given key,
* or {@code -1} if the key is not present in this registry
* @return the integer id linked to the given key
*/
int getId(ResourceKey<T> key);

/**
* Gets the integer id linked to the given name.
* Gets the integer id linked to the given name. If the name is not present in the registry, the default entry's
* integer id is returned if the registry is defaulted or {@code -1} if the registry is not defaulted
*
* @param name the resource name to lookup
* @return the integer id linked to the given name,
* or {@code -1} if the name is not present in this registry
* @return the integer id linked to the given name
*/
int getId(ResourceLocation name);

Expand Down

0 comments on commit 2b70b17

Please sign in to comment.