Compare commits
4 Commits
e25f23f40b
...
d110d688c6
Author | SHA1 | Date | |
---|---|---|---|
d110d688c6 | |||
6cc16233fa | |||
00ce17cb21 | |||
3a4ad875e2 |
@ -177,7 +177,8 @@ class ProjectedPersonEntity(entityType: EntityType<out PathfinderMob>, level: Le
|
||||
Projector.findNearbyProjections(level(), blockPosition(), SwarmProjection.effect.get()).isNotEmpty()
|
||||
|
||||
override fun checkDespawn() {
|
||||
super.checkDespawn()
|
||||
// no despawn
|
||||
// super.checkDespawn()
|
||||
if (!checkProjectionEffect() && !CausalityAnchor.checkEffect(level(), blockPosition())) {
|
||||
dropEquipment()
|
||||
remove(RemovalReason.KILLED)
|
||||
|
@ -71,6 +71,7 @@ object ProjectedPersonAI {
|
||||
MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE,
|
||||
MemoryModuleType.HOME,
|
||||
MemoryModuleType.LAST_WOKEN,
|
||||
MemoryModuleType.NEAREST_BED,
|
||||
NearestVisibleContainer.memory.get(),
|
||||
)
|
||||
}
|
||||
@ -158,7 +159,15 @@ object ProjectedPersonAI {
|
||||
brain.addActivity(
|
||||
Activity.WORK, ImmutableList.of(
|
||||
5 weight ExchangeItem(),
|
||||
10 weight createStrollBehavior(),
|
||||
7 weight WorkPoiAI.createStrollAroundPoi(),
|
||||
7 weight WorkPoiAI.createStrollToPoi(),
|
||||
10 weight RunOne(
|
||||
mapOf(),
|
||||
listOf(
|
||||
1 weightR createStrollBehavior(),
|
||||
1 weightR WorkPoiAI.createAcquirePoi(),
|
||||
)
|
||||
),
|
||||
)
|
||||
)
|
||||
}
|
||||
@ -182,7 +191,7 @@ object ProjectedPersonAI {
|
||||
|
||||
private fun createStrollBehavior() = RunOne(
|
||||
listOf(
|
||||
2 weightR RandomStroll.stroll(1.0f),
|
||||
2 weightR RandomStroll.stroll(1.0f, 25, 12),
|
||||
2 weightR SetWalkTargetFromLookTarget.create(1.0f, 5),
|
||||
1 weightR DoNothing(30, 60)
|
||||
)
|
||||
|
@ -0,0 +1,49 @@
|
||||
package quaedam.projection.swarm.ai
|
||||
|
||||
import net.minecraft.core.GlobalPos
|
||||
import net.minecraft.world.entity.ai.behavior.AcquirePoi
|
||||
import net.minecraft.world.entity.ai.behavior.StrollAroundPoi
|
||||
import net.minecraft.world.entity.ai.behavior.StrollToPoi
|
||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||
import net.minecraft.world.entity.ai.village.poi.PoiTypes
|
||||
import quaedam.Quaedam
|
||||
import java.util.*
|
||||
|
||||
object WorkPoiAI {
|
||||
|
||||
const val ID = "work"
|
||||
|
||||
val poiTypes by lazy {
|
||||
setOf(
|
||||
PoiTypes.ARMORER,
|
||||
PoiTypes.BUTCHER,
|
||||
PoiTypes.CARTOGRAPHER,
|
||||
PoiTypes.CLERIC,
|
||||
PoiTypes.FARMER,
|
||||
PoiTypes.FISHERMAN,
|
||||
PoiTypes.FLETCHER,
|
||||
PoiTypes.LEATHERWORKER,
|
||||
PoiTypes.LIBRARIAN,
|
||||
PoiTypes.MASON,
|
||||
PoiTypes.SHEPHERD,
|
||||
PoiTypes.TOOLSMITH,
|
||||
PoiTypes.WEAPONSMITH,
|
||||
PoiTypes.LODESTONE,
|
||||
PoiTypes.LIGHTNING_ROD,
|
||||
)
|
||||
}
|
||||
|
||||
val memory = Quaedam.memoryTypes.register(ID) {
|
||||
MemoryModuleType(Optional.of(GlobalPos.CODEC))
|
||||
}!!
|
||||
|
||||
fun createAcquirePoi() =
|
||||
AcquirePoi.create({ it.`is` { key -> key in poiTypes } }, memory.get(), false, Optional.empty())
|
||||
|
||||
fun createStrollToPoi() =
|
||||
StrollToPoi.create(memory.get(), 0.4f, 7, 4)
|
||||
|
||||
fun createStrollAroundPoi() =
|
||||
StrollAroundPoi.create(memory.get(), 0.4f, 5)
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user