gnembon / fabric-carpet

Fabric Carpet
MIT License
1.65k stars 261 forks source link

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

Open Ghoulboy78 opened 11 months ago

Ghoulboy78 commented 11 months ago

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 commented 11 months ago

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

Ghoulboy78 commented 11 months ago

How so?

Ghoulboy78 commented 11 months ago

Wait, I might have found a solution

altrisi commented 11 months ago

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

Or maybe targets

altrisi commented 11 months ago

If that's not enough then there's accesswidener

Ghoulboy78 commented 11 months ago

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 commented 11 months ago

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 commented 10 months ago

Done!