Add max itemframe decoration limit

This commit is contained in:
Shane Freeder 2022-10-13 03:45:53 +01:00
parent 7fe34e9508
commit e8374371e6
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
2 changed files with 36 additions and 2 deletions

View File

@ -431,10 +431,10 @@ index 0000000000000000000000000000000000000000..c2dca89291361d60cbf160cab77749cb
+}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..84785fed0d85d78c4caf8fabe35c0e89a59240d5
index 0000000000000000000000000000000000000000..88b7581633bc59e000319b7239695064ed7f535c
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -0,0 +1,275 @@
@@ -0,0 +1,277 @@
+package io.papermc.paper.configuration;
+
+import co.aikar.timings.MinecraftTimings;
@ -708,6 +708,8 @@ index 0000000000000000000000000000000000000000..84785fed0d85d78c4caf8fabe35c0e89
+ public boolean lagCompensateBlockBreaking = true;
+ public boolean useDimensionTypeForCustomSpawners = false;
+ public boolean strictAdvancementDimensionCheck = false;
+
+ public int maxMapDecorationLimit = 256;
+ }
+}
diff --git a/src/main/java/io/papermc/paper/configuration/InnerClassFieldDiscoverer.java b/src/main/java/io/papermc/paper/configuration/InnerClassFieldDiscoverer.java

View File

@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Thu, 13 Oct 2022 03:44:50 +0100
Subject: [PATCH] Add max itemframe decoration limit
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
index d2a77b4ca343d19e1c70afe3f3906a9bd53d0eec..12fbca641932458df554060165a26d8c0df3fd86 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -455,7 +455,7 @@ public class ItemFrame extends HangingEntity {
if (itemstack.is(Items.FILLED_MAP)) {
MapItemSavedData worldmap = MapItem.getSavedData(itemstack, this.level);
- if (worldmap != null && worldmap.isTrackedCountOverLimit(256)) {
+ if (worldmap != null && worldmap.isTrackedCountOverLimit(io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxMapDecorationLimit)) { // Paper
return InteractionResult.FAIL;
}
}
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 67b88da702b780f79c0496cb17f1e6f1f8dd6c2b..a45244c9081e3e503930c7d8b56a318a05d7439f 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
@@ -482,7 +482,7 @@ public class MapItemSavedData extends SavedData {
return true;
}
- if (!this.isTrackedCountOverLimit(256)) {
+ if (!this.isTrackedCountOverLimit(io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxMapDecorationLimit)) {
this.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
this.addDecoration(mapiconbanner.getDecoration(), world, mapiconbanner.getId(), d0, d1, 180.0D, mapiconbanner.getName());
return true;