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

Prevent the Ore Finder Wand from imploding #13

Merged
merged 6 commits into from May 13, 2023
Merged

Prevent the Ore Finder Wand from imploding #13

merged 6 commits into from May 13, 2023

Conversation

wlhlm
Copy link
Member

@wlhlm wlhlm commented May 12, 2023

@wlhlm wlhlm requested review from a team May 12, 2023 18:12
@github-actions
Copy link
Contributor

Warning: 2 uncommitted changes
#14

Co-authored-by: GitHub GTNH Actions <>
@OneEyeMaker
Copy link
Contributor

Current code doesn't solve issue completely, because there are keyboard shortcuts which allow to move items. More proper solution would be to implement something like locked slot and adding such slot like this.

@wlhlm
Copy link
Member Author

wlhlm commented May 12, 2023

My implementation is based on the GT++ backpack. That code has a few comments 1 2 3 regarding backpack self-storage, which I followed. You think this is broken in GT++ as well?

I have done some playtesting and it all worked as expected. Do you know some keybinds that might still allow transferring the wand into itself? Tried it with Inv and Mouse Tweaks.

@OneEyeMaker
Copy link
Contributor

OneEyeMaker commented May 13, 2023

There is keyboard shortcut which allows to move any item to hotbar (IDK, is one added by vanilla or by tweaks mods).
Using this shortcut with current implementation allows move item away and destroy it.

Steps to reproduce (tested in survival, in creative NEI will dupe items):

  1. Place ore finder on hotbar in N-th slot.
  2. Open it's UI.
  3. Hover mouse over any empty slot.
  4. Press Ctrl+N (index of slot where ore finder is located, Ctrl+3, for example).
    Result: item is moved from original slot.
  5. Drag and drop item away from UI window.
    Item is destroyed.

@OneEyeMaker
Copy link
Contributor

After few more tests I found that item is destroyed only when NEI is enabled. But anyway I think that moving item from "locked" position isn't a desired behavior.

@wlhlm
Copy link
Member Author

wlhlm commented May 13, 2023

This actually vanilla functionality. net.minecraft.client.gui.inventory.GuiContainer#checkHotbarKeys. You don't have to hold Ctrl, just one of the hotbar shortcuts (1-9 by default).

@wlhlm
Copy link
Member Author

wlhlm commented May 13, 2023

OK, I have reworked the locked slot handling more akin to what Forestry does. This was very enlightening. Please have a look.

I'm gonna have to fix the GT++ backpack next (though probably nobody uses them 😛)

… previous efforts

New mitigation is based on Forestry backpacks.
Copy link
Contributor

@OneEyeMaker OneEyeMaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good job!

Add just one method override to slot class for safety.

Co-authored-by: Alexander Anishin <oneeyemaker@gmail.com>
@wlhlm
Copy link
Member Author

wlhlm commented May 13, 2023

Committed (also updated the GT++ PR). Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants