feat: remove projected entity out of projection
This commit is contained in:
parent
5ae62c00d0
commit
f4799eca51
@ -16,6 +16,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.ServerLevelAccessor
|
||||
import quaedam.Quaedam
|
||||
import quaedam.projector.Projector
|
||||
|
||||
class ProjectedPersonEntity(entityType: EntityType<out PathfinderMob>, level: Level) :
|
||||
PathfinderMob(entityType, level) {
|
||||
@ -106,4 +107,17 @@ class ProjectedPersonEntity(entityType: EntityType<out PathfinderMob>, level: Le
|
||||
|
||||
override fun createNavigation(level: Level) = ProjectedPersonNavigation(this, level)
|
||||
|
||||
override fun tick() {
|
||||
super.tick()
|
||||
if (tickCount % 20 == 0) {
|
||||
tickProjectionCheck()
|
||||
}
|
||||
}
|
||||
|
||||
private fun tickProjectionCheck() {
|
||||
if (Projector.findNearbyProjections(level(), blockPosition(), SwarmProjection.effect.get()).isEmpty()) {
|
||||
remove(RemovalReason.KILLED)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user