本文整理汇总了PHP中pocketmine\nbt\NBT::feof方法的典型用法代码示例。如果您正苦于以下问题:PHP NBT::feof方法的具体用法?PHP NBT::feof怎么用?PHP NBT::feof使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\nbt\NBT
的用法示例。
在下文中一共展示了NBT::feof方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read
public function read(NBT $nbt)
{
$this->value = [];
do {
$tag = $nbt->readTag();
if ($tag instanceof NamedTag and $tag->getName() !== "") {
$this->{$tag->getName()} = $tag;
}
} while (!$tag instanceof End and !$nbt->feof());
}
示例2: read
public function read(NBT $nbt)
{
$this->value = [];
$this->tagType = $nbt->getByte();
$size = $nbt->getInt();
for ($i = 0; $i < $size and !$nbt->feof(); ++$i) {
switch ($this->tagType) {
case NBT::TAG_Byte:
$tag = new Byte("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Short:
$tag = new Short("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Int:
$tag = new Int("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Long:
$tag = new Long("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Float:
$tag = new Float("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Double:
$tag = new Double("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_ByteArray:
$tag = new ByteArray("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_String:
$tag = new String("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Enum:
$tag = new TagEnum("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Compound:
$tag = new Compound("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_IntArray:
$tag = new IntArray("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
}
}
}
示例3: read
public function read(NBT $nbt)
{
$this->value = [];
$this->tagType = \ord($nbt->get(1));
$size = $nbt->endianness === 1 ? \PHP_INT_SIZE === 8 ? \unpack("N", $nbt->get(4))[1] << 32 >> 32 : \unpack("N", $nbt->get(4))[1] : (\PHP_INT_SIZE === 8 ? \unpack("V", $nbt->get(4))[1] << 32 >> 32 : \unpack("V", $nbt->get(4))[1]);
for ($i = 0; $i < $size and !$nbt->feof(); ++$i) {
switch ($this->tagType) {
case NBT::TAG_Byte:
$tag = new Byte("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Short:
$tag = new Short("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Int:
$tag = new Int("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Long:
$tag = new Long("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Float:
$tag = new Float("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Double:
$tag = new Double("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_ByteArray:
$tag = new ByteArray("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_String:
$tag = new String("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Enum:
$tag = new TagEnum("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_Compound:
$tag = new Compound("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
case NBT::TAG_IntArray:
$tag = new IntArray("");
$tag->read($nbt);
$this->{$i} = $tag;
break;
}
}
}
示例4: read
public function read(NBT $nbt, bool $network = false)
{
$this->value = [];
$this->tagType = $nbt->getByte();
$size = $nbt->getInt($network);
for ($i = 0; $i < $size and !$nbt->feof(); ++$i) {
switch ($this->tagType) {
case NBT::TAG_Byte:
$tag = new ByteTag("");
$tag->read($nbt, $network);
$this->{$i} = $tag;
break;
case NBT::TAG_Short:
$tag = new ShortTag("");
$tag->read($nbt, $network);
$this->{$i} = $tag;
break;
case NBT::TAG_Int:
$tag = new IntTag("");
$tag->read($nbt, $network);
$this->{$i} = $tag;
break;
case NBT::TAG_Long:
$tag = new LongTag("");
$tag->read($nbt, $network);
$this->{$i} = $tag;
break;
case NBT::TAG_Float:
$tag = new FloatTag("");
$tag->read($nbt, $network);
$this->{$i} = $tag;
break;
case NBT::TAG_Double:
$tag = new DoubleTag("");
$tag->read($nbt, $network);
$this->{$i} = $tag;
break;
case NBT::TAG_ByteArray:
$tag = new ByteArrayTag("");
$tag->read($nbt, $network);
$this->{$i} = $tag;
break;
case NBT::TAG_String:
$tag = new StringTag("");
$tag->read($nbt, $network);
$this->{$i} = $tag;
break;
case NBT::TAG_List:
$tag = new TagEnum("");
$tag->read($nbt, $network);
$this->{$i} = $tag;
break;
case NBT::TAG_Compound:
$tag = new CompoundTag("");
$tag->read($nbt, $network);
$this->{$i} = $tag;
break;
case NBT::TAG_IntArray:
$tag = new IntArrayTag("");
$tag->read($nbt, $network);
$this->{$i} = $tag;
break;
}
}
}