From b9f2a673d3f71e9005c39edde01cf87436fe60e1 Mon Sep 17 00:00:00 2001 From: Yive Date: Wed, 26 May 2021 15:16:17 -0700 Subject: [PATCH] Limit item frame cursors on maps (#5730) Fixes an issue where you can have thousands of these and lag clients. --- ...747-Limit-item-frame-cursors-on-maps.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Spigot-Server-Patches/0747-Limit-item-frame-cursors-on-maps.patch diff --git a/Spigot-Server-Patches/0747-Limit-item-frame-cursors-on-maps.patch b/Spigot-Server-Patches/0747-Limit-item-frame-cursors-on-maps.patch new file mode 100644 index 000000000..0a2f9144f --- /dev/null +++ b/Spigot-Server-Patches/0747-Limit-item-frame-cursors-on-maps.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yive +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 921253a06daa414aed7dc6824effc65db09ea7a5..37f866629b7eed39ced4352c94e56c8de8ccfeb9 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -815,4 +815,9 @@ 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/WorldMap.java b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java +index 1f9b710f2af3c5067b3c2b73bebb11f8e22c403e..97fe61dcd066ec0ee05e81fc22409d6aa6b3a6d5 100644 +--- a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java ++++ b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java +@@ -279,8 +279,12 @@ public class WorldMap extends PersistentBase { + + WorldMapFrame worldmapframe1 = new WorldMapFrame(blockposition, entityitemframe.getDirection().get2DRotationValue() * 90, entityitemframe.getId()); + ++ // Paper start ++ if (this.decorations.size() < entityhuman.world.paperConfig.mapItemFrameCursorLimit) { + this.a(MapIcon.Type.FRAME, entityhuman.world, "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DRotationValue() * 90), (IChatBaseComponent) null); + this.n.put(worldmapframe1.e(), worldmapframe1); ++ } ++ // Paper end + } + + NBTTagCompound nbttagcompound = itemstack.getTag();