aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0690-Limit-item-frame-cursors-on-maps.patch
blob: f5ec39469799b6bf689f59d9e361cd2676082eb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Yive <admin@yive.me>
Date: Wed, 26 May 2021 15:09:33 -0700
Subject: [PATCH] Limit item frame cursors on maps


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0938b38aaca2bfaf3a70c392849222fc0128c60c..81c3a4a2c7e95e92566030ab48f534285d185cf5 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -855,5 +855,10 @@ public class PaperWorldConfig {
     private void allowUsingSignsInsideSpawnProtection() {
         allowUsingSignsInsideSpawnProtection = getBoolean("allow-using-signs-inside-spawn-protection", allowUsingSignsInsideSpawnProtection);
     }
+
+    public int mapItemFrameCursorLimit = 128;
+    private void mapItemFrameCursorLimit() {
+        mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit);
+    }
 }
 
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 ad6c3459712d08de248b8ef299ddbedfda6c7ac2..6f64d1ce0f5b20e1579f8af64c08ef8fc4e4444b 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
@@ -296,8 +296,12 @@ public class MapItemSavedData extends SavedData {
 
             MapFrame worldmapframe1 = new MapFrame(blockposition, entityitemframe.getDirection().get2DDataValue() * 90, entityitemframe.getId());
 
+            // Paper start
+            if (this.decorations.size() < player.level.paperConfig.mapItemFrameCursorLimit) {
             this.addDecoration(MapDecoration.Type.FRAME, player.level, "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null);
             this.frameMarkers.put(worldmapframe1.getId(), worldmapframe1);
+            }
+            // Paper end
         }
 
         CompoundTag nbttagcompound = stack.getTag();