Add another slot sanity check

This commit is contained in:
Nassim Jahnke 2023-11-03 14:49:55 +10:00
parent 0b218903a8
commit 8493340be4

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add slot sanity checks in container clicks
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index 3ef712299fe248602b0b117c0a8e285cdf4e05c2..2047224f26bf6c6aa125c15a14fe91d81e5b76ba 100644 index 3ef712299fe248602b0b117c0a8e285cdf4e05c2..5d298b11f74cd2da47e6613ced621ab62aa73a7b 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -423,6 +423,7 @@ public abstract class AbstractContainerMenu { @@ -423,6 +423,7 @@ public abstract class AbstractContainerMenu {
@ -20,7 +20,7 @@ index 3ef712299fe248602b0b117c0a8e285cdf4e05c2..2047224f26bf6c6aa125c15a14fe91d8
int j2; int j2;
if (actionType == ClickType.SWAP) { if (actionType == ClickType.SWAP) {
+ if (slotIndex < 0) return; // Paper + if (slotIndex < 0 || button < 0) return; // Paper
slot2 = (Slot) this.slots.get(slotIndex); slot2 = (Slot) this.slots.get(slotIndex);
itemstack1 = playerinventory.getItem(button); itemstack1 = playerinventory.getItem(button);
itemstack = slot2.getItem(); itemstack = slot2.getItem();