mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 08:57:35 +01:00
Quick tweaks to logical flow of getMapData
This commit is contained in:
parent
f36bb59739
commit
5eec4ec3bf
@ -5,7 +5,7 @@ Subject: [PATCH] Fix missing map initialize event call
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index f502b01b564bd33c449cbe621966ef4076a38cca..868951dc21aff541765b1f58f08cdf3c47446d25 100644
|
||||
index f502b01b564bd33c449cbe621966ef4076a38cca..51d282b524b5249438f7744f7f0b1cc27b76470e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2099,7 +2099,23 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@ -20,12 +20,12 @@ index f502b01b564bd33c449cbe621966ef4076a38cca..868951dc21aff541765b1f58f08cdf3c
|
||||
+ if (existing == null && !storage.cache.containsKey(id)) {
|
||||
+ final net.minecraft.world.level.saveddata.SavedData.Factory<MapItemSavedData> factory = MapItemSavedData.factory();
|
||||
+ final MapItemSavedData map = storage.readSavedData(factory.deserializer(), factory.type(), id);
|
||||
+ storage.cache.put(id, map);
|
||||
+ if (map != null) {
|
||||
+ map.id = id;
|
||||
+ new MapInitializeEvent(map.mapView).callEvent();
|
||||
+ return map;
|
||||
+ }
|
||||
+
|
||||
+ storage.cache.put(id, map);
|
||||
+ }
|
||||
+
|
||||
+ return existing instanceof MapItemSavedData data ? data : null;
|
||||
|
Loading…
Reference in New Issue
Block a user