summaryrefslogtreecommitdiff
path: root/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/mixin/PlayerEntityMixin.java
blob: 0894d3068b48d9f7d4bb5cb2fd0163c46ddbcc7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package net.justlearning.arslaan3102.arslaansmagichax.mixin;

import net.justlearning.arslaan3102.arslaansmagichax.ArslaansMagicHaxClient;
import net.justlearning.arslaan3102.arslaansmagichax.modules.impl.NoAttackCooldown;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(PlayerEntity.class)
public abstract class PlayerEntityMixin {
    @Inject(method = "getAttackCooldownProgress", at = @At("HEAD"), cancellable = true)
    private void onGetAttackCooldownProgress(CallbackInfoReturnable<Float> cir) {
        if (ArslaansMagicHaxClient.noAttackCooldown.isEnabled()) cir.setReturnValue(1.0F);
    }
}