9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-28 11:29:11 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0165-Fix-paper-s-bundle-exploit.patch
2025-05-04 23:18:03 +08:00

22 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taiyou06 <kaandindar21@gmail.com>
Date: Sun, 4 May 2025 13:49:50 +0200
Subject: [PATCH] Fix paper's bundle exploit
Original log: https://discord.com/channels/1145991395388162119/1368528332605620224/1368531526261932167
diff --git a/net/minecraft/world/item/component/BundleContents.java b/net/minecraft/world/item/component/BundleContents.java
index d6326dcb3700bc69c6c061ca8544b212f909277b..03ef306164c719b5c9b260224e2813ffdad4ea16 100644
--- a/net/minecraft/world/item/component/BundleContents.java
+++ b/net/minecraft/world/item/component/BundleContents.java
@@ -233,7 +233,8 @@ public final class BundleContents implements TooltipComponent {
if (this.items.isEmpty()) {
return null;
} else {
- int i = !indexIsOutsideAllowedBounds(this.selectedItem) ? this.selectedItem : 0; // Paper
+ int i = 0;
+ if (this.selectedItem >= 0 && this.selectedItem < this.items.size()) {i = this.selectedItem;}
ItemStack itemStack = this.items.remove(i).copy();
this.weight = this.weight.subtract(BundleContents.getWeight(itemStack).multiplyBy(Fraction.getFraction(itemStack.getCount(), 1)));
this.toggleSelectedItem(-1);