PocketMine-MP
5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
IntArrayTag.php
1
<?php
2
3
/*
4
*
5
* ____ _ _ __ __ _ __ __ ____
6
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10
*
11
* This program is free software: you can redistribute it and/or modify
12
* it under the terms of the GNU Lesser General Public License as published by
13
* the Free Software Foundation, either version 3 of the License, or
14
* (at your option) any later version.
15
*
16
* @author PocketMine Team
17
* @link http://www.pocketmine.net/
18
*
19
*
20
*/
21
22
declare(strict_types=1);
23
24
namespace
pocketmine\nbt\tag;
25
26
use
pocketmine\nbt\NBT
;
27
use
pocketmine\nbt\NbtStreamReader
;
28
use
pocketmine\nbt\NbtStreamWriter
;
29
use
function
assert;
30
use
function
func_num_args;
31
use
function
implode;
32
use
function
is_int;
33
34
final
class
IntArrayTag
extends
ImmutableTag
{
36
private
$value;
37
41
public
function
__construct
(array $value){
42
self::restrictArgCount(__METHOD__, func_num_args(), 1);
43
assert((
function
() use(&$value) :
bool
{
44
foreach
($value as $v){
45
if
(!is_int($v)){
46
return
false
;
47
}
48
}
49
50
return
true
;
51
})());
52
53
$this->value = $value;
54
}
55
56
protected
function
getTypeName() : string{
57
return
"IntArray"
;
58
}
59
60
public
function
getType() : int{
61
return
NBT
::TAG_IntArray;
62
}
63
64
public
static
function
read(NbtStreamReader $reader) : self{
65
return new self($reader->readIntArray());
66
}
67
68
public
function
write(NbtStreamWriter $writer) : void{
69
$writer->writeIntArray($this->value);
70
}
71
72
protected
function
stringifyValue(
int
$indentation) : string{
73
return
"["
. implode(
","
, $this->value) .
"]"
;
74
}
75
79
public
function
getValue
() : array{
80
return $this->value;
81
}
82
}
pocketmine\nbt\NBT
Definition
NBT.php:42
pocketmine\nbt\tag\ImmutableTag
Definition
ImmutableTag.php:26
pocketmine\nbt\tag\IntArrayTag
Definition
IntArrayTag.php:34
pocketmine\nbt\tag\IntArrayTag\getValue
getValue()
Definition
IntArrayTag.php:79
pocketmine\nbt\tag\IntArrayTag\__construct
__construct(array $value)
Definition
IntArrayTag.php:41
pocketmine\nbt\NbtStreamReader
Definition
NbtStreamReader.php:31
pocketmine\nbt\NbtStreamWriter
Definition
NbtStreamWriter.php:29
vendor
pocketmine
nbt
src
tag
IntArrayTag.php
Generated by
1.12.0