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

Offhand support for auto loot feature. #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Badfoxrox
Copy link

It will check to see if there is a shield or torches in the grave and attempt to place them in the offhand slot. It will not place an item in the slot if it has any items before looting.

Fixed my mistake of not including isOffhandItem() in the InventoryUtil class.

@@ -132,6 +137,10 @@ public static boolean isBoots(ItemStack itemStack) {
"CHAINMAIL_BOOTS");
}

public static boolean isOffhandItem(ItemStack itemStack) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it always this? Can't you also hold something else in the off-hand?

I'm thinking about the dualwield plugin I forked. So then you'd be able to hold an axe or sword in your offhand.

Isn't there a better way to do this? I mean: maybe it's possible to store (as underneath it's using SQLite) the order of items? And as such, also store armor/hand/offhand data?

Do you think it's possible to do it that way?

Copy link
Author

Choose a reason for hiding this comment

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

I'm sure that it would be much better to use SQLite to store the items properly however, I believe it would require a decent change to the way that the graves store the items.

I don't really have the time to implement those changes properly, and this was kind of just a bandaid fix to just get the idea out, mostly for personal use, in the hopes that someone else will expand upon it (in a hopefully much smarter way than I can).

(While writing this out, I realized that it probably would have been better to just make a feature request rather than make a weak attempt at implementing it)

Copy link
Collaborator

@svaningelgem svaningelgem Apr 23, 2024

Choose a reason for hiding this comment

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

If you allow me to write to your branch, I will have a try today. Or I just fork your fork 😎.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@svaningelgem
Copy link
Collaborator

I've been testing this a bit, and it seems this works fine with mode "EXACT":

Before:
image

The grave itself:
image

shift-right click (autoloot):
image

the grave after auto-loot:
image

and now when I destroyed the compass beforehand:
image

==> So auto-equip seems to work fine in this case?

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

Successfully merging this pull request may close these issues.

2 participants