Skip to content

Commit

Permalink
Fix DraggedStack in Bookmarks (#527)
Browse files Browse the repository at this point in the history
Co-authored-by: slprime <history-21@yandex.ru>
  • Loading branch information
slprime and slprime authored Sep 12, 2024
1 parent 9563ebf commit b328fd3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/codechicken/nei/BookmarkPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -2109,6 +2109,9 @@ protected ItemStack getDraggedStackWithQuantity(int mouseDownSlot) {

@Override
public void mouseDragged(int mousex, int mousey, int button, long heldTime) {
if (mouseDownSlot >= grid.realItems.size()) {
mouseDownSlot = -1;
}

if (this.groupingItem != null) {
final int overRowIndex = (mousey - grid.marginTop) / BookmarkGrid.SLOT_SIZE;
Expand Down Expand Up @@ -2241,8 +2244,7 @@ public void mouseDragged(int mousex, int mousey, int button, long heldTime) {
if (button == 0 && NEIClientUtils.shiftKey() && mouseDownSlot >= 0 && this.sortableItem == null) {
ItemPanelSlot mouseOverSlot = getSlotMouseOver(mousex, mousey);

if (grid.getItem(mouseDownSlot) != null
&& (mouseOverSlot == null || mouseOverSlot.slotIndex != mouseDownSlot || heldTime > 250)) {
if (mouseOverSlot == null || mouseOverSlot.slotIndex != mouseDownSlot || heldTime > 250) {
final BookmarkGrid BGrid = (BookmarkGrid) grid;
final ItemStackMetadata meta = BGrid.getMetadata(mouseDownSlot);
final List<ItemStack> items = new ArrayList<>();
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/codechicken/nei/PanelWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ public void postDraw(int mousex, int mousey) {

@Override
public void mouseDragged(int mousex, int mousey, int button, long heldTime) {
if (mouseDownSlot >= grid.realItems.size()) {
mouseDownSlot = -1;
}

if (mouseDownSlot >= 0 && draggedStack == null
&& NEIClientUtils.getHeldItem() == null
&& NEIClientConfig.hasSMPCounterPart()) {
Expand Down

0 comments on commit b328fd3

Please sign in to comment.