Fix LivingEntity patch which caused crash while entities got hurt. Closes #9389

This commit is contained in:
LexManos committed 2023-03-16 11:50:11 -07:00
1 parent 7e6c8351c3
commit 88368dfa1c
1 file changed
+2 -7
@@ -5,7 +5,7 @@
import org.slf4j.Logger;
-public abstract class LivingEntity extends Entity implements Attackable {
+public abstract class LivingEntity extends Entity implements net.minecraftforge.common.extensions.IForgeLivingEntity {
+public abstract class LivingEntity extends Entity implements Attackable, net.minecraftforge.common.extensions.IForgeLivingEntity {
private static final Logger f_201943_ = LogUtils.getLogger();
private static final UUID f_20929_ = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
private static final UUID f_20959_ = UUID.fromString("87f46a96-686f-4796-b035-22e16ee9e038");
@@ -371,13 +371,8 @@
p_21241_ = this.m_21161_(p_21240_, p_21241_);
p_21241_ = this.m_6515_(p_21240_, p_21241_);
float f1 = Math.max(p_21241_ - this.m_6103_(), 0.0F);
@@ -1560,10 +_,11 @@
Entity entity = p_21240_.m_7639_();
if (entity instanceof ServerPlayer) {
ServerPlayer serverplayer = (ServerPlayer)entity;
- serverplayer.m_36222_(Stats.f_12929_, Math.round(f * 10.0F));
@@ -1564,6 +_,7 @@
}
+ ((ServerPlayer)p_21240_.m_7639_()).m_6278_(Stats.f_12988_.m_12902_(Stats.f_12929_), Math.round(f * 10.0F));
}
+ f1 = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_21240_, f1);