Add config setting for grindstone overstacking (#8156)

This commit is contained in:
uku 2022-10-23 01:25:17 +02:00 committed by GitHub
parent 58483c1e18
commit 4e67c73b03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 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..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;

View File

@ -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;

View File

@ -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 {