From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Taiyou06 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);