34 protected $cloning =
false;
39 abstract public function getType() : int;
43 public function __toString(){
44 return $this->toString();
47 final public function toString(
int $indentation = 0) : string{
48 return
"TAG_" . $this->getTypeName() .
"=" . $this->stringifyValue($indentation);
51 abstract protected function getTypeName() : string;
53 abstract protected function stringifyValue(
int $indentation) : string;
63 throw new \RuntimeException(
"Recursive NBT tag dependency detected");
65 $this->cloning =
true;
67 $retval = $this->makeCopy();
69 $this->cloning =
false;
70 $retval->cloning =
false;
85 return $that instanceof $this and $this->getValue() === $that->getValue();
88 protected static function restrictArgCount(
string $func,
int $haveArgs,
int $wantMaxArgs) : void{
89 if($haveArgs > $wantMaxArgs){
90 throw new \ArgumentCountError(
"$func() expects at most $wantMaxArgs parameters, $haveArgs given");