Merge branch 'master' into pr

This commit is contained in:
yefengeeeeeeeeeee 2025-04-29 17:42:31 +08:00 • committed by GitHub
commit c3a8ecaeb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
359 changed files with 3109 additions and 3222 deletions

View file

@ -1,6 +1,5 @@
<?php
abstract class ProtocolInfo{
const CURRENT_PROTOCOL = 14;

View file

@ -10,18 +10,18 @@ class AddEntityPacket extends RakNetDataPacket{
public $speedX;
public $speedY;
public $speedZ;
public function pid(){
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
return ProtocolInfo4::ADD_ENTITY_PACKET;
}
return ProtocolInfo::ADD_ENTITY_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);
@ -31,9 +31,9 @@ class AddEntityPacket extends RakNetDataPacket{
$this->putFloat($this->z);
$this->putInt($this->did);
if($this->did > 0){
$this->putShort((int)($this->speedX * 8000));
$this->putShort((int)($this->speedY * 8000));
$this->putShort((int)($this->speedZ * 8000));
$this->putShort((int) ($this->speedX * 8000));
$this->putShort((int) ($this->speedY * 8000));
$this->putShort((int) ($this->speedZ * 8000));
}
}

View file

@ -9,18 +9,18 @@ class AddItemEntityPacket extends RakNetDataPacket{
public $yaw;
public $pitch;
public $roll;
public function pid(){
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
return ProtocolInfo4::ADD_ITEM_ENTITY_PACKET;
}
return ProtocolInfo::ADD_ITEM_ENTITY_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -9,15 +9,15 @@ class AddMobPacket extends RakNetDataPacket{
public $pitch;
public $yaw;
public $metadata;
public function pid(){
return ProtocolInfo::ADD_MOB_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -7,18 +7,18 @@ class AddPaintingPacket extends RakNetDataPacket{
public $z;
public $direction;
public $title;
public function pid(){
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::ADD_PAINTING_PACKET;
}
return ProtocolInfo::ADD_PAINTING_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -23,15 +23,15 @@ class AddPlayerPacket extends RakNetDataPacket{
*@var array
*/
public $metadata;
public function pid(){
return ProtocolInfo::ADD_PLAYER_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putLong($this->clientID);

View file

@ -2,7 +2,7 @@
class AdventureSettingsPacket extends RakNetDataPacket{
public $flags;
public function pid(){
if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo7::ADVENTURE_SETTINGS_PACKET;
@ -13,11 +13,11 @@ class AdventureSettingsPacket extends RakNetDataPacket{
}
return ProtocolInfo::ADVENTURE_SETTINGS_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->flags);

View file

@ -3,10 +3,10 @@
class AnimatePacket extends RakNetDataPacket{
const ANIM_SWING_HAND = 0x1;
const ANIM_STOP_SLEEP = 0x3;
public $action;
public $eid;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::ANIMATE_PACKET;
@ -23,12 +23,12 @@ class AnimatePacket extends RakNetDataPacket{
}
return ProtocolInfo::ANIMATE_PACKET;
}
public function decode(){
$this->action = $this->getByte();
$this->eid = $this->getInt();
}
public function encode(){
$this->reset();
$this->putByte($this->action);

View file

@ -2,7 +2,7 @@
class ChatPacket extends RakNetDataPacket{
public $message;
public function pid(){
if($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
return ProtocolInfo5::CHAT_PACKET;
@ -15,11 +15,11 @@ class ChatPacket extends RakNetDataPacket{
}
return ProtocolInfo::CHAT_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putString($this->message);

View file

@ -4,7 +4,7 @@ class ChunkDataPacket extends RakNetDataPacket{
public $chunkX;
public $chunkZ;
public $data;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::CHUNK_DATA_PACKET;
@ -17,11 +17,11 @@ class ChunkDataPacket extends RakNetDataPacket{
}
return ProtocolInfo::CHUNK_DATA_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->chunkX);

View file

@ -8,13 +8,13 @@ class ClientConnectPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::CLIENT_CONNECT_PACKET;
}
public function decode(){
$this->clientID = $this->getLong();
$this->session = $this->getLong();
$this->unknown1 = $this->get(1);
}
}
public function encode(){
}

View file

@ -13,7 +13,7 @@ class ClientHandshakePacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::CLIENT_HANDSHAKE_PACKET;
}
public function decode(){
$this->cookie = $this->get(4);
$this->security = $this->get(1);
@ -23,10 +23,10 @@ class ClientHandshakePacket extends RakNetDataPacket{
$this->timestamp = $this->get(2);
$this->session2 = $this->getLong();
$this->session = $this->getLong();
}
}
public function encode(){
}
}

View file

@ -2,7 +2,7 @@
class ContainerClosePacket extends RakNetDataPacket{
public $windowid;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::CONTAINER_CLOSE_PACKET;
@ -19,11 +19,11 @@ class ContainerClosePacket extends RakNetDataPacket{
}
return ProtocolInfo::CONTAINER_CLOSE_PACKET;
}
public function decode(){
$this->windowid = $this->getByte();
}
public function encode(){
$this->reset();
$this->putByte($this->windowid);

View file

@ -7,7 +7,7 @@ class ContainerOpenPacket extends RakNetDataPacket{
public $x;
public $y;
public $z;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::CONTAINER_OPEN_PACKET;
@ -24,11 +24,11 @@ class ContainerOpenPacket extends RakNetDataPacket{
}
return ProtocolInfo::CONTAINER_OPEN_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putByte($this->windowid);

View file

@ -2,9 +2,9 @@
class ContainerSetContentPacket extends RakNetDataPacket{
public $windowid;
public $slots = array();
public $hotbar = array();
public $slots = [];
public $hotbar = [];
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::CONTAINER_SET_CONTENT_PACKET;
@ -21,7 +21,7 @@ class ContainerSetContentPacket extends RakNetDataPacket{
}
return ProtocolInfo::CONTAINER_SET_CONTENT_PACKET;
}
public function decode(){
$this->windowid = $this->getByte();
$count = $this->getShort();
@ -35,7 +35,7 @@ class ContainerSetContentPacket extends RakNetDataPacket{
}
}
}
public function encode(){
$this->reset();
$this->putByte($this->windowid);

View file

@ -4,7 +4,7 @@ class ContainerSetDataPacket extends RakNetDataPacket{
public $windowid;
public $property;
public $value;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::CONTAINER_SET_DATA_PACKET;
@ -21,11 +21,11 @@ class ContainerSetDataPacket extends RakNetDataPacket{
}
return ProtocolInfo::CONTAINER_SET_DATA_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putByte($this->windowid);

View file

@ -4,7 +4,7 @@ class ContainerSetSlotPacket extends RakNetDataPacket{
public $windowid;
public $slot;
public $item;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::CONTAINER_SET_SLOT_PACKET;
@ -21,13 +21,13 @@ class ContainerSetSlotPacket extends RakNetDataPacket{
}
return ProtocolInfo::CONTAINER_SET_SLOT_PACKET;
}
public function decode(){
$this->windowid = $this->getByte();
$this->slot = $this->getShort();
$this->item = $this->getSlot();
}
public function encode(){
$this->reset();
$this->putByte($this->windowid);

View file

@ -4,13 +4,13 @@ class DisconnectPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::DISCONNECT_PACKET;
}
public function decode(){
}
}
public function encode(){
$this->reset();
$this->reset();
}
}

View file

@ -4,7 +4,7 @@ class DropItemPacket extends RakNetDataPacket{
public $eid;
public $unknown;
public $item;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::DROP_ITEM_PACKET;
@ -21,13 +21,13 @@ class DropItemPacket extends RakNetDataPacket{
}
return ProtocolInfo::DROP_ITEM_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->unknown = $this->getByte();
$this->item = $this->getSlot();
}
public function encode(){
}

View file

@ -5,7 +5,7 @@ class EntityDataPacket extends RakNetDataPacket{
public $y;
public $z;
public $namedtag;
public function pid(){
if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo7::ENTITY_DATA_PACKET;
@ -16,14 +16,14 @@ class EntityDataPacket extends RakNetDataPacket{
}
return ProtocolInfo::ENTITY_DATA_PACKET;
}
public function decode(){
$this->x = $this->getShort();
$this->y = $this->getByte();
$this->z = $this->getShort();
$this->namedtag = $this->get(true);
}
public function encode(){
$this->reset();
$this->putShort($this->x);

View file

@ -3,16 +3,16 @@
class EntityEventPacket extends RakNetDataPacket{
public $eid;
public $event;
const ENTITY_DAMAGE = 2;
const ENTITY_DEAD = 3;
const ENTITY_ANIM_10 = 10;
public function __construct($eid = null, $event = null){
$this->eid = $eid;
$this->event = $event;
}
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::ENTITY_EVENT_PACKET;
@ -25,12 +25,12 @@ class EntityEventPacket extends RakNetDataPacket{
}
return ProtocolInfo::ENTITY_EVENT_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->event = $this->getByte();
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -6,7 +6,7 @@ class ExplodePacket extends RakNetDataPacket{
public $z;
public $radius;
public $records;
public function pid(){
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
return ProtocolInfo4::EXPLODE_PACKET;
@ -17,11 +17,11 @@ class ExplodePacket extends RakNetDataPacket{
}
return ProtocolInfo::EXPLODE_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putFloat($this->x);

View file

@ -2,18 +2,18 @@
class HurtArmorPacket extends RakNetDataPacket{
public $health;
public function pid(){
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::HURT_ARMOR_PACKET;
}
return ProtocolInfo::HURT_ARMOR_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putByte($this->health);

View file

@ -22,13 +22,13 @@ class InteractPacket extends RakNetDataPacket{
}
return ProtocolInfo::INTERACT_PACKET;
}
public function decode(){
$this->action = $this->getByte();
$this->eid = $this->getInt();
$this->target = $this->getInt();
}
public function encode(){
$this->reset();
$this->putByte($this->action);

View file

@ -1,16 +1,16 @@
<?php
class LevelEventPacket extends RakNetDataPacket{
const EVENT_OPEN_DOOR_SOUND = 1003;
const EVENT_ALL_PLAYERS_SLEEPING = 9800;
public $evid;
public $x;
public $y;
public $z;
public $data;
public function pid(){
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
return ProtocolInfo4::LEVEL_EVENT_PACKET;
@ -21,11 +21,11 @@ class LevelEventPacket extends RakNetDataPacket{
}
return ProtocolInfo::LEVEL_EVENT_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putShort($this->evid);

View file

@ -6,22 +6,22 @@ class LoginPacket extends RakNetDataPacket{
public $protocol2;
public $clientId;
public $loginData;
public function pid(){
return ProtocolInfo::LOGIN_PACKET;
}
public function decode(){
$this->username = $this->getString();
$this->protocol1 = $this->getInt();
$this->protocol2 = $this->getInt();
$this->clientId = $this->getInt();//null
$this->loginData = $this->getString();
$this->PROTOCOL = $this->protocol1;
$this->PROTOCOL = $this->protocol1;
}
public function encode(){
}
}

View file

@ -2,15 +2,15 @@
class LoginStatusPacket extends RakNetDataPacket{
public $status;
public function pid(){
return ProtocolInfo::LOGIN_STATUS_PACKET;
}
public function decode(){
}
}
public function encode(){
$this->reset();
$this->putInt($this->status);

View file

@ -3,18 +3,18 @@
class MessagePacket extends RakNetDataPacket{
public $source;
public $message;
public function pid(){
return ProtocolInfo::MESSAGE_PACKET;
}
public function decode(){
if($this->PROTOCOL > ProtocolInfo9::CURRENT_PROTOCOL_9){ //0.6.1 and below From NostalgiaCore-BackPort Author:Gameherobrine
$this->source = $this->getString();
}
$this->message = $this->getString();
}
}
public function encode(){
$this->reset();
if($this->PROTOCOL > ProtocolInfo9::CURRENT_PROTOCOL_9){ //0.6.1 and below From NostalgiaCore-BackPort Author:Gameherobrine

View file

@ -8,11 +8,11 @@ class MoveEntityPacket extends RakNetDataPacket{
}
return ProtocolInfo::MOVE_ENTITY_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
}

View file

@ -7,14 +7,14 @@ class MoveEntityPacket_PosRot extends RakNetDataPacket{
public $z;
public $yaw;
public $pitch;
public function pid(){
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
return ProtocolInfo4::MOVE_ENTITY_PACKET_POSROT;
}
return ProtocolInfo::MOVE_ENTITY_PACKET_POSROT;
}
public function decode(){
$this->get(7);
$this->eid = $this->getInt();
@ -24,7 +24,7 @@ class MoveEntityPacket_PosRot extends RakNetDataPacket{
$this->yaw = $this->getFloat();
$this->pitch = $this->getFloat();
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -8,7 +8,7 @@ class MovePlayerPacket extends RakNetDataPacket{
public $yaw;
public $pitch;
public $bodyYaw;
public function pid(){
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
return ProtocolInfo4::MOVE_PLAYER_PACKET;
@ -17,7 +17,7 @@ class MovePlayerPacket extends RakNetDataPacket{
}
return ProtocolInfo::MOVE_PLAYER_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->x = $this->getFloat();
@ -29,7 +29,7 @@ class MovePlayerPacket extends RakNetDataPacket{
$this->bodyYaw = $this->getFloat();
}
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -6,11 +6,11 @@ class PingPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::PING_PACKET;
}
public function decode(){
$this->time = $this->getLong();
}
}
public function encode(){
$this->reset();
$this->putLong($this->time);

View file

@ -7,7 +7,7 @@ class PlayerActionPacket extends RakNetDataPacket{
public $z;
public $face;
public $eid;
public function pid(){
if($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
return ProtocolInfo5::PLAYER_ACTION_PACKET;
@ -18,7 +18,7 @@ class PlayerActionPacket extends RakNetDataPacket{
}
return ProtocolInfo::PLAYER_ACTION_PACKET;
}
public function decode(){
$this->action = $this->getInt();
$this->x = $this->getInt();
@ -27,7 +27,7 @@ class PlayerActionPacket extends RakNetDataPacket{
$this->face = $this->getInt();
$this->eid = $this->getInt();
}
public function encode(){
}

View file

@ -2,23 +2,23 @@
class PlayerArmorEquipmentPacket extends RakNetDataPacket{
public $eid;
public $slots = array();
public $slots = [];
public function pid(){
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::PLAYER_ARMOR_EQUIPMENT_PACKET;
}
return ProtocolInfo::PLAYER_ARMOR_EQUIPMENT_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->eid = $this->getInt();
$this->slots[0] = $this->getByte();
$this->slots[1] = $this->getByte();
$this->slots[2] = $this->getByte();
$this->slots[3] = $this->getByte();
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -5,7 +5,7 @@ class PlayerEquipmentPacket extends RakNetDataPacket{
public $item;
public $meta;
public $slot;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::PLAYER_EQUIPMENT_PACKET;
@ -18,14 +18,14 @@ class PlayerEquipmentPacket extends RakNetDataPacket{
}
return ProtocolInfo::PLAYER_EQUIPMENT_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->item = $this->getShort();
$this->meta = $this->getShort();
if($this->PROTOCOL === ProtocolInfo::CURRENT_PROTOCOL){$this->slot = $this->getSignedByte();}
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -1,10 +1,10 @@
<?php
class PlayerInputPacket extends RakNetDataPacket{
public $moveStrafe, $moveForward, $isJumping, $isSneaking;
public function encode(){
}
public function pid(){
@ -23,6 +23,6 @@ class PlayerInputPacket extends RakNetDataPacket{
$this->isJumping = $this->getByte() != 0;
$this->isSneaking = $this->getByte() != 0;
}
}

View file

@ -7,12 +7,12 @@ class PongPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::PONG_PACKET;
}
public function decode(){
$this->ptime = $this->getLong();
$this->time = $this->getLong();
}
}
public function encode(){
$this->reset();
$this->putLong($this->ptime);

View file

@ -2,15 +2,15 @@
class ReadyPacket extends RakNetDataPacket{
public $status;
public function pid(){
return ProtocolInfo::READY_PACKET;
}
public function decode(){
$this->status = $this->getByte();
}
}
public function encode(){
}

View file

@ -5,7 +5,7 @@ class RemoveBlockPacket extends RakNetDataPacket{
public $x;
public $y;
public $z;
public function pid(){
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
return ProtocolInfo4::REMOVE_BLOCK_PACKET;
@ -14,14 +14,14 @@ class RemoveBlockPacket extends RakNetDataPacket{
}
return ProtocolInfo::REMOVE_BLOCK_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->x = $this->getInt();
$this->z = $this->getInt();
$this->y = $this->getByte();
}
public function encode(){
}

View file

@ -9,11 +9,11 @@ class RemoveEntityPacket extends RakNetDataPacket{
}
return ProtocolInfo::REMOVE_ENTITY_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -3,15 +3,15 @@
class RemovePlayerPacket extends RakNetDataPacket{
public $eid;
public $clientID;
public function pid(){
return ProtocolInfo::REMOVE_PLAYER_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -3,7 +3,7 @@
class RequestChunkPacket extends RakNetDataPacket{
public $chunkX;
public $chunkZ;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::REQUEST_CHUNK_PACKET;
@ -16,12 +16,12 @@ class RequestChunkPacket extends RakNetDataPacket{
}
return ProtocolInfo::REQUEST_CHUNK_PACKET;
}
public function decode(){
$this->chunkX = $this->getInt();
$this->chunkZ = $this->getInt();
}
public function encode(){
}

View file

@ -5,7 +5,7 @@ class RespawnPacket extends RakNetDataPacket{
public $x;
public $y;
public $z;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::RESPAWN_PACKET;
@ -22,14 +22,14 @@ class RespawnPacket extends RakNetDataPacket{
}
return ProtocolInfo::RESPAWN_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->x = $this->getFloat();
$this->y = $this->getFloat();
$this->z = $this->getFloat();
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -16,13 +16,13 @@ class RotateHeadPacket extends RakNetDataPacket{
}
return ProtocolInfo::ROTATE_HEAD_PACKET;
}
public function decode(){
$this->get(7); //id + data
$this->eid = $this->getInt();
$this->yaw = $this->getByte();
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -3,9 +3,9 @@
class SendInventoryPacket extends RakNetDataPacket{
public $eid;
public $windowid;
public $slots = array();
public $armor = array();
public $slots = [];
public $armor = [];
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::SEND_INVENTORY_PACKET;
@ -22,7 +22,7 @@ class SendInventoryPacket extends RakNetDataPacket{
}
return ProtocolInfo::SEND_INVENTORY_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->windowid = $this->getByte();
@ -36,7 +36,7 @@ class SendInventoryPacket extends RakNetDataPacket{
}
}
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -8,17 +8,17 @@ class ServerHandshakePacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::SERVER_HANDSHAKE_PACKET;
}
public function decode(){
}
}
public function encode(){
$this->reset();
$this->put("\x04\x3f\x57\xfe"); //cookie
$this->put("\xcd"); //Security flags
$this->putShort($this->port);
$this->putDataArray(array(
$this->putDataArray([
"\xf5\xff\xff\xf5",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
@ -29,7 +29,7 @@ class ServerHandshakePacket extends RakNetDataPacket{
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
));
]);
$this->put("\x00\x00");
$this->putLong($this->session);
$this->putLong($this->session2);

View file

@ -3,7 +3,7 @@
class SetEntityDataPacket extends RakNetDataPacket{
public $eid;
public $metadata;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::SET_ENTITY_DATA_PACKET;
@ -18,11 +18,11 @@ class SetEntityDataPacket extends RakNetDataPacket{
}
return ProtocolInfo::SET_ENTITY_DATA_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
if($this->PROTOCOL >= ProtocolInfo7::CURRENT_PROTOCOL_7)

View file

@ -21,7 +21,6 @@ class SetEntityLinkPacket extends RakNetDataPacket{
$this->putInt($this->type);
}
public function pid(){
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::SET_ENTITY_LINK_PACKET;

View file

@ -5,7 +5,7 @@ class SetEntityMotionPacket extends RakNetDataPacket{
public $speedX;
public $speedY;
public $speedZ;
public function pid(){
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
return ProtocolInfo4::SET_ENTITY_MOTION_PACKET;
@ -18,11 +18,11 @@ class SetEntityMotionPacket extends RakNetDataPacket{
}
return ProtocolInfo::SET_ENTITY_MOTION_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -2,7 +2,7 @@
class SetHealthPacket extends RakNetDataPacket{
public $health;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::SET_HEALTH_PACKET;
@ -19,11 +19,11 @@ class SetHealthPacket extends RakNetDataPacket{
}
return ProtocolInfo::SET_HEALTH_PACKET;
}
public function decode(){
$this->health = $this->getByte();
}
public function encode(){
$this->reset();
$this->putByte($this->health);

View file

@ -4,7 +4,7 @@ class SetSpawnPositionPacket extends RakNetDataPacket{
public $x;
public $z;
public $y;
public function pid(){
if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo7::SET_SPAWN_POSITION_PACKET;
@ -15,11 +15,11 @@ class SetSpawnPositionPacket extends RakNetDataPacket{
}
return ProtocolInfo::SET_SPAWN_POSITION_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->x);

View file

@ -3,15 +3,15 @@
class SetTimePacket extends RakNetDataPacket{
public $time;
public $started = true;
public function pid(){
return ProtocolInfo::SET_TIME_PACKET;
}
public function decode(){
}
}
public function encode(){
$this->reset();
$this->putInt($this->time);//long

View file

@ -8,15 +8,15 @@ class StartGamePacket extends RakNetDataPacket{
public $x;
public $y;
public $z;
public function pid(){
return ProtocolInfo::START_GAME_PACKET;
}
public function decode(){
}
}
public function encode(){
$this->reset();
$this->putInt($this->seed);//long

View file

@ -10,11 +10,11 @@ class TakeItemEntityPacket extends RakNetDataPacket{
}
return ProtocolInfo::TAKE_ITEM_ENTITY_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->target);

View file

@ -6,7 +6,7 @@ class TileEventPacket extends RakNetDataPacket{
public $z;
public $case1;
public $case2;
public function pid(){
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
return ProtocolInfo4::TILE_EVENT_PACKET;
@ -17,11 +17,11 @@ class TileEventPacket extends RakNetDataPacket{
}
return ProtocolInfo::TILE_EVENT_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->x);

View file

@ -2,19 +2,19 @@
class UnknownPacket extends RakNetDataPacket{
public $packetID = -1;
public function __construct($pid = -1){
$this->packetID = $pid;
}
public function pid(){
return $this->packetID;
}
public function decode(){
}
public function encode(){
}

View file

@ -6,7 +6,7 @@ class UpdateBlockPacket extends RakNetDataPacket{
public $y;
public $block;
public $meta;
public function pid(){
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
return ProtocolInfo4::UPDATE_BLOCK_PACKET;
@ -15,11 +15,11 @@ class UpdateBlockPacket extends RakNetDataPacket{
}
return ProtocolInfo::UPDATE_BLOCK_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->x);

View file

@ -14,7 +14,7 @@ class UseItemPacket extends RakNetDataPacket{
public $posX;
public $posY;
public $posZ;
public function pid(){
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
return ProtocolInfo3::USE_ITEM_PACKET;
@ -29,7 +29,7 @@ class UseItemPacket extends RakNetDataPacket{
}
return ProtocolInfo::USE_ITEM_PACKET;
}
public function decode(){
$this->x = $this->getInt();
$this->y = $this->getInt();
@ -47,7 +47,7 @@ class UseItemPacket extends RakNetDataPacket{
$this->posZ = $this->getFloat();
}
}
public function encode(){
}