From 5c829557332f21b34bc81e6ad1a73e511faef8f6 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 19 Sep 2024 15:27:33 +0100 Subject: [PATCH] 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 --- ...Maps-in-item-frames-performance-and-bug-fixe.patch | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/patches/server/0987-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/patches/server/0987-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch index ccc8786fd8..30dde1fadd 100644 --- a/patches/server/0987-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch +++ b/patches/server/0987-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch @@ -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 registryops = registryLookup.createSerializationContext(NbtOps.INSTANCE); List 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 decorationType) { @@ -588,6 +591,21 @@ public class MapItemSavedData extends SavedData { public class HoldingPlayer {