PocketMine-MP
5.23.3 git-976fc63567edab7a6fb6aeae739f43cf9fe57de4
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
array_values;
30
use
function
assert;
31
use
function
func_num_args;
32
use
function
implode;
33
use
function
is_int;
34
35
final
class
IntArrayTag
extends
ImmutableTag
{
40
private
$value;
41
46
public
function
__construct
(array $value){
47
self::restrictArgCount(__METHOD__, func_num_args(), 1);
48
assert((
function
() use(&$value) :
bool
{
49
foreach
($value as $v){
50
if
(!is_int($v)){
51
return
false
;
52
}
53
}
54
55
return
true
;
56
})());
57
58
$this->value = array_values($value);
59
}
60
61
protected
function
getTypeName() : string{
62
return
"IntArray"
;
63
}
64
65
public
function
getType() : int{
66
return
NBT
::TAG_IntArray;
67
}
68
69
public
static
function
read(NbtStreamReader $reader) : self{
70
return new self($reader->readIntArray());
71
}
72
73
public
function
write(NbtStreamWriter $writer) : void{
74
$writer->writeIntArray($this->value);
75
}
76
77
protected
function
stringifyValue(
int
$indentation) : string{
78
return
"["
. implode(
","
, $this->value) .
"]"
;
79
}
80
85
public
function
getValue
() : array{
86
return $this->value;
87
}
88
}
pocketmine\nbt\NBT
Definition
NBT.php:42
pocketmine\nbt\tag\ImmutableTag
Definition
ImmutableTag.php:26
pocketmine\nbt\tag\IntArrayTag
Definition
IntArrayTag.php:35
pocketmine\nbt\tag\IntArrayTag\getValue
getValue()
Definition
IntArrayTag.php:85
pocketmine\nbt\tag\IntArrayTag\__construct
__construct(array $value)
Definition
IntArrayTag.php:46
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