-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get values for builders in a safer way
- Loading branch information
1 parent
84221bc
commit 7b1f1ce
Showing
4 changed files
with
62 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
paper-server/patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
paper-server/patches/sources/net/minecraft/resources/RegistryOps.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- a/net/minecraft/resources/RegistryOps.java | ||
+++ b/net/minecraft/resources/RegistryOps.java | ||
@@ -117,6 +_,13 @@ | ||
public int hashCode() { | ||
return this.lookupProvider.hashCode(); | ||
} | ||
+ | ||
+ // Paper start - add method to get the value for pre-filling builders in the reg mod API | ||
+ @Override | ||
+ public HolderLookup.Provider lookupForValueCopyViaBuilders() { | ||
+ return this.lookupProvider; | ||
+ } | ||
+ // Paper end - add method to get the value for pre-filling builders in the reg mod API | ||
} | ||
|
||
public record RegistryInfo<T>(HolderOwner<T> owner, HolderGetter<T> getter, Lifecycle elementsLifecycle) { | ||
@@ -127,5 +_,7 @@ | ||
|
||
public interface RegistryInfoLookup { | ||
<T> Optional<RegistryOps.RegistryInfo<T>> lookup(ResourceKey<? extends Registry<? extends T>> registryKey); | ||
+ | ||
+ HolderLookup.Provider lookupForValueCopyViaBuilders(); // Paper - add method to get the value for pre-filling builders in the reg mod API | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters