diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 80ca1d30a..5ab1d6a45 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -216,7 +216,13 @@ abstract class Entity{ /** @var int|null */ protected $targetId = null; + private bool $constructorCalled = false; + public function __construct(Location $location, ?CompoundTag $nbt = null){ + if($this->constructorCalled){ + throw new \LogicException("Attempted to call constructor for an Entity multiple times"); + } + $this->constructorCalled = true; Utils::checkLocationNotInfOrNaN($location); $this->timings = Timings::getEntityTimings($this);