Limit item frame cursors on maps (#5730)
Fixes an issue where you can have thousands of these and lag clients.
This commit is contained in:
parent
81a537c1f3
commit
b9f2a673d3
|
@ -0,0 +1,37 @@
|
||||||
|
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 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();
|
Loading…
Reference in New Issue