use of net.sistr.littlemaidrebirth.util.LivingAccessor in project LittleMaidReBirth-Architectury by SistrScarlet.
the class LittleMaidEntity method damage.
@Override
public boolean damage(DamageSource source, float amount) {
if (!world.isClient) {
// 味方のが当たってもちゃんと動くようにフレンド判定より前
if (amount <= 0 && source.getSource() instanceof SnowballEntity) {
play(LMSounds.HURT_SNOW);
return false;
}
}
Entity attacker = source.getAttacker();
// Friendからの攻撃を除外
if (attacker instanceof LivingEntity && isFriend((LivingEntity) attacker)) {
return false;
}
boolean isHurtTime = 0 < this.hurtTime;
boolean result = super.damage(source, amount);
if (!world.isClient && !isHurtTime) {
if (!result || amount <= 0F) {
play(LMSounds.HURT_NO_DAMAGE);
} else if (amount > 0F && ((LivingAccessor) this).blockedByShield_LM(source)) {
play(LMSounds.HURT_GUARD);
} else if (source == DamageSource.FALL) {
play(LMSounds.HURT_FALL);
} else if (source.isFire()) {
play(LMSounds.HURT_FIRE);
} else {
play(LMSounds.HURT);
}
}
return result;
}
use of net.sistr.littlemaidrebirth.util.LivingAccessor in project LittleMaidReBirth-Fabric by SistrScarlet.
the class LittleMaidEntity method damage.
@Override
public boolean damage(DamageSource source, float amount) {
if (!world.isClient) {
// 味方のが当たってもちゃんと動くようにフレンド判定より前
if (amount <= 0 && source.getSource() instanceof SnowballEntity) {
play(LMSounds.HURT_SNOW);
return false;
}
}
Entity attacker = source.getAttacker();
// Friendからの攻撃を除外
if (attacker instanceof LivingEntity && isFriend((LivingEntity) attacker)) {
return false;
}
boolean isHurtTime = 0 < this.hurtTime;
boolean result = super.damage(source, amount);
if (!world.isClient && !isHurtTime) {
if (!result || amount <= 0F) {
play(LMSounds.HURT_NO_DAMAGE);
} else if (amount > 0F && ((LivingAccessor) this).blockedByShield_LM(source)) {
play(LMSounds.HURT_GUARD);
} else if (source == DamageSource.FALL) {
play(LMSounds.HURT_FALL);
} else if (source.isFire()) {
play(LMSounds.HURT_FIRE);
} else {
play(LMSounds.HURT);
}
}
return result;
}
Aggregations