fromRandom() public static method

public static fromRandom ( )
Example #1
0
 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;
 }
Example #2
0
 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();
 }
Example #3
0
File: NPC.php Project: onebone/NPC
 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();
 }
 public function __construct(SourceInterface $interface, $clientID, $ip, $port)
 {
     parent::__construct($interface, $clientID, $ip, $port);
     $this->randomUUID = UUID::fromRandom();
     $this->inventory = new DummyInventory($this);
 }