check if itemstack is stackable first (#10285)

Dieser Commit ist enthalten in:
granny 2024-03-03 10:37:00 -08:00 committet von GitHub
Ursprung 850b736e14
Commit 54a23403da
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
2 geänderte Dateien mit 20 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -63,4 +63,5 @@ Ollie <69084614+olijeffers0n@users.noreply.github.com>
Oliwier Miodun <naczs@blueflow.pl>
aerulion <aerulion@gmail.com>
Lukas Planz <lukas.planz@web.de>
granny <contact@granny.dev>
```

Datei anzeigen

@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: granny <contact@granny.dev>
Date: Sat, 24 Feb 2024 19:33:01 -0800
Subject: [PATCH] check if itemstack is stackable first
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
index 309acf7bd07e38043aa81e0e686edba1136bd04c..96c898086f35fd83f9b1ce7e3fe53d31b2fa4c31 100644
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
@@ -114,7 +114,7 @@ public class Inventory implements Container, Nameable {
}
private boolean hasRemainingSpaceForItem(ItemStack existingStack, ItemStack stack) {
- return !existingStack.isEmpty() && ItemStack.isSameItemSameTags(existingStack, stack) && existingStack.isStackable() && existingStack.getCount() < existingStack.getMaxStackSize() && existingStack.getCount() < this.getMaxStackSize();
+ return !existingStack.isEmpty() && existingStack.isStackable() && existingStack.getCount() < existingStack.getMaxStackSize() && existingStack.getCount() < this.getMaxStackSize() && ItemStack.isSameItemSameTags(existingStack, stack); // Paper - check if itemstack is stackable first
}
// CraftBukkit start - Watch method above! :D