|
27 | 27 | import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; |
28 | 28 | import net.minecraft.world.inventory.ClickType; |
29 | 29 | import net.minecraft.world.inventory.Slot; |
| 30 | +import net.minecraft.world.item.BundleItem; |
30 | 31 | import net.minecraft.world.item.ItemStack; |
31 | 32 | import net.minecraft.world.item.Items; |
32 | 33 |
|
@@ -284,9 +285,9 @@ protected void sort(int[] sortedIds, boolean playSound) { |
284 | 285 |
|
285 | 286 | // Modify standard click if required for bundles |
286 | 287 | int mouseButton = 0; |
287 | | - boolean clickOnBundleWithItem = originScopeStacks[dstId].is(Items.BUNDLE) |
| 288 | + boolean clickOnBundleWithItem = isBundle(originScopeStacks[dstId]) |
288 | 289 | && !(carriedStack.isEmpty()); |
289 | | - boolean clickOnItemWithBundle = carriedStack.is(Items.BUNDLE) |
| 290 | + boolean clickOnItemWithBundle = isBundle(carriedStack) |
290 | 291 | && !(originScopeStacks[dstId].isEmpty()); |
291 | 292 | if (options().bundlesUseLeftClick |
292 | 293 | && (clickOnBundleWithItem || clickOnItemWithBundle)) { |
@@ -622,4 +623,14 @@ private InteractionEvent createClickEvent( |
622 | 623 | return InteractionManager.TICK_WAITER; |
623 | 624 | }); |
624 | 625 | } |
| 626 | + |
| 627 | + /** |
| 628 | + * Compatibility helper for non-vanilla bundle implementations. |
| 629 | + * |
| 630 | + * @param stack the stack to check. |
| 631 | + * @return whether the stack is a bundle. |
| 632 | + */ |
| 633 | + private static boolean isBundle(ItemStack stack) { |
| 634 | + return stack.is(Items.BUNDLE) || stack.getItem() instanceof BundleItem; |
| 635 | + } |
625 | 636 | } |
0 commit comments