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

Added 'item_cooldown' to query and modify item cooldowns #1789

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

Conversation

Ghoulboy78
Copy link
Contributor

Fixes #597
Simple fix, but querying item cooldowns only returns a percentage. I'd like to make it return the number of ticks, but there are private classes involved (specifically net.minecraft.world.item.ItemCooldowns.CooldownInstance), which idk how to mix into.

@altrisi
Copy link
Collaborator

altrisi commented Aug 3, 2023

To mixin you can use a string target for the annotation.

@Ghoulboy78
Copy link
Contributor Author

How so?

@Ghoulboy78
Copy link
Contributor Author

Wait, I might have found a solution

@altrisi
Copy link
Collaborator

altrisi commented Aug 3, 2023

@Mixin(target="net/minecraft/...") iirc

Or maybe targets

@altrisi
Copy link
Collaborator

altrisi commented Aug 3, 2023

If that's not enough then there's accesswidener

@Ghoulboy78
Copy link
Contributor Author

I've tried that and I've tried accesswidener, neither seems to be able to work. net.minecraft.world.item.ItemCooldowns.CooldownInstance is a private class, and idk how to get to it. But that is the only way to fix this issue.

@altrisi
Copy link
Collaborator

altrisi commented Aug 3, 2023

Note that after accesswidener you have to regenerate/reimport/sync/refresh (or whatever it's called on intellij gradle) the minecraft sources/the project given it modifies directly the game jar.

@Ghoulboy78
Copy link
Contributor Author

Done!

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.

Scarpet suggestion: Allow use of Scarpet API to set cooldown timers on items for players
2 participants