Skip to content

Commit

Permalink
fix #150
Browse files Browse the repository at this point in the history
  • Loading branch information
MoriyaShiine committed Jan 25, 2024
1 parent b25d93b commit 690b880
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import moriyashiine.enchancement.common.ModConfig;
import moriyashiine.enchancement.common.component.entity.DelayComponent;
import moriyashiine.enchancement.common.component.entity.ProjectileTimerComponent;
import moriyashiine.enchancement.common.init.ModEntityComponents;
import moriyashiine.enchancement.common.init.ModTags;
Expand All @@ -20,8 +21,15 @@
public class LivingEntityMixin {
@ModifyVariable(method = "damage", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;wakeUp()V", shift = At.Shift.BY, by = 2), argsOnly = true)
private float enchancement$projectilesBypassCooldownTimer(float value, DamageSource source) {
if (source.getSource() instanceof ProjectileEntity projectile && (ModConfig.projectilesBypassCooldown || ModEntityComponents.DELAY.get(projectile).hasDelay())) {
if (!projectile.getType().isIn(ModTags.EntityTypes.BYPASSES_DECREASING_DAMAGE)) {
if (source.getSource() instanceof ProjectileEntity projectile) {
boolean bypass = ModConfig.projectilesBypassCooldown;
if (!bypass) {
DelayComponent delayComponent = ModEntityComponents.DELAY.getNullable(projectile);
if (delayComponent != null && delayComponent.hasDelay()) {
bypass = true;
}
}
if (bypass && !projectile.getType().isIn(ModTags.EntityTypes.BYPASSES_DECREASING_DAMAGE)) {
ProjectileTimerComponent projectileTimerComponent = ModEntityComponents.PROJECTILE_TIMER.get(this);
projectileTimerComponent.incrementTimesHit();
projectileTimerComponent.markAsHit();
Expand Down

0 comments on commit 690b880

Please sign in to comment.