SubEntity hitbox fix. All enderdragon hitboxes are now hittable. (They were overwriting e var within the for loop...)

This commit is contained in:
Matt.T 2026-03-12 07:09:20 +00:00
parent 1036b7368e
commit cb0d352156

View file

@ -1628,18 +1628,18 @@ void LevelChunk::getEntities(shared_ptr<Entity> except, AABB *bb, vector<shared_
for (auto& e : *entities)
{
if ( e && e != except && e->bb->intersects(bb) && (selector == nullptr || selector->matches(e)))
if (e && e != except && e->bb->intersects(bb) && (selector == nullptr || selector->matches(e)))
{
es.push_back(e);
vector<shared_ptr<Entity> > *subs = e->getSubEntities();
if (subs != nullptr)
{
for (const auto& sub : *subs)
for (const auto& subEntity : *subs)
{
e = sub;
if ( e && e != except && e->bb->intersects(bb) && (selector == nullptr || selector->matches(e)))
if (subEntity && subEntity != except && subEntity->bb->intersects(bb) && (selector == nullptr || selector->matches(subEntity)))
{
es.push_back(e);
es.push_back(subEntity);
}
}
}