feat: navigate in projected area
This commit is contained in:
parent
3f168dbd8e
commit
5ae62c00d0
@ -104,4 +104,6 @@ class ProjectedPersonEntity(entityType: EntityType<out PathfinderMob>, level: Le
|
|||||||
|
|
||||||
override fun getNameTagOffsetY() = super.getNameTagOffsetY() - (BOUNDING_HEIGHT * (1.2f - shape.scaleY))
|
override fun getNameTagOffsetY() = super.getNameTagOffsetY() - (BOUNDING_HEIGHT * (1.2f - shape.scaleY))
|
||||||
|
|
||||||
|
override fun createNavigation(level: Level) = ProjectedPersonNavigation(this, level)
|
||||||
|
|
||||||
}
|
}
|
@ -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<BlockPos>, 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)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user