Fix tamed horses despawning when player moves away (#1057)

Co-authored-by: MCbabel <MCbabel@users.noreply.github.com>
This commit is contained in:
Marlian
2026-03-10 04:06:38 +01:00
committed by GitHub
parent c90a6bf5ab
commit 91ae76f132
2 changed files with 10 additions and 0 deletions

View File

@@ -515,6 +515,15 @@ bool EntityHorse::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)
{

View File

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