Skip to content

Commit 82d993a

Browse files
committed
Make bundle check more lenient, close #59
1 parent 73b7c65 commit 82d993a

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2.1.4
4+
5+
- Improved compatibility with modded bundles
6+
37
## 2.1.3
48

59
- Improved compatibility with Accessories mod

common/src/main/java/dev/terminalmc/clientsort/client/inventory/operator/client/ClientSurvivalOperator.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
2828
import net.minecraft.world.inventory.ClickType;
2929
import net.minecraft.world.inventory.Slot;
30+
import net.minecraft.world.item.BundleItem;
3031
import net.minecraft.world.item.ItemStack;
3132
import net.minecraft.world.item.Items;
3233

@@ -284,9 +285,9 @@ protected void sort(int[] sortedIds, boolean playSound) {
284285

285286
// Modify standard click if required for bundles
286287
int mouseButton = 0;
287-
boolean clickOnBundleWithItem = originScopeStacks[dstId].is(Items.BUNDLE)
288+
boolean clickOnBundleWithItem = isBundle(originScopeStacks[dstId])
288289
&& !(carriedStack.isEmpty());
289-
boolean clickOnItemWithBundle = carriedStack.is(Items.BUNDLE)
290+
boolean clickOnItemWithBundle = isBundle(carriedStack)
290291
&& !(originScopeStacks[dstId].isEmpty());
291292
if (options().bundlesUseLeftClick
292293
&& (clickOnBundleWithItem || clickOnItemWithBundle)) {
@@ -622,4 +623,14 @@ private InteractionEvent createClickEvent(
622623
return InteractionManager.TICK_WAITER;
623624
});
624625
}
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+
}
625636
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
template_version=10
1111

1212
# Mod Version
13-
mod_version=2.1.3
13+
mod_version=2.1.4
1414
# 'STABLE', 'BETA' or 'ALPHA'
1515
mod_version_type=STABLE
1616

0 commit comments

Comments
 (0)