AttractRadius)) $nbt->AttractRadius = new IntTag("AttractRadius", 5); parent::__construct($chunk, $nbt); } /* Sets the attracting radius of the vacuum hopper @param $radius int */ public function setAttractRadius(int $radius) { $this->namedtag->AttractRadius->setValue($radius); return $this; } /* Get the radius of attractivity of the Vacuum Hopper. @return int */ public function getAttractRadius() : int { return (int) $this->namedtag->AttractRadius->getValue(); } /* Attracts all blocks in the defined radius. */ public function attract() { foreach ($this->getLevel()->getEntities() as $et) { if($et->x < $this->x + $this->namedtag->AttractRadius->getValue() && $et->x > $this->x - $this->namedtag->AttractRadius->getValue() && $et->y < $this->y + $this->namedtag->AttractRadius->getValue() && $et->y > $this->y - $this->namedtag->AttractRadius->getValue() && $et->z < $this->z + $this->namedtag->AttractRadius->getValue() && $et->z > $this->z - $this->namedtag->AttractRadius->getValue()) { $et->teleport(new Vector3($this->x, $this->y + 1, $this->z)); } } } }