Files
MinecraftConsoles/Minecraft.World/NearestAttackableTargetGoal.h

50 lines
1.1 KiB
C
Raw Permalink Normal View History

2026-03-01 12:16:08 +08:00
#pragma once
#include "TargetGoal.h"
#include "EntitySelector.h"
class NearestAttackableTargetGoal;
// Anonymous class from NearestAttackableTargetGoal
class SubselectEntitySelector : public EntitySelector
{
private:
EntitySelector *m_subselector;
NearestAttackableTargetGoal *m_parent;
public:
SubselectEntitySelector(NearestAttackableTargetGoal *parent, EntitySelector *subselector);
~SubselectEntitySelector();
bool matches(shared_ptr<Entity> entity) const;
};
2026-03-01 12:16:08 +08:00
class NearestAttackableTargetGoal : public TargetGoal
{
friend class SubselectEntitySelector;
2026-03-01 12:16:08 +08:00
public:
class DistComp
{
private:
Entity *source;
public:
DistComp(Entity *source);
bool operator() (shared_ptr<Entity> e1, shared_ptr<Entity> e2);
2026-03-01 12:16:08 +08:00
};
private:
const type_info& targetType;
int randomInterval;
DistComp *distComp;
EntitySelector *selector;
weak_ptr<LivingEntity> target;
2026-03-01 12:16:08 +08:00
public:
NearestAttackableTargetGoal(PathfinderMob *mob, const type_info& targetType, int randomInterval, bool mustSee, bool mustReach = false, EntitySelector *entitySelector = NULL);
2026-03-01 12:16:08 +08:00
virtual ~NearestAttackableTargetGoal();
virtual bool canUse();
void start();
};