register(Attribute::ABSORPTION, 0.00, 340282346638528859811704183484516925440.00, 0.00); $this->register(Attribute::SATURATION, 0.00, 20.00, 20.00); $this->register(Attribute::EXHAUSTION, 0.00, 5.00, 0.0, false); $this->register(Attribute::KNOCKBACK_RESISTANCE, 0.00, 1.00, 0.00); $this->register(Attribute::HEALTH, 0.00, 20.00, 20.00); $this->register(Attribute::MOVEMENT_SPEED, 0.00, 340282346638528859811704183484516925440.00, 0.10); $this->register(Attribute::FOLLOW_RANGE, 0.00, 2048.00, 16.00, false); $this->register(Attribute::HUNGER, 0.00, 20.00, 20.00); $this->register(Attribute::ATTACK_DAMAGE, 0.00, 340282346638528859811704183484516925440.00, 1.00, false); $this->register(Attribute::EXPERIENCE_LEVEL, 0.00, 24791.00, 0.00); $this->register(Attribute::EXPERIENCE, 0.00, 1.00, 0.00); $this->register(Attribute::UNDERWATER_MOVEMENT, 0.0, 340282346638528859811704183484516925440.0, 0.02); $this->register(Attribute::LUCK, -1024.0, 1024.0, 0.0); $this->register(Attribute::FALL_DAMAGE, 0.0, 340282346638528859811704183484516925440.0, 1.0); $this->register(Attribute::HORSE_JUMP_STRENGTH, 0.0, 2.0, 0.7); $this->register(Attribute::ZOMBIE_SPAWN_REINFORCEMENTS, 0.0, 1.0, 0.0); $this->register(Attribute::LAVA_MOVEMENT, 0.0, 340282346638528859811704183484516925440.0, 0.02); } public function get(string $id) : ?Attribute{ return isset($this->attributes[$id]) ? clone $this->attributes[$id] : null; } public function mustGet(string $id) : Attribute{ $result = $this->get($id); if($result === null){ throw new \InvalidArgumentException("Attribute $id is not registered"); } return $result; } /** * @throws \InvalidArgumentException */ public function register(string $id, float $minValue, float $maxValue, float $defaultValue, bool $shouldSend = true) : Attribute{ return $this->attributes[$id] = new Attribute($id, $minValue, $maxValue, $defaultValue, $shouldSend); } }