mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
fix datapacks not being able to modify nether/end (#7588)
This commit is contained in:
parent
639b4ba80c
commit
f258c4f2e9
2 changed files with 42 additions and 0 deletions
|
@ -182,6 +182,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
buf.writeInt(this.playerId);
|
||||
diff --git a/src/main/java/net/minecraft/resources/RegistryLoader.java b/src/main/java/net/minecraft/resources/RegistryLoader.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/resources/RegistryLoader.java
|
||||
+++ b/src/main/java/net/minecraft/resources/RegistryLoader.java
|
||||
@@ -0,0 +0,0 @@ public class RegistryLoader {
|
||||
}
|
||||
|
||||
private <E> RegistryLoader.ReadCache<E> readCache(ResourceKey<? extends Registry<E>> registryRef) {
|
||||
- return this.readCache.computeIfAbsent(registryRef, (ref) -> {
|
||||
+ return (RegistryLoader.ReadCache<E>) this.readCache.computeIfAbsent(registryRef, (ref) -> { // Paper - decompile fix
|
||||
return new RegistryLoader.ReadCache();
|
||||
});
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class RegistryLoader {
|
||||
}
|
||||
|
||||
public static record Bound(RegistryAccess.Writable access, RegistryLoader loader) {
|
||||
- public Bound(RegistryAccess.Writable writable, RegistryLoader registryLoader) {
|
||||
- this.access = writable;
|
||||
- this.loader = registryLoader;
|
||||
- }
|
||||
|
||||
public <E> DataResult<? extends Registry<E>> overrideRegistryFromResources(ResourceKey<? extends Registry<E>> registryRef, Codec<E> codec, DynamicOps<JsonElement> ops) {
|
||||
WritableRegistry<E> writableRegistry = this.access.ownedWritableRegistryOrThrow(registryRef);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
|
|
|
@ -4,7 +4,25 @@ Date: Sat, 16 Oct 2021 17:38:35 -0700
|
|||
Subject: [PATCH] Use correct LevelStem registry when loading default
|
||||
end/nether
|
||||
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/resources/RegistryLoader.java b/src/main/java/net/minecraft/resources/RegistryLoader.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/resources/RegistryLoader.java
|
||||
+++ b/src/main/java/net/minecraft/resources/RegistryLoader.java
|
||||
@@ -0,0 +0,0 @@ public class RegistryLoader {
|
||||
RegistryLoader.ReadCache<E> readCache = this.readCache(registryRef);
|
||||
DataResult<Holder<E>> dataResult = readCache.values.get(entryKey);
|
||||
if (dataResult != null) {
|
||||
+ // Paper start - register in registry due to craftbukkit running this 3 times instead of once
|
||||
+ if (registryRef == (ResourceKey) Registry.LEVEL_STEM_REGISTRY && dataResult.result().isPresent()) {
|
||||
+ // OptionalInt.empty() because the LevelStem registry is only loaded from the resource manager, not the InMemory resource access
|
||||
+ registry.registerOrOverride(java.util.OptionalInt.empty(), entryKey, dataResult.result().get().value(), dataResult.lifecycle());
|
||||
+ }
|
||||
+ // Paper end
|
||||
return dataResult;
|
||||
} else {
|
||||
Holder<E> holder = registry.getOrCreateHolder(entryKey);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
|
|
Loading…
Reference in a new issue