PocketMine-MP 5.37.2 git-aa47b7cd412ddb171ec53c035c2bbe84199be285
Loading...
Searching...
No Matches
pocketmine\nbt\tag\CompoundTag Class Reference
+ Inheritance diagram for pocketmine\nbt\tag\CompoundTag:
+ Collaboration diagram for pocketmine\nbt\tag\CompoundTag:

Public Member Functions

 __clone ()
 
 __toString ()
 
 count ()
 
 equals (Tag $that)
 
 getByte (string $name, ?int $default=null)
 
 getByteArray (string $name, ?string $default=null)
 
 getCompoundTag (string $name)
 
 getCount ()
 
 getDouble (string $name, ?float $default=null)
 
 getFloat (string $name, ?float $default=null)
 
 getInt (string $name, ?int $default=null)
 
 getIntArray (string $name, ?array $default=null)
 
 getIterator ()
 
 getListTag (string $name, string $tagClass=Tag::class)
 
 getLong (string $name, ?int $default=null)
 
 getShort (string $name, ?int $default=null)
 
 getString (string $name, ?string $default=null)
 
 getTag (string $name)
 
 getType ()
 
 getValue ()
 
 merge (CompoundTag $other)
 
 removeTag (string ... $names)
 
 safeClone ()
 
 setByte (string $name, int $value)
 
 setByteArray (string $name, string $value)
 
 setDouble (string $name, float $value)
 
 setFloat (string $name, float $value)
 
 setInt (string $name, int $value)
 
 setIntArray (string $name, array $value)
 
 setLong (string $name, int $value)
 
 setShort (string $name, int $value)
 
 setString (string $name, string $value)
 
 setTag (string $name, Tag $tag)
 
 toString (int $indentation=0)
 
 write (NbtStreamWriter $writer)
 

Static Public Member Functions

static create ()
 
static read (NbtStreamReader $reader, ReaderTracker $tracker)
 

Protected Member Functions

 getTypeName ()
 
 makeCopy ()
 
 stringifyValue (int $indentation)
 

Static Protected Member Functions

static restrictArgCount (string $func, int $haveArgs, int $wantMaxArgs)
 

Protected Attributes

 $cloning = false
 

Detailed Description

@phpstan-implements \IteratorAggregate<string, Tag>

Definition at line 45 of file CompoundTag.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\nbt\tag\CompoundTag::__construct ( )

Definition at line 51 of file CompoundTag.php.

Member Function Documentation

◆ __clone()

pocketmine\nbt\tag\CompoundTag::__clone ( )

Definition at line 346 of file CompoundTag.php.

◆ __toString()

pocketmine\nbt\tag\Tag::__toString ( )
inherited

Definition at line 43 of file Tag.php.

◆ count()

pocketmine\nbt\tag\CompoundTag::count ( )

Definition at line 62 of file CompoundTag.php.

◆ create()

static pocketmine\nbt\tag\CompoundTag::create ( )
static

Helper method for easier fluent usage.

Definition at line 58 of file CompoundTag.php.

◆ equals()

pocketmine\nbt\tag\CompoundTag::equals ( Tag $that)

Compares this Tag to the given Tag and determines whether or not they are equal, based on type and value. Complex tag types should override this to provide proper value comparison.

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 368 of file CompoundTag.php.

◆ getByte()

pocketmine\nbt\tag\CompoundTag::getByte ( string $name,
?int $default = null )

Definition at line 185 of file CompoundTag.php.

◆ getByteArray()

pocketmine\nbt\tag\CompoundTag::getByteArray ( string $name,
?string $default = null )

Definition at line 209 of file CompoundTag.php.

◆ getCompoundTag()

pocketmine\nbt\tag\CompoundTag::getCompoundTag ( string $name)

Returns the CompoundTag with the specified name, or null if it does not exist. Triggers an exception if a tag exists with that name and the tag is not a CompoundTag.

Definition at line 120 of file CompoundTag.php.

◆ getCount()

