mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-24 01:33:42 +00:00
31 lines
1 KiB
C++
31 lines
1 KiB
C++
#include "../../Platform/stdafx.h"
|
|
#include "../../Headers/net.minecraft.world.entity.ai.control.h"
|
|
#include "../../Headers/net.minecraft.world.entity.ai.navigation.h"
|
|
#include "../../Headers/net.minecraft.world.entity.ai.util.h"
|
|
#include "../../Headers/net.minecraft.world.entity.h"
|
|
#include "../../Headers/net.minecraft.world.phys.h"
|
|
#include "PanicGoal.h"
|
|
|
|
PanicGoal::PanicGoal(PathfinderMob* mob, double speedModifier) {
|
|
this->mob = mob;
|
|
this->speedModifier = speedModifier;
|
|
setRequiredControlFlags(Control::MoveControlFlag);
|
|
}
|
|
|
|
bool PanicGoal::canUse() {
|
|
if (mob->getLastHurtByMob() == NULL && !mob->isOnFire()) return false;
|
|
Vec3* pos = RandomPos::getPos(
|
|
std::dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 5,
|
|
4);
|
|
if (pos == NULL) return false;
|
|
posX = pos->x;
|
|
posY = pos->y;
|
|
posZ = pos->z;
|
|
return true;
|
|
}
|
|
|
|
void PanicGoal::start() {
|
|
mob->getNavigation()->moveTo(posX, posY, posZ, speedModifier);
|
|
}
|
|
|
|
bool PanicGoal::canContinueToUse() { return !mob->getNavigation()->isDone(); } |