feat: TU19 (Dec 2014) Features & Content (#155)

* try to resolve merge conflict

* feat: TU19 (Dec 2014) Features & Content (#32)

* December 2014 files

* Working release build

* Fix compilation issues

* Add sound to Windows64Media

* Add DLC content and force Tutorial DLC

* Revert "Add DLC content and force Tutorial DLC"

This reverts commit 97a4399472.

* Disable broken light packing

* Disable breakpoint during DLC texture map load

Allows DLC loading but the DLC textures are still broken

* Fix post build not working

* ...

* fix vs2022 build

* fix cmake build

---------

Co-authored-by: Loki <lokirautio@gmail.com>
This commit is contained in:
daoge
2026-03-03 03:04:10 +08:00
committed by GitHub
parent 84c31a2331
commit b3feddfef3
2069 changed files with 264842 additions and 139522 deletions

View File

@@ -4,6 +4,24 @@
#include "net.minecraft.world.phys.h"
#include "NearestAttackableTargetGoal.h"
SubselectEntitySelector::SubselectEntitySelector(NearestAttackableTargetGoal *parent, EntitySelector *subselector)
{
m_parent = parent;
m_subselector = subselector;
}
SubselectEntitySelector::~SubselectEntitySelector()
{
delete m_subselector;
}
bool SubselectEntitySelector::matches(shared_ptr<Entity> entity) const
{
if (!entity->instanceof(eTYPE_LIVINGENTITY)) return false;
if (m_subselector != NULL && !m_subselector->matches(entity)) return false;
return m_parent->canAttack(dynamic_pointer_cast<LivingEntity>(entity), false);
}
NearestAttackableTargetGoal::DistComp::DistComp(Entity *source)
{
this->source = source;
@@ -19,49 +37,39 @@ bool NearestAttackableTargetGoal::DistComp::operator() (shared_ptr<Entity> e1, s
return true;
}
NearestAttackableTargetGoal::NearestAttackableTargetGoal(Mob *mob, const type_info& targetType, float within, int randomInterval, bool mustSee, bool mustReach /*= false*/) : TargetGoal(mob, within, mustSee, mustReach), targetType(targetType)
NearestAttackableTargetGoal::NearestAttackableTargetGoal(PathfinderMob *mob, const type_info& targetType, int randomInterval, bool mustSee, bool mustReach /*= false*/, EntitySelector *entitySelector /* =NULL */)
: TargetGoal(mob, mustSee, mustReach), targetType(targetType)
{
//this->targetType = targetType;
this->within = within;
this->randomInterval = randomInterval;
this->distComp = new DistComp(mob);
setRequiredControlFlags(TargetGoal::TargetFlag);
this->selector = new SubselectEntitySelector(this, entitySelector);
}
NearestAttackableTargetGoal::~NearestAttackableTargetGoal()
{
delete distComp;
delete selector;
}
bool NearestAttackableTargetGoal::canUse()
{
if (randomInterval > 0 && mob->getRandom()->nextInt(randomInterval) != 0) return false;
if (targetType == typeid(Player))
double within = getFollowDistance();
vector<shared_ptr<Entity> > *entities = mob->level->getEntitiesOfClass(targetType, mob->bb->grow(within, 4, within), selector);
bool result = false;
if(entities != NULL && !entities->empty() )
{
shared_ptr<Mob> potentialTarget = mob->level->getNearestAttackablePlayer(mob->shared_from_this(), within);
if (canAttack(potentialTarget, false))
{
target = weak_ptr<Mob>(potentialTarget);
return true;
}
}
else
{
vector<shared_ptr<Entity> > *entities = mob->level->getEntitiesOfClass(targetType, mob->bb->grow(within, 4, within));
//Collections.sort(entities, distComp);
std::sort(entities->begin(), entities->end(), *distComp);
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
{
shared_ptr<Mob> potTarget = dynamic_pointer_cast<Mob>(*it);
if (canAttack(potTarget, false))
{
target = weak_ptr<Mob>(potTarget);
return true;
}
}
delete entities;
target = weak_ptr<LivingEntity>(dynamic_pointer_cast<LivingEntity>(entities->at(0)));
result = true;
}
return false;
delete entities;
return result;
}
void NearestAttackableTargetGoal::start()