fabric-carpet icon indicating copy to clipboard operation
fabric-carpet copied to clipboard

Added 'item_cooldown' to query and modify item cooldowns

Open Ghoulboy78 opened this issue 1 year ago • 8 comments

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.

Ghoulboy78 avatar Aug 03 '23 15:08 Ghoulboy78

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

altrisi avatar Aug 03 '23 15:08 altrisi

How so?

Ghoulboy78 avatar Aug 03 '23 15:08 Ghoulboy78

Wait, I might have found a solution

Ghoulboy78 avatar Aug 03 '23 15:08 Ghoulboy78

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

Or maybe targets

altrisi avatar Aug 03 '23 15:08 altrisi

If that's not enough then there's accesswidener

altrisi avatar Aug 03 '23 15:08 altrisi

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.

Ghoulboy78 avatar Aug 03 '23 16:08 Ghoulboy78

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.

altrisi avatar Aug 03 '23 16:08 altrisi

Done!

Ghoulboy78 avatar Aug 19 '23 10:08 Ghoulboy78