pocketmine\nbt\tag\CompoundTag::getCount ( )
Returns
int

Definition at line 69 of file CompoundTag.php.

◆ getDouble()

pocketmine\nbt\tag\CompoundTag::getDouble ( string $name,
?float $default = null )

Definition at line 205 of file CompoundTag.php.

◆ getFloat()

pocketmine\nbt\tag\CompoundTag::getFloat ( string $name,
?float $default = null )

Definition at line 201 of file CompoundTag.php.

◆ getInt()

pocketmine\nbt\tag\CompoundTag::getInt ( string $name,
?int $default = null )

Definition at line 193 of file CompoundTag.php.

◆ getIntArray()

pocketmine\nbt\tag\CompoundTag::getIntArray ( string $name,
?array $default = null )
Parameters
int[] | null$default
Returns
int[]

Definition at line 222 of file CompoundTag.php.

◆ getIterator()

pocketmine\nbt\tag\CompoundTag::getIterator ( )
Returns
\Generator|Tag[] @phpstan-return \Generator<string, Tag, void, void>

Definition at line 360 of file CompoundTag.php.

◆ getListTag()

pocketmine\nbt\tag\CompoundTag::getListTag ( string $name,
string $tagClass = Tag::class )

Returns the ListTag with the specified name, or null if it does not exist. Triggers an exception if a tag exists with that name and the tag is not a ListTag.

@phpstan-template TValue of Tag @phpstan-param class-string<TValue> $tagClass @phpstan-return ListTag<TValue>|null

Exceptions
UnexpectedTagTypeException

Definition at line 101 of file CompoundTag.php.

◆ getLong()

pocketmine\nbt\tag\CompoundTag::getLong ( string $name,
?int $default = null )

Definition at line 197 of file CompoundTag.php.

◆ getShort()

pocketmine\nbt\tag\CompoundTag::getShort ( string $name,
?int $default = null )

Definition at line 189 of file CompoundTag.php.

◆ getString()

pocketmine\nbt\tag\CompoundTag::getString ( string $name,
?string $default = null )

Definition at line 213 of file CompoundTag.php.

◆ getTag()

pocketmine\nbt\tag\CompoundTag::getTag ( string $name)

Returns the tag with the specified name, or null if it does not exist.

Definition at line 87 of file CompoundTag.php.

◆ getType()

pocketmine\nbt\tag\CompoundTag::getType ( )

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 300 of file CompoundTag.php.

◆ getTypeName()

pocketmine\nbt\tag\CompoundTag::getTypeName ( )
protected

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 296 of file CompoundTag.php.

◆ getValue()

pocketmine\nbt\tag\CompoundTag::getValue ( )
Returns
Tag[]

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 76 of file CompoundTag.php.

◆ makeCopy()

pocketmine\nbt\tag\CompoundTag::makeCopy ( )
protected
Returns
static

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 352 of file CompoundTag.php.

◆ merge()

pocketmine\nbt\tag\CompoundTag::merge ( CompoundTag $other)

Returns a copy of this CompoundTag with values from the given CompoundTag merged into it. Tags that exist both in this tag and the other will be overwritten by the tag in the other.

This deep-clones all tags.

Definition at line 389 of file CompoundTag.php.

◆ read()

static pocketmine\nbt\tag\CompoundTag::read ( NbtStreamReader $reader,
ReaderTracker $tracker )
static

Definition at line 304 of file CompoundTag.php.

◆ removeTag()

pocketmine\nbt\tag\CompoundTag::removeTag ( string ... $names)

Removes the child tags with the specified names from the CompoundTag. This function accepts a variadic list of strings.

Definition at line 145 of file CompoundTag.php.

Referenced by pocketmine\block\tile\ShulkerBox\onBlockDestroyedHook(), and pocketmine\network\mcpe\convert\TypeConverter\stripBlockEntityNBT().

+ Here is the caller graph for this function:

◆ restrictArgCount()

