Fix unnecessary map data saves (#12296)

This commit is contained in:
Dqu1J 2025-04-30 16:51:13 +01:00 committed by GitHub
parent 1e930763d2
commit 646b80ca53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 3 deletions

View File

@ -96,6 +96,20 @@
} }
public static void addTargetDecoration(ItemStack stack, BlockPos pos, String type, Holder<MapDecorationType> mapDecorationType) { public static void addTargetDecoration(ItemStack stack, BlockPos pos, String type, Holder<MapDecorationType> mapDecorationType) {
@@ -354,7 +_,12 @@
}
public void setColorsDirty(int x, int z) {
- this.setDirty();
+ // Paper start - Fix unnecessary map data saves
+ this.setColorsDirty(x, z, true);
+ }
+ public void setColorsDirty(int x, int z, boolean markFileDirty) {
+ if (markFileDirty) this.setDirty();
+ // Paper end - Fix unnecessary map data saves
for (MapItemSavedData.HoldingPlayer holdingPlayer : this.carriedBy) {
holdingPlayer.markColorsDirty(x, z);
@@ -395,7 +_,7 @@ @@ -395,7 +_,7 @@
return true; return true;
} }

View File

@ -64,7 +64,7 @@ public class CraftMapCanvas implements MapCanvas {
return; return;
if (this.buffer[y * 128 + x] != color) { if (this.buffer[y * 128 + x] != color) {
this.buffer[y * 128 + x] = color; this.buffer[y * 128 + x] = color;
this.mapView.worldMap.setColorsDirty(x, y); this.mapView.worldMap.setColorsDirty(x, y, false); // Paper - Fix unnecessary map data saves
} }
} }
@ -141,8 +141,8 @@ public class CraftMapCanvas implements MapCanvas {
} }
// Mark all colors within the image as dirty // Mark all colors within the image as dirty
this.mapView.worldMap.setColorsDirty(destX, destY); this.mapView.worldMap.setColorsDirty(destX, destY, false);
this.mapView.worldMap.setColorsDirty(destX + effectiveWidth - 1, destY + effectiveHeight - 1); this.mapView.worldMap.setColorsDirty(destX + effectiveWidth - 1, destY + effectiveHeight - 1, false);
// Paper end // Paper end
} }