Paper/patches/server/0665-Limit-item-frame-cursors-on-maps.patch

38 lines
2.2 KiB
Diff

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 502d7cbff05c9fd6ef64d6e6483b7c7d5cebfb22..eff5a39968c8a4ff49ca9a7de5e2bf2a20ea7fd8 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -828,4 +828,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/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index 77fde68dae2e64ef54b1cee7ab8b33f4609b3675..77209dfe179f97a5be89bdf812622773b90e6214 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
@@ -295,8 +295,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();