Fix tamed horses despawning when player moves away

This commit is contained in:
MCbabel 2026-03-09 19:36:28 +01:00
parent bda3b1078a
commit cf2714de7d
2 changed files with 10 additions and 0 deletions

View file

@ -515,6 +515,15 @@ bool EntityHorse::canSpawn()
return Animal::canSpawn(); return Animal::canSpawn();
} }
bool EntityHorse::removeWhenFarAway()
{
if (isTamed()) return false;
if (isSaddled()) return false;
if (isLeashed()) return false;
if (getArmorType() > 0) return false;
return Animal::removeWhenFarAway();
}
shared_ptr<EntityHorse> EntityHorse::getClosestMommy(shared_ptr<Entity> baby, double searchRadius) shared_ptr<EntityHorse> EntityHorse::getClosestMommy(shared_ptr<Entity> baby, double searchRadius)
{ {

View file

@ -192,6 +192,7 @@ private:
public: public:
virtual void containerChanged(); virtual void containerChanged();
virtual bool canSpawn(); virtual bool canSpawn();
virtual bool removeWhenFarAway() override;
protected: protected:
virtual shared_ptr<EntityHorse> getClosestMommy(shared_ptr<Entity> baby, double searchRadius); virtual shared_ptr<EntityHorse> getClosestMommy(shared_ptr<Entity> baby, double searchRadius);