-
-
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.
- Loading branch information
1 parent
b24dba9
commit d4e8d54
Showing
22 changed files
with
223 additions
and
81 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
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
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
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
36 changes: 36 additions & 0 deletions
36
paper-server/patches/sources/net/minecraft/core/HolderLookup.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,36 @@ | ||
--- a/net/minecraft/core/HolderLookup.java | ||
+++ b/net/minecraft/core/HolderLookup.java | ||
@@ -68,6 +_,9 @@ | ||
} | ||
|
||
public interface RegistryLookup<T> extends HolderLookup<T>, HolderOwner<T> { | ||
+ | ||
+ Optional<T> getValueForCopying(ResourceKey<T> resourceKey); // Paper - add method to get the value for pre-filling builders in the reg mod API | ||
+ | ||
ResourceKey<? extends Registry<? extends T>> key(); | ||
|
||
Lifecycle registryLifecycle(); | ||
@@ -81,6 +_,11 @@ | ||
default HolderLookup.RegistryLookup<T> filterElements(final Predicate<T> predicate) { | ||
return new HolderLookup.RegistryLookup.Delegate<T>() { | ||
@Override | ||
+ public Optional<T> getValueForCopying(final ResourceKey<T> resourceKey) { | ||
+ return this.parent().getValueForCopying(resourceKey).filter(predicate); | ||
+ } | ||
+ | ||
+ @Override | ||
public HolderLookup.RegistryLookup<T> parent() { | ||
return RegistryLookup.this; | ||
} | ||
@@ -99,6 +_,11 @@ | ||
|
||
public interface Delegate<T> extends HolderLookup.RegistryLookup<T> { | ||
HolderLookup.RegistryLookup<T> parent(); | ||
+ | ||
+ @Override | ||
+ default Optional<T> getValueForCopying(ResourceKey<T> resourceKey) { | ||
+ return this.parent().getValueForCopying(resourceKey); | ||
+ } | ||
|
||
@Override | ||
default ResourceKey<? extends Registry<? extends T>> key() { |
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
14 changes: 14 additions & 0 deletions
14
paper-server/patches/sources/net/minecraft/core/RegistrySetBuilder.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,14 @@ | ||
--- a/net/minecraft/core/RegistrySetBuilder.java | ||
+++ b/net/minecraft/core/RegistrySetBuilder.java | ||
@@ -42,6 +_,11 @@ | ||
) { | ||
return new RegistrySetBuilder.EmptyTagRegistryLookup<T>(owner) { | ||
@Override | ||
+ public Optional<T> getValueForCopying(final ResourceKey<T> resourceKey) { | ||
+ return this.get(resourceKey).map(Holder.Reference::value); | ||
+ } | ||
+ | ||
+ @Override | ||
public ResourceKey<? extends Registry<? extends T>> key() { | ||
return registryKey; | ||
} |
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
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
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
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
Oops, something went wrong.