Fix: living entity kill
Also fix: https://github.com/Snowiiii/Pumpkin/issues/265
This commit is contained in:
parent
59aa53a56a
commit
987aaad3e9
@ -13,4 +13,4 @@ maven_group=de.snowii
|
|||||||
archives_base_name=extractor
|
archives_base_name=extractor
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# check this on https://modmuss50.me/fabric.html
|
# check this on https://modmuss50.me/fabric.html
|
||||||
fabric_version=0.107.0+1.21.3
|
fabric_version=0.108.0+1.21.3
|
||||||
|
|||||||
@ -78,10 +78,11 @@ impl LivingEntity {
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
let new_health = (self.health.load() - amount).max(0.0);
|
let new_health = (self.health.load() - amount).max(0.0);
|
||||||
self.set_health(new_health).await;
|
|
||||||
|
|
||||||
if new_health == 0.0 {
|
if new_health == 0.0 {
|
||||||
self.kill().await;
|
self.kill().await;
|
||||||
|
} else {
|
||||||
|
self.set_health(new_health).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,6 +143,8 @@ impl LivingEntity {
|
|||||||
///
|
///
|
||||||
/// This is similar to `kill` but Spawn Particles, Animation and plays death sound
|
/// This is similar to `kill` but Spawn Particles, Animation and plays death sound
|
||||||
pub async fn kill(&self) {
|
pub async fn kill(&self) {
|
||||||
|
self.set_health(0.0).await;
|
||||||
|
|
||||||
// Spawns death smoke particles
|
// Spawns death smoke particles
|
||||||
self.entity
|
self.entity
|
||||||
.world
|
.world
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user