feat: navigate to CTS area

This commit is contained in:
xtex 2023-07-27 11:33:14 +08:00
parent c290984202
commit dc4a9764cd
Signed by: xtex
GPG Key ID: B918086ED8045B91

View File

@ -4,6 +4,7 @@ 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.misc.cts.ConstantTemporalSink
import quaedam.projection.swarm.ProjectedPersonEntity
import quaedam.projection.swarm.SwarmProjection
import quaedam.projector.Projector
@ -11,7 +12,10 @@ import quaedam.projector.Projector
class ProjectedPersonNavigation(val entity: ProjectedPersonEntity, level: Level) : GroundPathNavigation(entity, level) {
override fun createPath(set: MutableSet<BlockPos>, i: Int, bl: Boolean, j: Int, f: Float): Path? {
if (set.any { Projector.findNearbyProjections(level, it, SwarmProjection.effect.get()).isEmpty() }) {
if (set.any {
Projector.findNearbyProjections(level, it, SwarmProjection.effect.get())
.isEmpty() && !ConstantTemporalSink.checkEffect(level, it)
}) {
return null
}
return super.createPath(set, i, bl, j, f)