PaperMC/patches/server/0050-Ensure-inv-drag-is-in-bounds.patch

20 lines
1.3 KiB
Diff
Raw Normal View History

2021-06-12 02:57:04 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:33:53 -0600
Subject: [PATCH] Ensure inv drag is in bounds
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
2021-11-23 13:15:10 +01:00
index ccb6ff0cf31e619ce555d404a6454750f0958f12..36834f30ccefd229df4da2dbc7b22edcb83429c3 100644
2021-06-12 02:57:04 +02:00
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
2021-07-07 08:52:40 +02:00
@@ -406,7 +406,7 @@ public abstract class AbstractContainerMenu {
2021-06-12 02:57:04 +02:00
this.resetQuickCraft();
}
} else if (this.quickcraftStatus == 1) {
- slot = (Slot) this.slots.get(slotIndex);
+ slot = slotIndex < this.slots.size() ? this.slots.get(slotIndex) : null; // Paper - Ensure drag in bounds
itemstack = this.getCarried();
if (AbstractContainerMenu.canItemQuickReplace(slot, itemstack, true) && slot.mayPlace(itemstack) && (this.quickcraftType == 2 || itemstack.getCount() > this.quickcraftSlots.size()) && this.canDragTo(slot)) {
this.quickcraftSlots.add(slot);