Use correct saved data key for maps

This commit is contained in:
Bjarne Koll 2025-04-16 20:26:53 +02:00
parent 2948eb296d
commit 6c2b0378fe
No known key found for this signature in database
GPG Key ID: 9576DAF3FDDB088F

View File

@ -941,7 +941,7 @@
+ // Paper start - Call missing map initialize event and set id + // Paper start - Call missing map initialize event and set id
+ final DimensionDataStorage storage = this.getServer().overworld().getDataStorage(); + final DimensionDataStorage storage = this.getServer().overworld().getDataStorage();
+ +
+ final Optional<net.minecraft.world.level.saveddata.SavedData> cacheEntry = storage.cache.get(mapId.key()); + final Optional<net.minecraft.world.level.saveddata.SavedData> cacheEntry = storage.cache.get(MapItemSavedData.type(mapId));
+ if (cacheEntry == null) { // Cache did not contain, try to load and may init + if (cacheEntry == null) { // Cache did not contain, try to load and may init
+ final MapItemSavedData mapData = storage.get(MapItemSavedData.type(mapId)); // get populates the cache + final MapItemSavedData mapData = storage.get(MapItemSavedData.type(mapId)); // get populates the cache
+ if (mapData != null) { // map was read, init it and return + if (mapData != null) { // map was read, init it and return