Skip to content

Commit ebe7496

Browse files
committed
code cleanup in BulkItemFilterMenu
1 parent 12129b6 commit ebe7496

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

src/main/java/me/desht/modularrouters/container/BulkItemFilterMenu.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,11 @@ public void mergeInventory(IItemHandler srcInv, ModuleFlags flags, boolean clear
102102

103103
@Override
104104
public ItemStack quickMoveStack(Player playerIn, int index) {
105-
ItemStack stack;
106105
Slot srcSlot = slots.get(index);
107106

108107
if (srcSlot != null && srcSlot.hasItem()) {
109108
ItemStack stackInSlot = srcSlot.getItem();
110-
stack = stackInSlot.copy();
111-
stack.setCount(1);
109+
ItemStack stack = stackInSlot.copyWithCount(1);
112110

113111
if (index < handler.getSlots()) {
114112
// shift-clicking in a filter slot: clear it from the filter
@@ -134,21 +132,13 @@ public ItemStack quickMoveStack(Player playerIn, int index) {
134132

135133
@Override
136134
public void clicked(int slot, int dragType, ClickType clickTypeIn, Player player) {
137-
if (clickTypeIn == ClickType.PICKUP) {// normal left-click
135+
if (clickTypeIn == ClickType.PICKUP || clickTypeIn == ClickType.QUICK_CRAFT) { // normal left-click (or with a bit of dragging)
138136
if (router == null && slot == currentSlot) {
139137
// no messing with the module that triggered this container's creation
140138
return;
141139
}
142140
if (slot < handler.getSlots() && slot >= 0) {
143-
Slot s = slots.get(slot);
144-
ItemStack stackOnCursor = getCarried();
145-
if (!stackOnCursor.isEmpty()) {
146-
ItemStack stack1 = stackOnCursor.copy();
147-
stack1.setCount(1);
148-
s.set(stack1);
149-
} else {
150-
s.set(ItemStack.EMPTY);
151-
}
141+
slots.get(slot).set(getCarried().isEmpty() ? ItemStack.EMPTY : getCarried().copyWithCount(1));
152142
return;
153143
}
154144
}

0 commit comments

Comments
 (0)