完善电击效果伤害逻辑
This commit is contained in:
parent
84e3027794
commit
bbdc7d30b5
1 changed files with 5 additions and 8 deletions
|
@ -61,7 +61,6 @@ public class ShockMobEffect extends MobEffect {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
living.getPersistentData().putBoolean("TargetShock", true);
|
|
||||||
living.getPersistentData().putInt("TargetShockAttacker", source.getId());
|
living.getPersistentData().putInt("TargetShockAttacker", source.getId());
|
||||||
|
|
||||||
if (living.hasEffect(TargetModMobEffects.SHOCK.get())) {
|
if (living.hasEffect(TargetModMobEffects.SHOCK.get())) {
|
||||||
|
@ -84,7 +83,6 @@ public class ShockMobEffect extends MobEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instance.getEffect().equals(TargetModMobEffects.SHOCK.get())) {
|
if (instance.getEffect().equals(TargetModMobEffects.SHOCK.get())) {
|
||||||
living.getPersistentData().remove("TargetShock");
|
|
||||||
living.getPersistentData().remove("TargetShockAttacker");
|
living.getPersistentData().remove("TargetShockAttacker");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +97,6 @@ public class ShockMobEffect extends MobEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instance.getEffect().equals(TargetModMobEffects.SHOCK.get())) {
|
if (instance.getEffect().equals(TargetModMobEffects.SHOCK.get())) {
|
||||||
living.getPersistentData().remove("TargetShock");
|
|
||||||
living.getPersistentData().remove("TargetShockAttacker");
|
living.getPersistentData().remove("TargetShockAttacker");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,13 +112,13 @@ public class ShockMobEffect extends MobEffect {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!living.getPersistentData().contains("TargetShockAttacker") ||
|
Entity entity;
|
||||||
!living.getPersistentData().getBoolean("TargetShock")) {
|
if (!living.getPersistentData().contains("TargetShockAttacker")) {
|
||||||
return;
|
entity = null;
|
||||||
|
} else {
|
||||||
|
entity = living.level().getEntity(living.getPersistentData().getInt("TargetShockAttacker"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity entity = living.level().getEntity(living.getPersistentData().getInt("TargetShockAttacker"));
|
|
||||||
|
|
||||||
if (instance.getDuration() % 20 == 0) {
|
if (instance.getDuration() % 20 == 0) {
|
||||||
living.hurt(TargetModDamageTypes.causeShockDamage(living.level().registryAccess(), entity), 5.0f);
|
living.hurt(TargetModDamageTypes.causeShockDamage(living.level().registryAccess(), entity), 5.0f);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue