From e8cb0ac761021f1205b9b4bda6b66c89d4b2aec5 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 --- .../maps/MapItemSavedData.java.patch | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java.patch b/paper-server/patches/sources/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java.patch index ed367bbc43..452050da4c 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java.patch @@ -140,16 +140,30 @@ nbt.putInt("xCenter", this.centerX); nbt.putInt("zCenter", this.centerZ); nbt.putByte("scale", this.scale); -@@ -443,7 +522,7 @@ +@@ -247,8 +326,10 @@ - if (!this.isTrackedCountOverLimit(256)) { + MapFrame worldmapframe1 = new MapFrame(blockposition, entityitemframe.getDirection().get2DDataValue() * 90, entityitemframe.getId()); + ++ if (this.decorations.size() < player.level().paperConfig().maps.itemFrameCursorLimit) { // Paper - Limit item frame cursors on maps + this.addDecoration(MapDecorationTypes.FRAME, player.level(), MapItemSavedData.getFrameKey(entityitemframe.getId()), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null); + this.frameMarkers.put(worldmapframe1.getId(), worldmapframe1); ++ } // Paper - Limit item frame cursors on maps + } + + MapDecorations mapdecorations = (MapDecorations) stack.getOrDefault(DataComponents.MAP_DECORATIONS, MapDecorations.EMPTY); +@@ -441,9 +522,9 @@ + return true; + } + +- if (!this.isTrackedCountOverLimit(256)) { ++ if (!this.isTrackedCountOverLimit(((Level) world).paperConfig().maps.itemFrameCursorLimit)) { // Paper - Limit item frame cursors on maps this.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner); - this.addDecoration(mapiconbanner.getDecoration(), world, mapiconbanner.getId(), d0, d1, 180.0D, (Component) mapiconbanner.name().orElse((Object) null)); + this.addDecoration(mapiconbanner.getDecoration(), world, mapiconbanner.getId(), d0, d1, 180.0D, (Component) mapiconbanner.name().orElse(null)); // CraftBukkit - decompile error return true; } } -@@ -554,7 +633,7 @@ +@@ -554,7 +635,7 @@ this.player = entityhuman; } @@ -158,7 +172,7 @@ int i = this.minDirtyX; int j = this.minDirtyY; int k = this.maxDirtyX + 1 - this.minDirtyX; -@@ -563,7 +642,7 @@ +@@ -563,7 +644,7 @@ for (int i1 = 0; i1 < k; ++i1) { for (int j1 = 0; j1 < l; ++j1) { @@ -167,7 +181,7 @@ } } -@@ -573,19 +652,29 @@ +@@ -573,19 +654,29 @@ @Nullable Packet nextUpdatePacket(MapId mapId) { MapItemSavedData.MapPatch worldmap_c;