static pocketmine\nbt\tag\Tag::restrictArgCount ( string $func,
int $haveArgs,
int $wantMaxArgs )
staticprotectedinherited

Definition at line 89 of file Tag.php.

◆ safeClone()

pocketmine\nbt\tag\Tag::safeClone ( )
inherited

Clones this tag safely, detecting recursive dependencies which would otherwise cause an infinite cloning loop. Used for cloning tags in tags that have children.

Exceptions

RuntimeException if a recursive dependency was detected

Returns
static

Definition at line 62 of file Tag.php.

◆ setByte()

pocketmine\nbt\tag\CompoundTag::setByte ( string $name,
int $value )
Returns
$this

Definition at line 233 of file CompoundTag.php.

◆ setByteArray()

pocketmine\nbt\tag\CompoundTag::setByteArray ( string $name,
string $value )
Returns
$this

Definition at line 275 of file CompoundTag.php.

◆ setDouble()

pocketmine\nbt\tag\CompoundTag::setDouble ( string $name,
float $value )
Returns
$this

Definition at line 268 of file CompoundTag.php.

◆ setFloat()

pocketmine\nbt\tag\CompoundTag::setFloat ( string $name,
float $value )
Returns
$this

Definition at line 261 of file CompoundTag.php.

◆ setInt()

pocketmine\nbt\tag\CompoundTag::setInt ( string $name,
int $value )
Returns
$this

Definition at line 247 of file CompoundTag.php.

Referenced by pocketmine\block\tile\Chest\addAdditionalSpawnData(), pocketmine\block\tile\Lectern\addAdditionalSpawnData(), pocketmine\block\tile\Chest\writeSaveData(), and pocketmine\block\tile\Lectern\writeSaveData().

+ Here is the caller graph for this function:

◆ setIntArray()

pocketmine\nbt\tag\CompoundTag::setIntArray ( string $name,
array $value )
Parameters
int[]$value@phpstan-param list<int> $value
Returns
$this

Definition at line 292 of file CompoundTag.php.

◆ setLong()

pocketmine\nbt\tag\CompoundTag::setLong ( string $name,
int $value )
Returns
$this

Definition at line 254 of file CompoundTag.php.

◆ setShort()

pocketmine\nbt\tag\CompoundTag::setShort ( string $name,
int $value )
Returns
$this

Definition at line 240 of file CompoundTag.php.

◆ setString()

pocketmine\nbt\tag\CompoundTag::setString ( string $name,
string $value )
Returns
$this

Definition at line 282 of file CompoundTag.php.

◆ setTag()

pocketmine\nbt\tag\CompoundTag::setTag ( string $name,
Tag $tag )

Sets the specified Tag as a child tag of the CompoundTag at the offset specified by the tag's name.

Returns
$this

Definition at line 133 of file CompoundTag.php.

Referenced by pocketmine\block\tile\FlowerPot\addAdditionalSpawnData(), pocketmine\block\tile\Jukebox\addAdditionalSpawnData(), pocketmine\block\tile\Lectern\addAdditionalSpawnData(), pocketmine\block\tile\FlowerPot\writeSaveData(), pocketmine\block\tile\Jukebox\writeSaveData(), pocketmine\block\tile\Lectern\writeSaveData(), and pocketmine\block\tile\MonsterSpawner\writeSaveData().

+ Here is the caller graph for this function:

◆ stringifyValue()

pocketmine\nbt\tag\CompoundTag::stringifyValue ( int $indentation)
protected

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 338 of file CompoundTag.php.

◆ toString()

pocketmine\nbt\tag\Tag::toString ( int $indentation = 0)
finalinherited

Definition at line 47 of file Tag.php.

◆ write()

pocketmine\nbt\tag\CompoundTag::write ( NbtStreamWriter $writer)

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 324 of file CompoundTag.php.

Member Data Documentation

◆ $cloning

pocketmine\nbt\tag\Tag::$cloning = false
protectedinherited

Definition at line 34 of file Tag.php.


The documentation for this class was generated from the following file: