Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DraggedStack in Bookmarks #527

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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