|
603 | 603 | this.f_19804_.m_135381_(f_20961_, Mth.m_14036_(p_21154_, 0.0F, this.m_21233_())); |
604 | 604 | } |
605 | 605 |
|
606 | | -@@ -1036,35 +_,28 @@ |
| 606 | +@@ -1036,36 +_,43 @@ |
607 | 607 | } |
608 | 608 |
|
609 | 609 | public boolean m_6469_(DamageSource p_21016_, float p_21017_) { |
|
630 | 630 | + |
631 | 631 | boolean flag = false; |
632 | 632 | float f1 = 0.0F; |
633 | | - if (p_21017_ > 0.0F && this.m_21275_(p_21016_)) { |
| 633 | +- if (p_21017_ > 0.0F && this.m_21275_(p_21016_)) { |
634 | 634 | - this.m_7909_(p_21017_); |
635 | 635 | - f1 = p_21017_; |
636 | 636 | - p_21017_ = 0.0F; |
|
639 | 639 | - if (entity instanceof LivingEntity) { |
640 | 640 | - LivingEntity livingentity = (LivingEntity)entity; |
641 | 641 | - this.m_6728_(livingentity); |
642 | | -- } |
| 642 | ++ if (false && p_21017_ > 0.0F && this.m_21275_(p_21016_)) { |
| 643 | ++ net.minecraftforge.event.entity.living.ShieldBlockEvent ev = net.minecraftforge.common.ForgeHooks.onShieldBlock(this, p_21016_, p_21017_); |
| 644 | ++ if(!ev.isCanceled()) { |
| 645 | ++ if(ev.shieldTakesDamage()) this.m_7909_(p_21017_); |
| 646 | ++ f1 = ev.getBlockedDamage(); |
| 647 | ++ p_21017_ -= ev.getBlockedDamage(); |
| 648 | ++ if (!p_21016_.m_269533_(DamageTypeTags.f_268524_)) { |
| 649 | ++ Entity entity = p_21016_.m_7640_(); |
| 650 | ++ if (entity instanceof LivingEntity) { |
| 651 | ++ LivingEntity livingentity = (LivingEntity)entity; |
| 652 | ++ this.m_6728_(livingentity); |
| 653 | ++ } |
| 654 | + } |
643 | 655 | - } |
644 | | -- |
645 | | - flag = true; |
| 656 | + |
| 657 | +- flag = true; |
| 658 | ++ flag = p_21017_ <= 0; |
| 659 | ++ } |
646 | 660 | } |
647 | 661 |
|
| 662 | + if (p_21016_.m_269533_(DamageTypeTags.f_268419_) && this.m_6095_().m_204039_(EntityTypeTags.f_144295_)) { |
648 | 663 | @@ -1074,23 +_,39 @@ |
649 | 664 |
|
650 | 665 | this.f_267362_.m_267771_(1.5F); |
|
999 | 1014 | } |
1000 | 1015 |
|
1001 | 1016 | if (p_21194_ <= 0.0F) { |
1002 | | -@@ -1582,27 +_,250 @@ |
| 1017 | +@@ -1582,27 +_,238 @@ |
1003 | 1018 | } |
1004 | 1019 |
|
1005 | 1020 | protected void m_6475_(DamageSource p_21240_, float p_21241_) { |
|
1037 | 1052 | + } |
1038 | 1053 | + |
1039 | 1054 | + protected boolean injectedHurt = true; |
1040 | | -+ public AtomicBoolean canDamage = new AtomicBoolean(true); |
| 1055 | ++ public AtomicBoolean canDamage = new AtomicBoolean(false); |
1041 | 1056 | + public AtomicDouble damage = new AtomicDouble(-999); |
1042 | 1057 | + public boolean canDamage() { |
1043 | | -+ return canDamage.getAndSet(true); |
| 1058 | ++ return canDamage.getAndSet(false); |
1044 | 1059 | + } |
1045 | 1060 | + // Mohist end |
1046 | 1061 | + |
|
1070 | 1085 | + p_21241_ = ForgeHooks.onLivingHurt(this, p_21240_, p_21241_); |
1071 | 1086 | + // If the damage is negative return true |
1072 | 1087 | + if (p_21241_ < 0) { |
| 1088 | ++ canDamage.set(true); |
1073 | 1089 | + return true; |
1074 | 1090 | + } |
1075 | 1091 | + final float originalDamage = p_21241_; |
1076 | 1092 | + |
1077 | 1093 | + Function<Double, Double> hardHat = new Function<Double, Double>() { |
1078 | 1094 | + @Override |
1079 | 1095 | + public Double apply(Double input) { |
1080 | | -+ if (p_21240_.m_269533_(DamageTypeTags.f_268627_) && !LivingEntity.this.m_6844_(EquipmentSlot.HEAD).m_41619_()) { |
| 1096 | ++ if (p_21240_.m_269533_(DamageTypeTags.f_268627_) && !LivingEntity.this.m_6844_(EquipmentSlot.HEAD).m_41619_()) { |
1081 | 1097 | + return -(input - (input * 0.75F)); |
1082 | 1098 | + } |
1083 | 1099 | + return -0.0; |
|
1093 | 1109 | + if (!shieldEvent.isCanceled()) { |
1094 | 1110 | + var blocked = shieldEvent.getBlockedDamage(); |
1095 | 1111 | + shieldTakesDamage = shieldEvent.shieldTakesDamage(); |
1096 | | -+ blocking = new Function<Double, Double>() { |
1097 | | -+ @Override |
1098 | | -+ public Double apply(Double input) { |
1099 | | -+ return -(double) blocked; |
1100 | | -+ } |
1101 | | -+ }; |
| 1112 | ++ blocking = input -> -(double) blocked; |
1102 | 1113 | + } else { |
1103 | | -+ blocking = new Function<Double, Double>() { |
1104 | | -+ @Override |
1105 | | -+ public Double apply(Double input) { |
1106 | | -+ return 0d; |
1107 | | -+ } |
1108 | | -+ }; |
| 1114 | ++ blocking = input -> 0d; |
1109 | 1115 | + } |
1110 | 1116 | + } else { |
1111 | | -+ blocking = new Function<Double, Double>() { |
1112 | | -+ @Override |
1113 | | -+ public Double apply(Double input) { |
1114 | | -+ return 0d; |
1115 | | -+ } |
1116 | | -+ }; |
| 1117 | ++ blocking = input -> 0d; |
1117 | 1118 | + } |
1118 | 1119 | + float blockingModifier = blocking.apply((double) p_21241_).floatValue(); |
1119 | 1120 | + p_21241_ += blockingModifier; |
|
1256 | 1257 | + CriteriaTriggers.f_10573_.m_60112_(serverPlayer, this, p_21240_, p_21241_, originalDamage, true); |
1257 | 1258 | + } |
1258 | 1259 | + this.canDamage.set(false); |
1259 | | -+ return false ; |
| 1260 | ++ return false; |
1260 | 1261 | + } else { |
1261 | | -+ return originalDamage > 0; |
| 1262 | ++ boolean eo = originalDamage > 0; |
| 1263 | ++ this.canDamage.set(eo); |
| 1264 | ++ return eo; |
1262 | 1265 | + } |
1263 | 1266 | + // CraftBukkit end |
1264 | 1267 | } |
|
0 commit comments