本文整理汇总了PHP中pocketmine\utils\UUID::fromRandom方法的典型用法代码示例。如果您正苦于以下问题:PHP UUID::fromRandom方法的具体用法?PHP UUID::fromRandom怎么用?PHP UUID::fromRandom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\utils\UUID
的用法示例。
在下文中一共展示了UUID::fromRandom方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: encode
public function encode()
{
$p = [];
if ($this->entityId === null) {
$this->entityId = bcadd("1095216660480", mt_rand(0, 0x7fffffff));
//No conflict with other things
} else {
$pk0 = new RemoveEntityPacket();
$pk0->eid = $this->entityId;
$p[] = $pk0;
}
if (!$this->invisible) {
$pk = new AddPlayerPacket();
$pk->eid = $this->entityId;
$pk->uuid = UUID::fromRandom();
$pk->x = $this->x;
$pk->y = $this->y - 1.62;
$pk->z = $this->z;
$pk->speedX = 0;
$pk->speedY = 0;
$pk->speedZ = 0;
$pk->yaw = 0;
$pk->pitch = 0;
$pk->item = Item::get(0);
$pk->metadata = [Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE, 1 << Entity::DATA_FLAG_INVISIBLE], Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING, $this->title . ($this->text !== "" ? "\n" . $this->text : "")], Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE, 1], Entity::DATA_NO_AI => [Entity::DATA_TYPE_BYTE, 1], Entity::DATA_LEAD_HOLDER => [Entity::DATA_TYPE_LONG, -1], Entity::DATA_LEAD => [Entity::DATA_TYPE_BYTE, 0]];
$p[] = $pk;
}
return $p;
}
示例2: __construct
public function __construct(Location $loc, $name, $skin, $skinName, Item $item, $message = "")
{
parent::__construct($loc->x, $loc->y, $loc->z, $loc->yaw, $loc->pitch, $loc->level);
$this->eid = Entity::$entityCount++;
$this->skin = $skin;
$this->skinName = $skinName;
$this->name = $name;
$this->item = $item;
$this->message = $message;
$this->uuid = UUID::fromRandom();
}
示例3: __construct
public function __construct(Main $plugin, Location $loc, $name, $skin, $skinId, Item $item, $message = "", $command = null)
{
parent::__construct($loc->x, $loc->y, $loc->z, $loc->yaw, $loc->pitch, $loc->level);
$this->plugin = $plugin;
$this->eid = Entity::$entityCount++;
$this->skin = $skin;
$this->skinId = $skinId;
$this->name = $name;
$this->item = $item;
$this->message = $message;
$this->command = $command;
$this->uuid = UUID::fromRandom();
}
示例4: __construct
public function __construct(SourceInterface $interface, $clientID, $ip, $port)
{
parent::__construct($interface, $clientID, $ip, $port);
$this->randomUUID = UUID::fromRandom();
$this->inventory = new DummyInventory($this);
}