diff --git a/common/src/main/kotlin/quaedam/projection/swarm/ProjectedPersonEntity.kt b/common/src/main/kotlin/quaedam/projection/swarm/ProjectedPersonEntity.kt index 0fa33e2..e5741f5 100644 --- a/common/src/main/kotlin/quaedam/projection/swarm/ProjectedPersonEntity.kt +++ b/common/src/main/kotlin/quaedam/projection/swarm/ProjectedPersonEntity.kt @@ -104,4 +104,6 @@ class ProjectedPersonEntity(entityType: EntityType, level: Le override fun getNameTagOffsetY() = super.getNameTagOffsetY() - (BOUNDING_HEIGHT * (1.2f - shape.scaleY)) + override fun createNavigation(level: Level) = ProjectedPersonNavigation(this, level) + } \ No newline at end of file diff --git a/common/src/main/kotlin/quaedam/projection/swarm/ProjectedPersonNavigation.kt b/common/src/main/kotlin/quaedam/projection/swarm/ProjectedPersonNavigation.kt new file mode 100644 index 0000000..d10779f --- /dev/null +++ b/common/src/main/kotlin/quaedam/projection/swarm/ProjectedPersonNavigation.kt @@ -0,0 +1,18 @@ +package quaedam.projection.swarm + +import net.minecraft.core.BlockPos +import net.minecraft.world.entity.ai.navigation.GroundPathNavigation +import net.minecraft.world.level.Level +import net.minecraft.world.level.pathfinder.Path +import quaedam.projector.Projector + +class ProjectedPersonNavigation(val entity: ProjectedPersonEntity, level: Level) : GroundPathNavigation(entity, level) { + + override fun createPath(set: MutableSet, i: Int, bl: Boolean, j: Int, f: Float): Path? { + if (set.any { Projector.findNearbyProjections(level, it, SwarmProjection.effect.get()).isEmpty() }) { + return null + } + return super.createPath(set, i, bl, j, f) + } + +} \ No newline at end of file