Only mark decorations dirty if a removal actually occurs (#11413)

* Only mark decorations dirty if a removal actually occurs

Vanilla calls this method blindly inside of a loop which erroniously marks
map data files as being dirty even if nothing has actually changed.

* Merge into existing patch

---------

Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
This commit is contained in:
Shane Freeder 2024-09-19 15:27:33 +01:00 committed by GitHub
parent 2aaf4369b6
commit 5c82955733
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,7 +44,7 @@ index d0b51d96d6795b5fa03bc195b90324680545b752..09bcbc0ae36e4e69fee87a7e0c49acf4
return entityitem;
}
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index a43544704109f21bab230dd9bf0401e28f878582..17f33c83c6033564d6bf4fbd388b0b847c68adb3 100644
index a43544704109f21bab230dd9bf0401e28f878582..6794466051dd4b725d579b2136c37844995a648e 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@@ -79,6 +79,7 @@ public class MapItemSavedData extends SavedData {
@ -71,6 +71,15 @@ index a43544704109f21bab230dd9bf0401e28f878582..17f33c83c6033564d6bf4fbd388b0b84
RegistryOps<Tag> registryops = registryLookup.createSerializationContext(NbtOps.INSTANCE);
List<MapBanner> list = (List) MapBanner.LIST_CODEC.parse(registryops, nbt.get("banners")).resultOrPartial((s) -> {
@@ -348,7 +351,7 @@ public class MapItemSavedData extends SavedData {
--this.trackedDecorationCount;
}
- this.setDecorationsDirty();
+ if (mapicon != null) this.setDecorationsDirty(); // Paper - only mark dirty if a change occurs
}
public static void addTargetDecoration(ItemStack stack, BlockPos pos, String id, Holder<MapDecorationType> decorationType) {
@@ -588,6 +591,21 @@ public class MapItemSavedData extends SavedData {
public class HoldingPlayer {