Skip to content

Commit

Permalink
Added new files
Browse files Browse the repository at this point in the history
  • Loading branch information
shoghicp committed Jun 30, 2014
1 parent 020666e commit be47bf0
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/shoghicp/BigBrother/network/protocol/EntityMetadataPacket.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

/*
* BigBrother plugin for PocketMine-MP
* Copyright (C) 2014 shoghicp <https://github.com/shoghicp/BigBrother>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

namespace shoghicp\BigBrother\network\protocol;

use shoghicp\BigBrother\network\Packet;
use shoghicp\BigBrother\utils\Binary;

class EntityMetadataPacket extends Packet{

public $eid;
public $metadata;

public function pid(){
return 0x1c;
}

public function encode(){
$this->putInt($this->eid);
$this->put(Binary::writeMetadata($this->metadata));
}

public function decode(){

}
}
60 changes: 60 additions & 0 deletions src/shoghicp/BigBrother/network/protocol/SpawnMobPacket.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

/*
* BigBrother plugin for PocketMine-MP
* Copyright (C) 2014 shoghicp <https://github.com/shoghicp/BigBrother>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

namespace shoghicp\BigBrother\network\protocol;

use shoghicp\BigBrother\network\Packet;
use shoghicp\BigBrother\utils\Binary;

class SpawnMobPacket extends Packet{

public $eid;
public $type;
public $x;
public $y;
public $z;
public $yaw;
public $pitch;
public $headPitch;
public $velocityX;
public $velocityY;
public $velocityZ;
public $metadata;

public function pid(){
return 0x0f;
}

public function encode(){
$this->putVarInt($this->eid);
$this->putByte($this->type);
$this->putInt(intval($this->x * 32));
$this->putInt(intval($this->y * 32));
$this->putInt(intval($this->z * 32));
$this->putByte(($this->yaw / 360) << 8);
$this->putByte(($this->pitch / 360) << 8);
$this->putByte(($this->headPitch / 360) << 8);
$this->putShort($this->velocityX);
$this->putShort($this->velocityY);
$this->putShort($this->velocityZ);
$this->put(Binary::writeMetadata($this->metadata));
}

public function decode(){

}
}

0 comments on commit be47bf0

Please sign in to comment.