From 4e67c73b03452775143e8a458e5786b8f347c6b4 Mon Sep 17 00:00:00 2001 From: uku Date: Sun, 23 Oct 2022 01:25:17 +0200 Subject: [PATCH] Add config setting for grindstone overstacking (#8156) --- patches/server/0004-Paper-config-files.patch | 6 ++++-- .../0586-Prevent-grindstones-from-overstacking-items.patch | 4 ++-- patches/server/0913-Configurable-chat-thread-limit.patch | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/patches/server/0004-Paper-config-files.patch b/patches/server/0004-Paper-config-files.patch index 213021f47..1150de759 100644 --- a/patches/server/0004-Paper-config-files.patch +++ b/patches/server/0004-Paper-config-files.patch @@ -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..56a5e20c47e2ee2169611e20969803bcfd75f88f --- /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; @@ -578,6 +578,8 @@ index 0000000000000000000000000000000000000000..84785fed0d85d78c4caf8fabe35c0e89 + public boolean performUsernameValidation = true; + @Comment("This setting controls if players should be able to create headless pistons.") + public boolean allowHeadlessPistons = false; ++ @Comment("This setting controls if grindstones should be able to output overstacked items (such as cursed books).") ++ public boolean allowGrindstoneOverstacking = false; + } + + public Commands commands; diff --git a/patches/server/0586-Prevent-grindstones-from-overstacking-items.patch b/patches/server/0586-Prevent-grindstones-from-overstacking-items.patch index 3e79faf01..1faefdeb0 100644 --- a/patches/server/0586-Prevent-grindstones-from-overstacking-items.patch +++ b/patches/server/0586-Prevent-grindstones-from-overstacking-items.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent grindstones from overstacking items diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java -index 7a0c38c743ef02f5b9c052f88c2d6429a53b8286..740b778ce14f241e509f17c3a84b9ed47cdeeebe 100644 +index 7a0c38c743ef02f5b9c052f88c2d6429a53b8286..447f0f5f37e445a350d06deeac326feab2d66999 100644 --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java @@ -198,13 +198,13 @@ public class GrindstoneMenu extends AbstractContainerMenu { @@ -13,7 +13,7 @@ index 7a0c38c743ef02f5b9c052f88c2d6429a53b8286..740b778ce14f241e509f17c3a84b9ed4 itemstack2 = this.mergeEnchants(itemstack, itemstack1); if (!itemstack2.isDamageableItem()) { - if (!ItemStack.matches(itemstack, itemstack1)) { -+ if (!ItemStack.matches(itemstack, itemstack1) || itemstack2.getMaxStackSize() == 1) { // Paper - add max stack size check ++ if (!ItemStack.matches(itemstack, itemstack1) || (itemstack2.getMaxStackSize() == 1 && !io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowGrindstoneOverstacking)) { // Paper - add max stack size check & config value this.resultSlots.setItem(0, ItemStack.EMPTY); this.broadcastChanges(); return; diff --git a/patches/server/0913-Configurable-chat-thread-limit.patch b/patches/server/0913-Configurable-chat-thread-limit.patch index a5344da3a..1bb08ba4e 100644 --- a/patches/server/0913-Configurable-chat-thread-limit.patch +++ b/patches/server/0913-Configurable-chat-thread-limit.patch @@ -22,10 +22,10 @@ is actually processed, this is honestly really just exposed for the misnomers or who just wanna ensure that this won't grow over a specific size if chat gets stupidly active diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index 84785fed0d85d78c4caf8fabe35c0e89a59240d5..4a8286c78a9a5e305b19cc5d316bc73a78e49b4d 100644 +index 56a5e20c47e2ee2169611e20969803bcfd75f88f..63ec2ebb71aa0e0dbb64bbce7cd3c9494e9ce2e7 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -252,13 +252,26 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -254,13 +254,26 @@ public class GlobalConfiguration extends ConfigurationPart { public Misc misc; public class Misc extends ConfigurationPart {