I’m fairly new to using Mixin, but I’m trying to create a functionality for my Sponge plugin ->
Sponge Forge Version: 1.12.2-2838-7.2.4-RC4054
Forge Version: 1.12.2-18.104.22.16854
This functionality would be the following:
- Inject into the head of the “attackEntityFrom” method located in “EntityLivingBase.java” to run every time a living entity takes damage.
- Check if the entity damage source was a player
- If it was a player, get the “cooledAttackStrength” of the player.
- If the “cooledAttackStrength” of the player does not meet certain criteria, return false in the callback
The problem I am running into is this:
When I attack any entity in game, this is what gets printed via this code:
Output in console:
LOGGER.info(player.getCooledAttackStrength(0)); Will always output “0.0”
LOGGER.info(player.getLastAttackedEntityTime()); Will always go up in ticks, but never reset on entity attack.
To me, it seems like the “attacking entity” is never being refreshed. Although i’m not sure if this is something I have to do, or if I am using this incorrectly in the first place. Any help would be appreciated.