mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 21:19:44 +00:00
commit
26cafcab00
57 changed files with 2659 additions and 1218 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
NostalgiaCore is a fork of Legacy PocketMine-MP 1.3.12, which fixes bugs of Legacy PocketMine-MP, and adds new content
|
NostalgiaCore is a fork of Legacy PocketMine-MP 1.3.12, which fixes bugs of Legacy PocketMine-MP, and adds new content
|
||||||
|
|
||||||
Supported MCPE versions: 0.8.0, 0.8.1 (maybe 0.8.2)
|
Supported MCPE versions: 0.7.4, 0.7.6, 0.8.0, 0.8.1 (maybe 0.8.2)
|
||||||
|
|
||||||
(Special thx to GullCraft Network and DartMiner43)
|
(Special thx to GullCraft Network and DartMiner43)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -641,4 +641,31 @@ class BlockAPI{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方块/物品id转换,防止新版本影响旧版本视觉效果
|
||||||
|
*/
|
||||||
|
public static function convertHighItemIdsToOldItemIds(int $protocolId, int $itemId) : int{
|
||||||
|
if ($protocolId >= ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
||||||
|
return $itemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
$idMap = [ //default for protocol < 12
|
||||||
|
LIT_PUMPKIN => MELON_BLOCK, //block
|
||||||
|
PUMPKIN_SEEDS => MELON_SEEDS, //item
|
||||||
|
PUMPKIN_PIE => BREAD, //item
|
||||||
|
BEETROOT => BREAD, //item
|
||||||
|
BEETROOT_SEEDS => SEEDS, //item
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($protocolId < ProtocolInfo9::CURRENT_PROTOCOL_9) {
|
||||||
|
$idMap += [
|
||||||
|
NETHERRACK => OBSIDIAN, //block
|
||||||
|
NETHER_BRICK => BRICK, //item
|
||||||
|
NETHER_QUARTZ => BRICK, //item
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $idMap[$itemId] ?? $itemId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,17 @@ class PlayerAPI{
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function decodeProtocol($ip){
|
||||||
|
foreach(ServerAPI::request()->clients as $p) {
|
||||||
|
if($p->ip == $ip){
|
||||||
|
return $p->PROTOCOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function add($CID){
|
public function add($CID){
|
||||||
if(isset($this->server->clients[$CID])){
|
if(isset($this->server->clients[$CID])){
|
||||||
$player = $this->server->clients[$CID];
|
$player = $this->server->clients[$CID];
|
||||||
|
|
|
||||||
2505
src/Player.php
2505
src/Player.php
File diff suppressed because it is too large
Load diff
|
|
@ -66,6 +66,7 @@ class PocketMinecraftServer{
|
||||||
$this->saveEnabled = true;
|
$this->saveEnabled = true;
|
||||||
$this->tickMeasure = array_fill(0, 40, 0);
|
$this->tickMeasure = array_fill(0, 40, 0);
|
||||||
$this->setType("normal");
|
$this->setType("normal");
|
||||||
|
PacketPool::init();
|
||||||
$this->interface = new MinecraftInterface("255.255.255.255", $this->port, $this->serverip);
|
$this->interface = new MinecraftInterface("255.255.255.255", $this->port, $this->serverip);
|
||||||
$this->stop = false;
|
$this->stop = false;
|
||||||
$this->ticks = 0;
|
$this->ticks = 0;
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class MinecraftInterface{
|
||||||
$pid = ord($buffer[0]);
|
$pid = ord($buffer[0]);
|
||||||
|
|
||||||
if(RakNetInfo::isValid($pid)){
|
if(RakNetInfo::isValid($pid)){
|
||||||
$parser = new RakNetParser($buffer);
|
$parser = new RakNetParser($buffer, $source);
|
||||||
if($parser->packet !== false){
|
if($parser->packet !== false){
|
||||||
$parser->packet->ip = $source;
|
$parser->packet->ip = $source;
|
||||||
$parser->packet->port = $port;
|
$parser->packet->port = $port;
|
||||||
|
|
|
||||||
118
src/network/PacketPool.php
Normal file
118
src/network/PacketPool.php
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class PacketPool{
|
||||||
|
|
||||||
|
public const ACCEPTED_PROTOCOLS = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
|
||||||
|
|
||||||
|
public static bool $isInit = false;
|
||||||
|
/** @var RakNetDataPacket[][] */
|
||||||
|
private static array $packetPool = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param class-string<RakNetDataPacket> $class
|
||||||
|
*/
|
||||||
|
private static function registerPacket(string $class, $protocols = self::ACCEPTED_PROTOCOLS): void{
|
||||||
|
/** @var RakNetDataPacket $pk */
|
||||||
|
$pk = new $class;
|
||||||
|
foreach ($protocols as $protocol) {
|
||||||
|
$pk->PROTOCOL = $protocol;
|
||||||
|
$pid = $pk->pid();
|
||||||
|
if(isset(self::$packetPool[$protocol][$pid])) {
|
||||||
|
$oldPk = self::$packetPool[$protocol][$pid];
|
||||||
|
console("[WARNING] 协议$protocol 中 PID:$pid (0x".dechex($pid).")包".get_class($oldPk)."与包".get_class($pk)."冲突");
|
||||||
|
}
|
||||||
|
self::$packetPool[$protocol][$pid] = clone $pk;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPacket($pid, $protocol) : RakNetDataPacket{
|
||||||
|
if(isset(self::$packetPool[$protocol][$pid])) {
|
||||||
|
return clone self::$packetPool[$protocol][$pid];
|
||||||
|
}
|
||||||
|
$pk = new UnknownPacket();
|
||||||
|
$pk->packetID = $pid;
|
||||||
|
$pk->PROTOCOL = $protocol;
|
||||||
|
return $pk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function init() : void{
|
||||||
|
if(self::$isInit){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self::registerPacket(AddEntityPacket::class);
|
||||||
|
self::registerPacket(AddItemEntityPacket::class);
|
||||||
|
self::registerPacket(AddMobPacket::class);
|
||||||
|
self::registerPacket(AddPaintingPacket::class, [7, 8, 9, 10, 11, 12, 13, 14]);
|
||||||
|
self::registerPacket(AddPlayerPacket::class);
|
||||||
|
self::registerPacket(AdventureSettingsPacket::class, [7, 8, 9, 10, 11, 12, 13, 14]);
|
||||||
|
self::registerPacket(AnimatePacket::class);
|
||||||
|
|
||||||
|
self::registerPacket(ChatPacket::class, [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
|
||||||
|
self::registerPacket(ChunkDataPacket::class);
|
||||||
|
self::registerPacket(ClientConnectPacket::class);
|
||||||
|
self::registerPacket(ClientHandshakePacket::class);
|
||||||
|
self::registerPacket(ContainerClosePacket::class);
|
||||||
|
self::registerPacket(ContainerOpenPacket::class);
|
||||||
|
self::registerPacket(ContainerSetContentPacket::class);
|
||||||
|
self::registerPacket(ContainerSetDataPacket::class);
|
||||||
|
self::registerPacket(ContainerSetSlotPacket::class);
|
||||||
|
self::registerPacket(ContainerAckPacket::class);
|
||||||
|
|
||||||
|
self::registerPacket(DisconnectPacket::class);
|
||||||
|
self::registerPacket(DropItemPacket::class);
|
||||||
|
|
||||||
|
self::registerPacket(EntityDataPacket::class, [7, 8, 9, 10, 11, 12, 13, 14]);
|
||||||
|
self::registerPacket(EntityEventPacket::class);
|
||||||
|
self::registerPacket(ExplodePacket::class);
|
||||||
|
|
||||||
|
self::registerPacket(HurtArmorPacket::class, [9, 10, 11, 12, 13, 14]);
|
||||||
|
|
||||||
|
self::registerPacket(InteractPacket::class);
|
||||||
|
|
||||||
|
self::registerPacket(LevelEventPacket::class);
|
||||||
|
self::registerPacket(LoginPacket::class);
|
||||||
|
self::registerPacket(LoginStatusPacket::class);
|
||||||
|
|
||||||
|
self::registerPacket(MessagePacket::class);
|
||||||
|
self::registerPacket(MoveEntityPacket::class);
|
||||||
|
self::registerPacket(MoveEntityPacket_PosRot::class);
|
||||||
|
self::registerPacket(MovePlayerPacket::class);
|
||||||
|
|
||||||
|
self::registerPacket(PingPacket::class);
|
||||||
|
self::registerPacket(PlaceBlockPacket::class);
|
||||||
|
self::registerPacket(PlayerActionPacket::class, [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
|
||||||
|
self::registerPacket(PlayerArmorEquipmentPacket::class, [9, 10, 11, 12, 13, 14]);
|
||||||
|
self::registerPacket(PlayerEquipmentPacket::class);
|
||||||
|
self::registerPacket(PlayerInputPacket::class, [7, 8, 9, 10, 11, 12, 13, 14]);
|
||||||
|
self::registerPacket(PongPacket::class);
|
||||||
|
|
||||||
|
self::registerPacket(ReadyPacket::class);
|
||||||
|
self::registerPacket(RemoveBlockPacket::class);
|
||||||
|
self::registerPacket(RemoveEntityPacket::class);
|
||||||
|
self::registerPacket(RemovePlayerPacket::class);
|
||||||
|
self::registerPacket(RequestChunkPacket::class);
|
||||||
|
self::registerPacket(RespawnPacket::class);
|
||||||
|
self::registerPacket(RotateHeadPacket::class);
|
||||||
|
|
||||||
|
self::registerPacket(SendInventoryPacket::class);
|
||||||
|
self::registerPacket(ServerHandshakePacket::class);
|
||||||
|
self::registerPacket(SetEntityDataPacket::class);
|
||||||
|
self::registerPacket(SetEntityLinkPacket::class, [12, 13, 14]);
|
||||||
|
self::registerPacket(SetEntityMotionPacket::class, [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
|
||||||
|
self::registerPacket(SetHealthPacket::class);
|
||||||
|
self::registerPacket(SetSpawnPositionPacket::class, [7, 8, 9, 10, 11, 12, 13, 14]);
|
||||||
|
self::registerPacket(SetTimePacket::class);
|
||||||
|
self::registerPacket(StartGamePacket::class);
|
||||||
|
|
||||||
|
self::registerPacket(TakeItemEntityPacket::class);
|
||||||
|
self::registerPacket(TileEventPacket::class, [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
|
||||||
|
|
||||||
|
self::registerPacket(UpdateBlockPacket::class);
|
||||||
|
self::registerPacket(UseItemPacket::class);
|
||||||
|
|
||||||
|
//self::registerPacket(UnknownPacket::class); //DO NOT REGISTER THIS
|
||||||
|
|
||||||
|
self::$isInit = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -33,7 +33,7 @@ abstract class ProtocolInfo{
|
||||||
const MOVE_ENTITY_PACKET_POSROT = 0x93;
|
const MOVE_ENTITY_PACKET_POSROT = 0x93;
|
||||||
const ROTATE_HEAD_PACKET = 0x94;
|
const ROTATE_HEAD_PACKET = 0x94;
|
||||||
const MOVE_PLAYER_PACKET = 0x95;
|
const MOVE_PLAYER_PACKET = 0x95;
|
||||||
//const PLACE_BLOCK_PACKET = 0x96;
|
const PLACE_BLOCK_PACKET = 0x96;
|
||||||
const REMOVE_BLOCK_PACKET = 0x97;
|
const REMOVE_BLOCK_PACKET = 0x97;
|
||||||
const UPDATE_BLOCK_PACKET = 0x98;
|
const UPDATE_BLOCK_PACKET = 0x98;
|
||||||
const ADD_PAINTING_PACKET = 0x99;
|
const ADD_PAINTING_PACKET = 0x99;
|
||||||
|
|
@ -64,7 +64,7 @@ abstract class ProtocolInfo{
|
||||||
const CONTAINER_SET_SLOT_PACKET = 0xb2;
|
const CONTAINER_SET_SLOT_PACKET = 0xb2;
|
||||||
const CONTAINER_SET_DATA_PACKET = 0xb3;
|
const CONTAINER_SET_DATA_PACKET = 0xb3;
|
||||||
const CONTAINER_SET_CONTENT_PACKET = 0xb4;
|
const CONTAINER_SET_CONTENT_PACKET = 0xb4;
|
||||||
//const CONTAINER_ACK_PACKET = 0xb5;
|
const CONTAINER_ACK_PACKET = 0xb5;
|
||||||
const CHAT_PACKET = 0xb6;
|
const CHAT_PACKET = 0xb6;
|
||||||
const ADVENTURE_SETTINGS_PACKET = 0xb7;
|
const ADVENTURE_SETTINGS_PACKET = 0xb7;
|
||||||
const ENTITY_DATA_PACKET = 0xb8;
|
const ENTITY_DATA_PACKET = 0xb8;
|
||||||
|
|
@ -72,11 +72,418 @@ abstract class ProtocolInfo{
|
||||||
|
|
||||||
}
|
}
|
||||||
/*Unused:
|
/*Unused:
|
||||||
* 0xb5
|
|
||||||
* 0x96
|
* 0x96
|
||||||
* 0x17
|
* 0x17
|
||||||
* 0x14
|
* 0x14
|
||||||
*/
|
*/
|
||||||
|
abstract class ProtocolInfo12{
|
||||||
|
|
||||||
|
const CURRENT_PROTOCOL_12 = 12;
|
||||||
|
|
||||||
|
const PING_PACKET = 0x00;
|
||||||
|
|
||||||
|
const PONG_PACKET = 0x03;
|
||||||
|
|
||||||
|
const CLIENT_CONNECT_PACKET = 0x09;
|
||||||
|
const SERVER_HANDSHAKE_PACKET = 0x10;
|
||||||
|
|
||||||
|
const CLIENT_HANDSHAKE_PACKET = 0x13;
|
||||||
|
//const SERVER_FULL_PACKET = 0x14;
|
||||||
|
const DISCONNECT_PACKET = 0x15;
|
||||||
|
const LOGIN_PACKET = 0x82;
|
||||||
|
const LOGIN_STATUS_PACKET = 0x83;
|
||||||
|
const READY_PACKET = 0x84;
|
||||||
|
const MESSAGE_PACKET = 0x85;
|
||||||
|
const SET_TIME_PACKET = 0x86;
|
||||||
|
const START_GAME_PACKET = 0x87;
|
||||||
|
const ADD_MOB_PACKET = 0x88;
|
||||||
|
const ADD_PLAYER_PACKET = 0x89;
|
||||||
|
const REMOVE_PLAYER_PACKET = 0x8a;
|
||||||
|
|
||||||
|
const ADD_ENTITY_PACKET = 0x8c;
|
||||||
|
const REMOVE_ENTITY_PACKET = 0x8d;
|
||||||
|
const ADD_ITEM_ENTITY_PACKET = 0x8e;
|
||||||
|
const TAKE_ITEM_ENTITY_PACKET = 0x8f;
|
||||||
|
const MOVE_ENTITY_PACKET = 0x90;
|
||||||
|
|
||||||
|
const MOVE_ENTITY_PACKET_POSROT = 0x93;
|
||||||
|
const ROTATE_HEAD_PACKET = 0xff;
|
||||||
|
const MOVE_PLAYER_PACKET = 0x94;
|
||||||
|
const PLACE_BLOCK_PACKET = 0x95;
|
||||||
|
const REMOVE_BLOCK_PACKET = 0x96;
|
||||||
|
const UPDATE_BLOCK_PACKET = 0x97;
|
||||||
|
const ADD_PAINTING_PACKET = 0x98;
|
||||||
|
const EXPLODE_PACKET = 0x99;
|
||||||
|
const LEVEL_EVENT_PACKET = 0x9a;
|
||||||
|
const TILE_EVENT_PACKET = 0x9b;
|
||||||
|
const ENTITY_EVENT_PACKET = 0x9c;
|
||||||
|
const REQUEST_CHUNK_PACKET = 0x9d;
|
||||||
|
const CHUNK_DATA_PACKET = 0x9e;
|
||||||
|
const PLAYER_EQUIPMENT_PACKET = 0x9f;
|
||||||
|
const PLAYER_ARMOR_EQUIPMENT_PACKET = 0xa0;
|
||||||
|
const INTERACT_PACKET = 0xa1;
|
||||||
|
const USE_ITEM_PACKET = 0xa2;
|
||||||
|
const PLAYER_ACTION_PACKET = 0xa3;
|
||||||
|
|
||||||
|
const HURT_ARMOR_PACKET = 0xa5;
|
||||||
|
const SET_ENTITY_DATA_PACKET = 0xa6;
|
||||||
|
const SET_ENTITY_MOTION_PACKET = 0xa7;
|
||||||
|
const SET_ENTITY_LINK_PACKET = 0xa8;
|
||||||
|
const SET_HEALTH_PACKET = 0xa9;
|
||||||
|
const SET_SPAWN_POSITION_PACKET = 0xaa;
|
||||||
|
const ANIMATE_PACKET = 0xab;
|
||||||
|
const RESPAWN_PACKET = 0xac;
|
||||||
|
const SEND_INVENTORY_PACKET = 0xad;
|
||||||
|
const DROP_ITEM_PACKET = 0xae;
|
||||||
|
const CONTAINER_OPEN_PACKET = 0xaf;
|
||||||
|
const CONTAINER_CLOSE_PACKET = 0xb0;
|
||||||
|
const CONTAINER_SET_SLOT_PACKET = 0xb1;
|
||||||
|
const CONTAINER_SET_DATA_PACKET = 0xb2;
|
||||||
|
const CONTAINER_SET_CONTENT_PACKET = 0xb3;
|
||||||
|
const CONTAINER_ACK_PACKET = 0xb4;
|
||||||
|
const CHAT_PACKET = 0xb5;
|
||||||
|
const ADVENTURE_SETTINGS_PACKET = 0xb6;
|
||||||
|
const ENTITY_DATA_PACKET = 0xb7;
|
||||||
|
const PLAYER_INPUT_PACKET = 0xb9;
|
||||||
|
}
|
||||||
|
abstract class ProtocolInfo9{
|
||||||
|
|
||||||
|
const CURRENT_PROTOCOL_9 = 9;
|
||||||
|
|
||||||
|
const PING_PACKET = 0x00;
|
||||||
|
|
||||||
|
const PONG_PACKET = 0x03;
|
||||||
|
|
||||||
|
const CLIENT_CONNECT_PACKET = 0x09;
|
||||||
|
const SERVER_HANDSHAKE_PACKET = 0x10;
|
||||||
|
|
||||||
|
const CLIENT_HANDSHAKE_PACKET = 0x13;
|
||||||
|
//const SERVER_FULL_PACKET = 0x14;
|
||||||
|
const DISCONNECT_PACKET = 0x15;
|
||||||
|
const LOGIN_PACKET = 0x82;
|
||||||
|
const LOGIN_STATUS_PACKET = 0x83;
|
||||||
|
const READY_PACKET = 0x84;
|
||||||
|
const MESSAGE_PACKET = 0x85;
|
||||||
|
const SET_TIME_PACKET = 0x86;
|
||||||
|
const START_GAME_PACKET = 0x87;
|
||||||
|
const ADD_MOB_PACKET = 0x88;
|
||||||
|
const ADD_PLAYER_PACKET = 0x89;
|
||||||
|
const REMOVE_PLAYER_PACKET = 0x8a;
|
||||||
|
|
||||||
|
const ADD_ENTITY_PACKET = 0x8c;
|
||||||
|
const REMOVE_ENTITY_PACKET = 0x8d;
|
||||||
|
const ADD_ITEM_ENTITY_PACKET = 0x8e;
|
||||||
|
const TAKE_ITEM_ENTITY_PACKET = 0x8f;
|
||||||
|
const MOVE_ENTITY_PACKET = 0x90;
|
||||||
|
|
||||||
|
const MOVE_ENTITY_PACKET_POSROT = 0x93;
|
||||||
|
const MOVE_PLAYER_PACKET = 0x94;
|
||||||
|
const PLACE_BLOCK_PACKET = 0x95;
|
||||||
|
const REMOVE_BLOCK_PACKET = 0x96;
|
||||||
|
const UPDATE_BLOCK_PACKET = 0x97;
|
||||||
|
const ADD_PAINTING_PACKET = 0x98;
|
||||||
|
const EXPLODE_PACKET = 0x99;
|
||||||
|
const LEVEL_EVENT_PACKET = 0x9a;
|
||||||
|
const TILE_EVENT_PACKET = 0x9b;
|
||||||
|
const ENTITY_EVENT_PACKET = 0x9c;
|
||||||
|
const REQUEST_CHUNK_PACKET = 0x9d;
|
||||||
|
const CHUNK_DATA_PACKET = 0x9e;
|
||||||
|
const PLAYER_EQUIPMENT_PACKET = 0x9f;
|
||||||
|
const PLAYER_ARMOR_EQUIPMENT_PACKET = 0xa0;
|
||||||
|
const INTERACT_PACKET = 0xa1;
|
||||||
|
const USE_ITEM_PACKET = 0xa2;
|
||||||
|
const PLAYER_ACTION_PACKET = 0xa3;
|
||||||
|
|
||||||
|
const HURT_ARMOR_PACKET = 0xa5;
|
||||||
|
const SET_ENTITY_DATA_PACKET = 0xa6;
|
||||||
|
const SET_ENTITY_MOTION_PACKET = 0xa7;
|
||||||
|
//const SET_ENTITY_LINK_PACKET = 0xa?;// Change
|
||||||
|
const SET_HEALTH_PACKET = 0xa8;// Change
|
||||||
|
const SET_SPAWN_POSITION_PACKET = 0xa9;
|
||||||
|
const ANIMATE_PACKET = 0xaa;
|
||||||
|
const RESPAWN_PACKET = 0xab;
|
||||||
|
const SEND_INVENTORY_PACKET = 0xac;
|
||||||
|
const DROP_ITEM_PACKET = 0xad;
|
||||||
|
const CONTAINER_OPEN_PACKET = 0xae;
|
||||||
|
const CONTAINER_CLOSE_PACKET = 0xaf;
|
||||||
|
const CONTAINER_SET_SLOT_PACKET = 0xb0;
|
||||||
|
const CONTAINER_SET_DATA_PACKET = 0xb1;
|
||||||
|
const CONTAINER_SET_CONTENT_PACKET = 0xb2;
|
||||||
|
const CONTAINER_ACK_PACKET = 0xb3;
|
||||||
|
const CHAT_PACKET = 0xb4;//12 change
|
||||||
|
const ADVENTURE_SETTINGS_PACKET = 0xb6;
|
||||||
|
const ENTITY_DATA_PACKET = 0xb7;
|
||||||
|
const PLAYER_INPUT_PACKET = 0xb9;
|
||||||
|
|
||||||
|
}
|
||||||
|
abstract class ProtocolInfo7{
|
||||||
|
|
||||||
|
const CURRENT_PROTOCOL_7 = 7;
|
||||||
|
|
||||||
|
const PING_PACKET = 0x00;
|
||||||
|
|
||||||
|
const PONG_PACKET = 0x03;
|
||||||
|
|
||||||
|
const CLIENT_CONNECT_PACKET = 0x09;
|
||||||
|
const SERVER_HANDSHAKE_PACKET = 0x10;
|
||||||
|
|
||||||
|
const CLIENT_HANDSHAKE_PACKET = 0x13;
|
||||||
|
//const SERVER_FULL_PACKET = 0x14;
|
||||||
|
const DISCONNECT_PACKET = 0x15;
|
||||||
|
const LOGIN_PACKET = 0x82;
|
||||||
|
const LOGIN_STATUS_PACKET = 0x83;
|
||||||
|
const READY_PACKET = 0x84;
|
||||||
|
const MESSAGE_PACKET = 0x85;
|
||||||
|
const SET_TIME_PACKET = 0x86;
|
||||||
|
const START_GAME_PACKET = 0x87;
|
||||||
|
const ADD_MOB_PACKET = 0x88;
|
||||||
|
const ADD_PLAYER_PACKET = 0x89;
|
||||||
|
const REMOVE_PLAYER_PACKET = 0x8a;//Maybe Exist
|
||||||
|
|
||||||
|
const ADD_ENTITY_PACKET = 0x8c;
|
||||||
|
const REMOVE_ENTITY_PACKET = 0x8d;
|
||||||
|
const ADD_ITEM_ENTITY_PACKET = 0x8e;
|
||||||
|
const TAKE_ITEM_ENTITY_PACKET = 0x8f;
|
||||||
|
const MOVE_ENTITY_PACKET = 0x90;
|
||||||
|
|
||||||
|
const MOVE_ENTITY_PACKET_POSROT = 0x93;
|
||||||
|
const MOVE_PLAYER_PACKET = 0x94;
|
||||||
|
const PLACE_BLOCK_PACKET = 0x95;
|
||||||
|
const REMOVE_BLOCK_PACKET = 0x96;
|
||||||
|
const UPDATE_BLOCK_PACKET = 0x97;
|
||||||
|
const ADD_PAINTING_PACKET = 0x98;// Maybe exist
|
||||||
|
const EXPLODE_PACKET = 0x99;
|
||||||
|
const LEVEL_EVENT_PACKET = 0x9a;
|
||||||
|
const TILE_EVENT_PACKET = 0x9b;//Maybe exist
|
||||||
|
const ENTITY_EVENT_PACKET = 0x9c;
|
||||||
|
const REQUEST_CHUNK_PACKET = 0x9d;
|
||||||
|
const CHUNK_DATA_PACKET = 0x9e;
|
||||||
|
const PLAYER_EQUIPMENT_PACKET = 0x9f;
|
||||||
|
// const PLAYER_ARMOR_EQUIPMENT_PACKET = 0xa0;
|
||||||
|
const INTERACT_PACKET = 0xa0;//Change
|
||||||
|
const USE_ITEM_PACKET = 0xa1;
|
||||||
|
const PLAYER_ACTION_PACKET = 0xa2;
|
||||||
|
const SET_ENTITY_DATA_PACKET = 0xa3;
|
||||||
|
const SET_ENTITY_MOTION_PACKET = 0xa4;
|
||||||
|
//const SET_ENTITY_LINK_PACKET = 0xa?;
|
||||||
|
const SET_HEALTH_PACKET = 0xa5;
|
||||||
|
const SET_SPAWN_POSITION_PACKET = 0xa6;
|
||||||
|
const ANIMATE_PACKET = 0xa7;
|
||||||
|
const RESPAWN_PACKET = 0xa8;
|
||||||
|
const SEND_INVENTORY_PACKET = 0xa9;//Maybe exist
|
||||||
|
const DROP_ITEM_PACKET = 0xaa;
|
||||||
|
const CONTAINER_OPEN_PACKET = 0xab;
|
||||||
|
const CONTAINER_CLOSE_PACKET = 0xac;
|
||||||
|
const CONTAINER_SET_SLOT_PACKET = 0xad;
|
||||||
|
const CONTAINER_SET_DATA_PACKET = 0xae;
|
||||||
|
const CONTAINER_SET_CONTENT_PACKET = 0xaf;
|
||||||
|
const CONTAINER_ACK_PACKET = 0xb;
|
||||||
|
const CHAT_PACKET = 0xb1;//12 change
|
||||||
|
const ADVENTURE_SETTINGS_PACKET = 0xb3;
|
||||||
|
const ENTITY_DATA_PACKET = 0xb2;
|
||||||
|
const PLAYER_INPUT_PACKET = 0xb9;
|
||||||
|
}
|
||||||
|
abstract class ProtocolInfo5{
|
||||||
|
|
||||||
|
const CURRENT_PROTOCOL_5 = 5;
|
||||||
|
|
||||||
|
const PING_PACKET = 0x00;
|
||||||
|
|
||||||
|
const PONG_PACKET = 0x03;
|
||||||
|
|
||||||
|
const CLIENT_CONNECT_PACKET = 0x09;
|
||||||
|
const SERVER_HANDSHAKE_PACKET = 0x10;
|
||||||
|
|
||||||
|
const CLIENT_HANDSHAKE_PACKET = 0x13;
|
||||||
|
//const SERVER_FULL_PACKET = 0x14;
|
||||||
|
const DISCONNECT_PACKET = 0x15;
|
||||||
|
const LOGIN_PACKET = 0x82;
|
||||||
|
const LOGIN_STATUS_PACKET = 0x83;
|
||||||
|
const READY_PACKET = 0x84;
|
||||||
|
const MESSAGE_PACKET = 0x85;
|
||||||
|
const SET_TIME_PACKET = 0x86;
|
||||||
|
const START_GAME_PACKET = 0x87;
|
||||||
|
const ADD_MOB_PACKET = 0x88;
|
||||||
|
const ADD_PLAYER_PACKET = 0x89;
|
||||||
|
const REMOVE_PLAYER_PACKET = 0x8a;//Maybe Exist
|
||||||
|
|
||||||
|
const ADD_ENTITY_PACKET = 0x8c;
|
||||||
|
const REMOVE_ENTITY_PACKET = 0x8d;
|
||||||
|
const ADD_ITEM_ENTITY_PACKET = 0x8e;
|
||||||
|
const TAKE_ITEM_ENTITY_PACKET = 0x8f;
|
||||||
|
const MOVE_ENTITY_PACKET = 0x90;
|
||||||
|
|
||||||
|
const MOVE_ENTITY_PACKET_POSROT = 0x93;
|
||||||
|
const MOVE_PLAYER_PACKET = 0x94;
|
||||||
|
const PLACE_BLOCK_PACKET = 0x95;
|
||||||
|
const REMOVE_BLOCK_PACKET = 0x96;
|
||||||
|
const UPDATE_BLOCK_PACKET = 0x97;
|
||||||
|
//const ADD_PAINTING_PACKET = 0x98;
|
||||||
|
const EXPLODE_PACKET = 0x98;// Change
|
||||||
|
const LEVEL_EVENT_PACKET = 0x99;
|
||||||
|
const TILE_EVENT_PACKET = 0x9a;
|
||||||
|
const ENTITY_EVENT_PACKET = 0x9b;
|
||||||
|
const REQUEST_CHUNK_PACKET = 0x9c;
|
||||||
|
const CHUNK_DATA_PACKET = 0x9d;
|
||||||
|
const PLAYER_EQUIPMENT_PACKET = 0x9e;
|
||||||
|
// const PLAYER_ARMOR_EQUIPMENT_PACKET = 0xa0;
|
||||||
|
const INTERACT_PACKET = 0x9f;
|
||||||
|
const USE_ITEM_PACKET = 0xa0;
|
||||||
|
const PLAYER_ACTION_PACKET = 0xa1;
|
||||||
|
const SET_ENTITY_DATA_PACKET = 0xa2;
|
||||||
|
const SET_ENTITY_MOTION_PACKET = 0xa3;
|
||||||
|
//const SET_ENTITY_LINK_PACKET = 0xa?;
|
||||||
|
const SET_HEALTH_PACKET = 0xa4;
|
||||||
|
//const SET_SPAWN_POSITION_PACKET = 0xa6;
|
||||||
|
const ANIMATE_PACKET = 0xa5;
|
||||||
|
const RESPAWN_PACKET = 0xa6;
|
||||||
|
const SEND_INVENTORY_PACKET = 0xa7;
|
||||||
|
const DROP_ITEM_PACKET = 0xa8;
|
||||||
|
const CONTAINER_OPEN_PACKET = 0xa9;
|
||||||
|
const CONTAINER_CLOSE_PACKET = 0xaa;
|
||||||
|
const CONTAINER_SET_SLOT_PACKET = 0xab;
|
||||||
|
const CONTAINER_SET_DATA_PACKET = 0xac;
|
||||||
|
const CONTAINER_SET_CONTENT_PACKET = 0xad;
|
||||||
|
const CONTAINER_ACK_PACKET = 0xae;
|
||||||
|
const CHAT_PACKET = 0xaf;
|
||||||
|
//const ADVENTURE_SETTINGS_PACKET = 0xb3;
|
||||||
|
//const ENTITY_DATA_PACKET = 0xb2;
|
||||||
|
//const PLAYER_INPUT_PACKET = 0xb9;
|
||||||
|
}
|
||||||
|
abstract class ProtocolInfo4{
|
||||||
|
|
||||||
|
const CURRENT_PROTOCOL_4 = 4;
|
||||||
|
|
||||||
|
const PING_PACKET = 0x00;
|
||||||
|
|
||||||
|
const PONG_PACKET = 0x03;
|
||||||
|
|
||||||
|
const CLIENT_CONNECT_PACKET = 0x09;
|
||||||
|
const SERVER_HANDSHAKE_PACKET = 0x10;
|
||||||
|
|
||||||
|
const CLIENT_HANDSHAKE_PACKET = 0x13;
|
||||||
|
//const SERVER_FULL_PACKET = 0x14;
|
||||||
|
const DISCONNECT_PACKET = 0x15;
|
||||||
|
const LOGIN_PACKET = 0x82;
|
||||||
|
const LOGIN_STATUS_PACKET = 0x83;
|
||||||
|
const READY_PACKET = 0x84;
|
||||||
|
const MESSAGE_PACKET = 0x85;
|
||||||
|
const SET_TIME_PACKET = 0x86;
|
||||||
|
const START_GAME_PACKET = 0x87;
|
||||||
|
const ADD_MOB_PACKET = 0x88;
|
||||||
|
const ADD_PLAYER_PACKET = 0x89;
|
||||||
|
const REMOVE_PLAYER_PACKET = 0x8a;
|
||||||
|
|
||||||
|
const ADD_ENTITY_PACKET = 0x8b; //Maybe exist // Change
|
||||||
|
const REMOVE_ENTITY_PACKET = 0x8c;
|
||||||
|
const ADD_ITEM_ENTITY_PACKET = 0x8d;
|
||||||
|
const TAKE_ITEM_ENTITY_PACKET = 0x8e;
|
||||||
|
const MOVE_ENTITY_PACKET = 0x8f;//unused ?
|
||||||
|
|
||||||
|
const MOVE_ENTITY_PACKET_POSROT = 0x92;
|
||||||
|
const MOVE_PLAYER_PACKET = 0x93;
|
||||||
|
const PLACE_BLOCK_PACKET = 0x94;
|
||||||
|
const REMOVE_BLOCK_PACKET = 0x95;//Maybe exist
|
||||||
|
const UPDATE_BLOCK_PACKET = 0x96;
|
||||||
|
//const ADD_PAINTING_PACKET = 0x98;
|
||||||
|
const EXPLODE_PACKET = 0x97;
|
||||||
|
const LEVEL_EVENT_PACKET = 0x98;
|
||||||
|
const TILE_EVENT_PACKET = 0x99;
|
||||||
|
const ENTITY_EVENT_PACKET = 0x9a;
|
||||||
|
const REQUEST_CHUNK_PACKET = 0x9b;
|
||||||
|
const CHUNK_DATA_PACKET = 0x9c;
|
||||||
|
const PLAYER_EQUIPMENT_PACKET = 0x9d;
|
||||||
|
// const PLAYER_ARMOR_EQUIPMENT_PACKET = 0xa0;
|
||||||
|
const INTERACT_PACKET = 0x9e;
|
||||||
|
const USE_ITEM_PACKET = 0x9f;
|
||||||
|
// const PLAYER_ACTION_PACKET = 0xa1;
|
||||||
|
const SET_ENTITY_DATA_PACKET = 0xa0;
|
||||||
|
const SET_ENTITY_MOTION_PACKET = 0xa1;
|
||||||
|
//const SET_ENTITY_LINK_PACKET = 0xa?;
|
||||||
|
const SET_HEALTH_PACKET = 0xa2;
|
||||||
|
//const SET_SPAWN_POSITION_PACKET = 0xa6;
|
||||||
|
const ANIMATE_PACKET = 0xa3;
|
||||||
|
const RESPAWN_PACKET = 0xa4;
|
||||||
|
const SEND_INVENTORY_PACKET = 0xa5;
|
||||||
|
const DROP_ITEM_PACKET = 0xa6;
|
||||||
|
const CONTAINER_OPEN_PACKET = 0xa7;
|
||||||
|
const CONTAINER_CLOSE_PACKET = 0xa8;
|
||||||
|
const CONTAINER_SET_SLOT_PACKET = 0xa9;
|
||||||
|
const CONTAINER_SET_DATA_PACKET = 0xaa;
|
||||||
|
const CONTAINER_SET_CONTENT_PACKET = 0xab;
|
||||||
|
const CONTAINER_ACK_PACKET = 0xac;
|
||||||
|
//const CHAT_PACKET = 0xaf;
|
||||||
|
//const ADVENTURE_SETTINGS_PACKET = 0xb3;
|
||||||
|
//const ENTITY_DATA_PACKET = 0xb2;
|
||||||
|
//const PLAYER_INPUT_PACKET = 0xb9;
|
||||||
|
}
|
||||||
|
abstract class ProtocolInfo3{
|
||||||
|
|
||||||
|
const CURRENT_PROTOCOL_3 = 3;
|
||||||
|
|
||||||
|
const PING_PACKET = 0x00;
|
||||||
|
|
||||||
|
const PONG_PACKET = 0x03;
|
||||||
|
|
||||||
|
const CLIENT_CONNECT_PACKET = 0x09;
|
||||||
|
const SERVER_HANDSHAKE_PACKET = 0x10;
|
||||||
|
|
||||||
|
const CLIENT_HANDSHAKE_PACKET = 0x13;
|
||||||
|
//const SERVER_FULL_PACKET = 0x14;
|
||||||
|
const DISCONNECT_PACKET = 0x15;
|
||||||
|
const LOGIN_PACKET = 0x82;
|
||||||
|
const LOGIN_STATUS_PACKET = 0x83;
|
||||||
|
const READY_PACKET = 0x84;
|
||||||
|
const MESSAGE_PACKET = 0x85;
|
||||||
|
const SET_TIME_PACKET = 0x86;
|
||||||
|
const START_GAME_PACKET = 0x87;
|
||||||
|
const ADD_MOB_PACKET = 0x88;
|
||||||
|
const ADD_PLAYER_PACKET = 0x89;
|
||||||
|
const REMOVE_PLAYER_PACKET = 0x8a;
|
||||||
|
|
||||||
|
const ADD_ENTITY_PACKET = 0x8b; //Maybe exist
|
||||||
|
const REMOVE_ENTITY_PACKET = 0x8c;
|
||||||
|
const ADD_ITEM_ENTITY_PACKET = 0x8d;
|
||||||
|
const TAKE_ITEM_ENTITY_PACKET = 0x8e;
|
||||||
|
const MOVE_ENTITY_PACKET = 0x8f;//unused ?
|
||||||
|
|
||||||
|
const MOVE_ENTITY_PACKET_POSROT = 0x92;
|
||||||
|
const MOVE_PLAYER_PACKET = 0x93;
|
||||||
|
const PLACE_BLOCK_PACKET = 0x94;
|
||||||
|
const REMOVE_BLOCK_PACKET = 0x95;
|
||||||
|
const UPDATE_BLOCK_PACKET = 0x96;
|
||||||
|
//const ADD_PAINTING_PACKET = 0x98;
|
||||||
|
const EXPLODE_PACKET = 0x97;
|
||||||
|
const LEVEL_EVENT_PACKET = 0x98;
|
||||||
|
//const TILE_EVENT_PACKET = 0x99;
|
||||||
|
const ENTITY_EVENT_PACKET = 0x99;//Change
|
||||||
|
const REQUEST_CHUNK_PACKET = 0x9a;
|
||||||
|
const CHUNK_DATA_PACKET = 0x9b;//Change
|
||||||
|
const PLAYER_EQUIPMENT_PACKET = 0x9c;
|
||||||
|
// const PLAYER_ARMOR_EQUIPMENT_PACKET = 0xa0;
|
||||||
|
const INTERACT_PACKET = 0x9d;
|
||||||
|
const USE_ITEM_PACKET = 0x9e;
|
||||||
|
// const PLAYER_ACTION_PACKET = 0xa1;
|
||||||
|
const SET_ENTITY_DATA_PACKET = 0x9f;
|
||||||
|
// const SET_ENTITY_MOTION_PACKET = 0xa1;
|
||||||
|
//const SET_ENTITY_LINK_PACKET = 0xa?;
|
||||||
|
const SET_HEALTH_PACKET = 0xa0;
|
||||||
|
//const SET_SPAWN_POSITION_PACKET = 0xa6;
|
||||||
|
const ANIMATE_PACKET = 0xa1;
|
||||||
|
const RESPAWN_PACKET = 0xa2;
|
||||||
|
const SEND_INVENTORY_PACKET = 0xa3;
|
||||||
|
const DROP_ITEM_PACKET = 0xa4;
|
||||||
|
const CONTAINER_OPEN_PACKET = 0xa7;
|
||||||
|
const CONTAINER_CLOSE_PACKET = 0xa8;
|
||||||
|
const CONTAINER_SET_SLOT_PACKET = 0xa9;
|
||||||
|
const CONTAINER_SET_DATA_PACKET = 0xaa;
|
||||||
|
const CONTAINER_SET_CONTENT_PACKET = 0xab;
|
||||||
|
const CONTAINER_ACK_PACKET = 0xac;
|
||||||
|
//const CHAT_PACKET = 0xaf;
|
||||||
|
//const ADVENTURE_SETTINGS_PACKET = 0xb3;
|
||||||
|
//const ENTITY_DATA_PACKET = 0xb2;
|
||||||
|
//const PLAYER_INPUT_PACKET = 0xb9;
|
||||||
|
}
|
||||||
/***REM_START***/
|
/***REM_START***/
|
||||||
require_once(FILE_PATH . "src/network/raknet/RakNetDataPacket.php");
|
require_once(FILE_PATH . "src/network/raknet/RakNetDataPacket.php");
|
||||||
/***REM_END***/
|
/***REM_END***/
|
||||||
|
|
@ -12,6 +12,9 @@ class AddEntityPacket extends RakNetDataPacket{
|
||||||
public $speedZ;
|
public $speedZ;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::ADD_ENTITY_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::ADD_ENTITY_PACKET;
|
return ProtocolInfo::ADD_ENTITY_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ class AddItemEntityPacket extends RakNetDataPacket{
|
||||||
public $roll;
|
public $roll;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::ADD_ITEM_ENTITY_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::ADD_ITEM_ENTITY_PACKET;
|
return ProtocolInfo::ADD_ITEM_ENTITY_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -21,7 +24,7 @@ class AddItemEntityPacket extends RakNetDataPacket{
|
||||||
public function encode(){
|
public function encode(){
|
||||||
$this->reset();
|
$this->reset();
|
||||||
$this->putInt($this->eid);
|
$this->putInt($this->eid);
|
||||||
$this->putSlot($this->item);
|
$this->putSlot($this->PROTOCOL, $this->item);
|
||||||
$this->putFloat($this->x);
|
$this->putFloat($this->x);
|
||||||
$this->putFloat($this->y);
|
$this->putFloat($this->y);
|
||||||
$this->putFloat($this->z);
|
$this->putFloat($this->z);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ class AddPaintingPacket extends RakNetDataPacket{
|
||||||
public $title;
|
public $title;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::ADD_PAINTING_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::ADD_PAINTING_PACKET;
|
return ProtocolInfo::ADD_PAINTING_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,13 @@ class AdventureSettingsPacket extends RakNetDataPacket{
|
||||||
public $flags;
|
public $flags;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::ADVENTURE_SETTINGS_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::ADVENTURE_SETTINGS_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::ADVENTURE_SETTINGS_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::ADVENTURE_SETTINGS_PACKET;
|
return ProtocolInfo::ADVENTURE_SETTINGS_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,19 @@ class AnimatePacket extends RakNetDataPacket{
|
||||||
public $eid;
|
public $eid;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::ANIMATE_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::ANIMATE_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::ANIMATE_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::ANIMATE_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::ANIMATE_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::ANIMATE_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::ANIMATE_PACKET;
|
return ProtocolInfo::ANIMATE_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,15 @@ class ChatPacket extends RakNetDataPacket{
|
||||||
public $message;
|
public $message;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::CHAT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::CHAT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::CHAT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::CHAT_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::CHAT_PACKET;
|
return ProtocolInfo::CHAT_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,15 @@ class ChunkDataPacket extends RakNetDataPacket{
|
||||||
public $data;
|
public $data;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::CHUNK_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::CHUNK_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::CHUNK_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::CHUNK_DATA_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::CHUNK_DATA_PACKET;
|
return ProtocolInfo::CHUNK_DATA_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
46
src/network/protocol/packet/ContainerAckPacket.php
Normal file
46
src/network/protocol/packet/ContainerAckPacket.php
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class ContainerAckPacket extends RakNetDataPacket{
|
||||||
|
public $unknwonubyte1;
|
||||||
|
public $unknownshort;
|
||||||
|
public $write1;
|
||||||
|
public $write0;
|
||||||
|
|
||||||
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::CONTAINER_ACK_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::CONTAINER_ACK_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::CONTAINER_ACK_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::CONTAINER_ACK_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::CONTAINER_ACK_PACKET;
|
||||||
|
}
|
||||||
|
return ProtocolInfo::CONTAINER_ACK_PACKET;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function decode(){
|
||||||
|
$this->unknwonubyte1 = $this->getByte();
|
||||||
|
$this->unknownshort = $this->getShort();
|
||||||
|
$this->write1 = $this->get();
|
||||||
|
$this->write0 = $this->get();
|
||||||
|
ConsoleAPI::debug($this->unknwonubyte1);
|
||||||
|
ConsoleAPI::debug($this->unknownshort);
|
||||||
|
ConsoleAPI::debug($this->write1);
|
||||||
|
ConsoleAPI::debug($this->write0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function encode(){
|
||||||
|
$this->putByte($this->unknwonubyte1);
|
||||||
|
$this->putShort($this->unknownshort);
|
||||||
|
$this->put($this->write1);
|
||||||
|
$this->put($this->write0);
|
||||||
|
ConsoleAPI::debug($this->unknwonubyte1);
|
||||||
|
ConsoleAPI::debug($this->unknownshort);
|
||||||
|
ConsoleAPI::debug($this->write1);
|
||||||
|
ConsoleAPI::debug($this->write0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,19 @@ class ContainerClosePacket extends RakNetDataPacket{
|
||||||
public $windowid;
|
public $windowid;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::CONTAINER_CLOSE_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::CONTAINER_CLOSE_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::CONTAINER_CLOSE_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::CONTAINER_CLOSE_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::CONTAINER_CLOSE_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::CONTAINER_CLOSE_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::CONTAINER_CLOSE_PACKET;
|
return ProtocolInfo::CONTAINER_CLOSE_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,19 @@ class ContainerOpenPacket extends RakNetDataPacket{
|
||||||
public $z;
|
public $z;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::CONTAINER_OPEN_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::CONTAINER_OPEN_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::CONTAINER_OPEN_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::CONTAINER_OPEN_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::CONTAINER_OPEN_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::CONTAINER_OPEN_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::CONTAINER_OPEN_PACKET;
|
return ProtocolInfo::CONTAINER_OPEN_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -21,7 +34,7 @@ class ContainerOpenPacket extends RakNetDataPacket{
|
||||||
$this->putByte($this->windowid);
|
$this->putByte($this->windowid);
|
||||||
$this->putByte($this->type);
|
$this->putByte($this->type);
|
||||||
$this->putByte($this->slots);
|
$this->putByte($this->slots);
|
||||||
$this->putInt($this->x);
|
$this->putInt($this->x);//String
|
||||||
$this->putInt($this->y);
|
$this->putInt($this->y);
|
||||||
$this->putInt($this->z);
|
$this->putInt($this->z);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,19 @@ class ContainerSetContentPacket extends RakNetDataPacket{
|
||||||
public $hotbar = [];
|
public $hotbar = [];
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::CONTAINER_SET_CONTENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::CONTAINER_SET_CONTENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::CONTAINER_SET_CONTENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::CONTAINER_SET_CONTENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::CONTAINER_SET_CONTENT_PACKET;
|
||||||
|
}else if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::CONTAINER_SET_CONTENT_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::CONTAINER_SET_CONTENT_PACKET;
|
return ProtocolInfo::CONTAINER_SET_CONTENT_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,10 +41,10 @@ class ContainerSetContentPacket extends RakNetDataPacket{
|
||||||
$this->putByte($this->windowid);
|
$this->putByte($this->windowid);
|
||||||
$this->putShort(count($this->slots));
|
$this->putShort(count($this->slots));
|
||||||
foreach($this->slots as $slot){
|
foreach($this->slots as $slot){
|
||||||
$this->putSlot($slot);
|
$this->putSlot($this->PROTOCOL, $slot);
|
||||||
}
|
}
|
||||||
if($this->windowid === 0 and count($this->hotbar) > 0){
|
if($this->windowid === 0 and count($this->hotbar) > 0){
|
||||||
$this->putShort(count($this->hotbar));
|
$this->putShort(count($this->hotbar));//null
|
||||||
foreach($this->hotbar as $slot){
|
foreach($this->hotbar as $slot){
|
||||||
$this->putInt($slot);
|
$this->putInt($slot);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,19 @@ class ContainerSetDataPacket extends RakNetDataPacket{
|
||||||
public $value;
|
public $value;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::CONTAINER_SET_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::CONTAINER_SET_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::CONTAINER_SET_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::CONTAINER_SET_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::CONTAINER_SET_DATA_PACKET;
|
||||||
|
}else if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::CONTAINER_SET_DATA_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::CONTAINER_SET_DATA_PACKET;
|
return ProtocolInfo::CONTAINER_SET_DATA_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,19 @@ class ContainerSetSlotPacket extends RakNetDataPacket{
|
||||||
public $item;
|
public $item;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::CONTAINER_SET_SLOT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::CONTAINER_SET_SLOT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::CONTAINER_SET_SLOT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::CONTAINER_SET_SLOT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::CONTAINER_SET_SLOT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::CONTAINER_SET_SLOT_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::CONTAINER_SET_SLOT_PACKET;
|
return ProtocolInfo::CONTAINER_SET_SLOT_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -19,7 +32,7 @@ class ContainerSetSlotPacket extends RakNetDataPacket{
|
||||||
$this->reset();
|
$this->reset();
|
||||||
$this->putByte($this->windowid);
|
$this->putByte($this->windowid);
|
||||||
$this->putShort($this->slot);
|
$this->putShort($this->slot);
|
||||||
$this->putSlot($this->item);
|
$this->putSlot($this->PROTOCOL, $this->item);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -6,6 +6,19 @@ class DropItemPacket extends RakNetDataPacket{
|
||||||
public $item;
|
public $item;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::DROP_ITEM_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::DROP_ITEM_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::DROP_ITEM_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::DROP_ITEM_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::DROP_ITEM_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::DROP_ITEM_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::DROP_ITEM_PACKET;
|
return ProtocolInfo::DROP_ITEM_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,13 @@ class EntityDataPacket extends RakNetDataPacket{
|
||||||
public $namedtag;
|
public $namedtag;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::ENTITY_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::ENTITY_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::ENTITY_DATA_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::ENTITY_DATA_PACKET;
|
return ProtocolInfo::ENTITY_DATA_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,15 @@ class EntityEventPacket extends RakNetDataPacket{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::ENTITY_EVENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::ENTITY_EVENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::ENTITY_EVENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::ENTITY_EVENT_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::ENTITY_EVENT_PACKET;
|
return ProtocolInfo::ENTITY_EVENT_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,13 @@ class ExplodePacket extends RakNetDataPacket{
|
||||||
public $records;
|
public $records;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::EXPLODE_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::EXPLODE_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::EXPLODE_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::EXPLODE_PACKET;
|
return ProtocolInfo::EXPLODE_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ class HurtArmorPacket extends RakNetDataPacket{
|
||||||
public $health;
|
public $health;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::HURT_ARMOR_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::HURT_ARMOR_PACKET;
|
return ProtocolInfo::HURT_ARMOR_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,17 @@ class InteractPacket extends RakNetDataPacket{
|
||||||
public $target;
|
public $target;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::INTERACT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::INTERACT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::INTERACT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::INTERACT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::INTERACT_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::INTERACT_PACKET;
|
return ProtocolInfo::INTERACT_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,13 @@ class LevelEventPacket extends RakNetDataPacket{
|
||||||
public $data;
|
public $data;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::LEVEL_EVENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::LEVEL_EVENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::LEVEL_EVENT_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::LEVEL_EVENT_PACKET;
|
return ProtocolInfo::LEVEL_EVENT_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,10 @@ class LoginPacket extends RakNetDataPacket{
|
||||||
$this->username = $this->getString();
|
$this->username = $this->getString();
|
||||||
$this->protocol1 = $this->getInt();
|
$this->protocol1 = $this->getInt();
|
||||||
$this->protocol2 = $this->getInt();
|
$this->protocol2 = $this->getInt();
|
||||||
$this->clientId = $this->getInt();
|
$this->clientId = $this->getInt();//null
|
||||||
$this->loginData = $this->getString();
|
$this->loginData = $this->getString();
|
||||||
}
|
$this->PROTOCOL = $this->protocol1;
|
||||||
|
}
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,17 @@ class MessagePacket extends RakNetDataPacket{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->source = $this->getString();
|
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();
|
$this->message = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
$this->reset();
|
$this->reset();
|
||||||
$this->putString($this->source);
|
if($this->PROTOCOL > ProtocolInfo9::CURRENT_PROTOCOL_9){ //0.6.1 and below From NostalgiaCore-BackPort Author:Gameherobrine
|
||||||
|
$this->putString($this->source);
|
||||||
|
}
|
||||||
$this->putString($this->message);
|
$this->putString($this->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
class MoveEntityPacket extends RakNetDataPacket{
|
class MoveEntityPacket extends RakNetDataPacket{
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::MOVE_ENTITY_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::MOVE_ENTITY_PACKET;
|
return ProtocolInfo::MOVE_ENTITY_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ class MoveEntityPacket_PosRot extends RakNetDataPacket{
|
||||||
public $pitch;
|
public $pitch;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::MOVE_ENTITY_PACKET_POSROT;
|
||||||
|
}
|
||||||
return ProtocolInfo::MOVE_ENTITY_PACKET_POSROT;
|
return ProtocolInfo::MOVE_ENTITY_PACKET_POSROT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,11 @@ class MovePlayerPacket extends RakNetDataPacket{
|
||||||
public $bodyYaw;
|
public $bodyYaw;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::MOVE_PLAYER_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::MOVE_PLAYER_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::MOVE_PLAYER_PACKET;
|
return ProtocolInfo::MOVE_PLAYER_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -20,7 +25,9 @@ class MovePlayerPacket extends RakNetDataPacket{
|
||||||
$this->z = $this->getFloat();
|
$this->z = $this->getFloat();
|
||||||
$this->yaw = $this->getFloat();
|
$this->yaw = $this->getFloat();
|
||||||
$this->pitch = $this->getFloat();
|
$this->pitch = $this->getFloat();
|
||||||
$this->bodyYaw = $this->getFloat();
|
if($this->PROTOCOL > 13){
|
||||||
|
$this->bodyYaw = $this->getFloat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
|
|
@ -31,7 +38,9 @@ class MovePlayerPacket extends RakNetDataPacket{
|
||||||
$this->putFloat($this->z);
|
$this->putFloat($this->z);
|
||||||
$this->putFloat($this->yaw);
|
$this->putFloat($this->yaw);
|
||||||
$this->putFloat($this->pitch);
|
$this->putFloat($this->pitch);
|
||||||
$this->putFloat($this->bodyYaw);
|
if($this->PROTOCOL > 13){
|
||||||
|
$this->putFloat($this->bodyYaw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
42
src/network/protocol/packet/PlaceBlockPacket.php
Normal file
42
src/network/protocol/packet/PlaceBlockPacket.php
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class PlaceBlockPacket extends RakNetDataPacket{
|
||||||
|
public $eid;
|
||||||
|
public $x;
|
||||||
|
public $z;
|
||||||
|
public $y;
|
||||||
|
public $block;
|
||||||
|
public $meta;
|
||||||
|
public $face;
|
||||||
|
|
||||||
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::PLACE_BLOCK_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL) {
|
||||||
|
return ProtocolInfo12::PLACE_BLOCK_PACKET;
|
||||||
|
}
|
||||||
|
return ProtocolInfo::PLACE_BLOCK_PACKET;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function decode(){
|
||||||
|
$this->eid = $this->getInt();
|
||||||
|
$this->x = $this->getInt();
|
||||||
|
$this->z = $this->getInt();
|
||||||
|
$this->y = $this->getByte();
|
||||||
|
$this->block = $this->getByte();
|
||||||
|
$this->meta = $this->getByte();
|
||||||
|
$this->face = $this->getByte();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function encode(){
|
||||||
|
$this->reset();
|
||||||
|
$this->putInt($this->eid);
|
||||||
|
$this->putInt($this->x);
|
||||||
|
$this->putInt($this->z);
|
||||||
|
$this->putByte($this->y);
|
||||||
|
$this->putByte(BlockAPI::convertHighItemIdsToOldItemIds($this->PROTOCOL, $this->block));
|
||||||
|
$this->putByte($this->meta);
|
||||||
|
$this->putByte($this->face);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -9,6 +9,13 @@ class PlayerActionPacket extends RakNetDataPacket{
|
||||||
public $eid;
|
public $eid;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::PLAYER_ACTION_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::PLAYER_ACTION_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::PLAYER_ACTION_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::PLAYER_ACTION_PACKET;
|
return ProtocolInfo::PLAYER_ACTION_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ class PlayerArmorEquipmentPacket extends RakNetDataPacket{
|
||||||
public $slots = [];
|
public $slots = [];
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::PLAYER_ARMOR_EQUIPMENT_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::PLAYER_ARMOR_EQUIPMENT_PACKET;
|
return ProtocolInfo::PLAYER_ARMOR_EQUIPMENT_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,15 @@ class PlayerEquipmentPacket extends RakNetDataPacket{
|
||||||
public $slot;
|
public $slot;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::PLAYER_EQUIPMENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::PLAYER_EQUIPMENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::PLAYER_EQUIPMENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::PLAYER_EQUIPMENT_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::PLAYER_EQUIPMENT_PACKET;
|
return ProtocolInfo::PLAYER_EQUIPMENT_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -14,15 +23,15 @@ class PlayerEquipmentPacket extends RakNetDataPacket{
|
||||||
$this->eid = $this->getInt();
|
$this->eid = $this->getInt();
|
||||||
$this->item = $this->getShort();
|
$this->item = $this->getShort();
|
||||||
$this->meta = $this->getShort();
|
$this->meta = $this->getShort();
|
||||||
$this->slot = $this->getSignedByte();
|
if($this->PROTOCOL === ProtocolInfo::CURRENT_PROTOCOL){$this->slot = $this->getSignedByte();}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
$this->reset();
|
$this->reset();
|
||||||
$this->putInt($this->eid);
|
$this->putInt($this->eid);
|
||||||
$this->putShort($this->item);
|
$this->putShort(BlockAPI::convertHighItemIdsToOldItemIds($this->PROTOCOL, $this->item));
|
||||||
$this->putShort($this->meta);
|
$this->putShort($this->meta);
|
||||||
$this->putByte($this->slot);
|
if($this->PROTOCOL === ProtocolInfo::CURRENT_PROTOCOL){$this->putByte($this->slot);}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class PlayerInputPacket extends RakNetDataPacket{
|
class PlayerInputPacket extends RakNetDataPacket{
|
||||||
public $moveStrafe, $moveForward, $isJumping, $isSneaking;
|
|
||||||
public function encode()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
public $moveStrafe, $moveForward, $isJumping, $isSneaking;
|
||||||
|
|
||||||
|
public function encode(){
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pid()
|
public function pid(){
|
||||||
{
|
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::PLAYER_INPUT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::PLAYER_INPUT_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::PLAYER_INPUT_PACKET;
|
return ProtocolInfo::PLAYER_INPUT_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,11 @@ class RemoveBlockPacket extends RakNetDataPacket{
|
||||||
public $z;
|
public $z;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::REMOVE_BLOCK_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::REMOVE_BLOCK_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::REMOVE_BLOCK_PACKET;
|
return ProtocolInfo::REMOVE_BLOCK_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ class RemoveEntityPacket extends RakNetDataPacket{
|
||||||
public $eid;
|
public $eid;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::REMOVE_ENTITY_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::REMOVE_ENTITY_PACKET;
|
return ProtocolInfo::REMOVE_ENTITY_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,15 @@ class RequestChunkPacket extends RakNetDataPacket{
|
||||||
public $chunkZ;
|
public $chunkZ;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::REQUEST_CHUNK_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::REQUEST_CHUNK_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::REQUEST_CHUNK_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::REQUEST_CHUNK_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::REQUEST_CHUNK_PACKET;
|
return ProtocolInfo::REQUEST_CHUNK_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,19 @@ class RespawnPacket extends RakNetDataPacket{
|
||||||
public $z;
|
public $z;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::RESPAWN_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::RESPAWN_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::RESPAWN_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::RESPAWN_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::RESPAWN_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::RESPAWN_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::RESPAWN_PACKET;
|
return ProtocolInfo::RESPAWN_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ class RotateHeadPacket extends RakNetDataPacket{
|
||||||
*/
|
*/
|
||||||
public $rawYaw = false;
|
public $rawYaw = false;
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::ROTATE_HEAD_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::ROTATE_HEAD_PACKET;
|
return ProtocolInfo::ROTATE_HEAD_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,19 @@ class SendInventoryPacket extends RakNetDataPacket{
|
||||||
public $armor = [];
|
public $armor = [];
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::SEND_INVENTORY_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::SEND_INVENTORY_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::SEND_INVENTORY_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::SEND_INVENTORY_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::SEND_INVENTORY_PACKET;
|
||||||
|
}else if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::SEND_INVENTORY_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::SEND_INVENTORY_PACKET;
|
return ProtocolInfo::SEND_INVENTORY_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -30,11 +43,11 @@ class SendInventoryPacket extends RakNetDataPacket{
|
||||||
$this->putByte($this->windowid);
|
$this->putByte($this->windowid);
|
||||||
$this->putShort(count($this->slots));
|
$this->putShort(count($this->slots));
|
||||||
foreach($this->slots as $slot){
|
foreach($this->slots as $slot){
|
||||||
$this->putSlot($slot);
|
$this->putSlot($this->PROTOCOL, $slot);
|
||||||
}
|
}
|
||||||
if($this->windowid === 1 and count($this->armor) === 4){
|
if($this->windowid === 1 and count($this->armor) === 4){
|
||||||
for($s = 0; $s < 4; ++$s){
|
for($s = 0; $s < 4; ++$s){
|
||||||
$this->putSlot($this->armor[$s]);
|
$this->putSlot($this->PROTOCOL, $this->armor[$s]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,17 @@ class SetEntityDataPacket extends RakNetDataPacket{
|
||||||
public $metadata;
|
public $metadata;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::SET_ENTITY_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::SET_ENTITY_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::SET_ENTITY_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::SET_ENTITY_DATA_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::SET_ENTITY_DATA_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::SET_ENTITY_DATA_PACKET;
|
return ProtocolInfo::SET_ENTITY_DATA_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -14,6 +25,7 @@ class SetEntityDataPacket extends RakNetDataPacket{
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
$this->reset();
|
$this->reset();
|
||||||
|
if($this->PROTOCOL >= ProtocolInfo7::CURRENT_PROTOCOL_7)
|
||||||
$this->putInt($this->eid);
|
$this->putInt($this->eid);
|
||||||
$this->put(Utils::writeMetadata($this->metadata));
|
$this->put(Utils::writeMetadata($this->metadata));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ class SetEntityLinkPacket extends RakNetDataPacket{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::SET_ENTITY_LINK_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::SET_ENTITY_LINK_PACKET;
|
return ProtocolInfo::SET_ENTITY_LINK_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,15 @@ class SetEntityMotionPacket extends RakNetDataPacket{
|
||||||
public $speedZ;
|
public $speedZ;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::SET_ENTITY_MOTION_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::SET_ENTITY_MOTION_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::SET_ENTITY_MOTION_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::SET_ENTITY_MOTION_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::SET_ENTITY_MOTION_PACKET;
|
return ProtocolInfo::SET_ENTITY_MOTION_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,19 @@ class SetHealthPacket extends RakNetDataPacket{
|
||||||
public $health;
|
public $health;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::SET_HEALTH_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::SET_HEALTH_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::SET_HEALTH_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::SET_HEALTH_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::SET_HEALTH_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::SET_HEALTH_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::SET_HEALTH_PACKET;
|
return ProtocolInfo::SET_HEALTH_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,13 @@ class SetSpawnPositionPacket extends RakNetDataPacket{
|
||||||
public $y;
|
public $y;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::SET_SPAWN_POSITION_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
return ProtocolInfo9::SET_SPAWN_POSITION_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::SET_SPAWN_POSITION_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::SET_SPAWN_POSITION_PACKET;
|
return ProtocolInfo::SET_SPAWN_POSITION_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class SetTimePacket extends RakNetDataPacket{
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
$this->reset();
|
$this->reset();
|
||||||
$this->putInt($this->time);
|
$this->putInt($this->time);//long
|
||||||
$this->putByte($this->started ? 0x80:0x00);
|
$this->putByte($this->started ? 0x80:0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class StartGamePacket extends RakNetDataPacket{
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
$this->reset();
|
$this->reset();
|
||||||
$this->putInt($this->seed);
|
$this->putInt($this->seed);//long
|
||||||
$this->putInt($this->generator);
|
$this->putInt($this->generator);
|
||||||
$this->putInt($this->gamemode);
|
$this->putInt($this->gamemode);
|
||||||
$this->putInt($this->eid);
|
$this->putInt($this->eid);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ class TakeItemEntityPacket extends RakNetDataPacket{
|
||||||
public $eid;
|
public $eid;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::TAKE_ITEM_ENTITY_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::TAKE_ITEM_ENTITY_PACKET;
|
return ProtocolInfo::TAKE_ITEM_ENTITY_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,13 @@ class TileEventPacket extends RakNetDataPacket{
|
||||||
public $case2;
|
public $case2;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::TILE_EVENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::TILE_EVENT_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::TILE_EVENT_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::TILE_EVENT_PACKET;
|
return ProtocolInfo::TILE_EVENT_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,11 @@ class UpdateBlockPacket extends RakNetDataPacket{
|
||||||
public $meta;
|
public $meta;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::UPDATE_BLOCK_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::UPDATE_BLOCK_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::UPDATE_BLOCK_PACKET;
|
return ProtocolInfo::UPDATE_BLOCK_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -20,7 +25,7 @@ class UpdateBlockPacket extends RakNetDataPacket{
|
||||||
$this->putInt($this->x);
|
$this->putInt($this->x);
|
||||||
$this->putInt($this->z);
|
$this->putInt($this->z);
|
||||||
$this->putByte($this->y);
|
$this->putByte($this->y);
|
||||||
$this->putByte($this->block);
|
$this->putByte(BlockAPI::convertHighItemIdsToOldItemIds($this->PROTOCOL, $this->block));
|
||||||
$this->putByte($this->meta);
|
$this->putByte($this->meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,17 @@ class UseItemPacket extends RakNetDataPacket{
|
||||||
public $posZ;
|
public $posZ;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||||
|
return ProtocolInfo3::USE_ITEM_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo5::CURRENT_PROTOCOL_5){
|
||||||
|
return ProtocolInfo4::USE_ITEM_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo7::CURRENT_PROTOCOL_7){
|
||||||
|
return ProtocolInfo5::USE_ITEM_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||||
|
return ProtocolInfo7::USE_ITEM_PACKET;
|
||||||
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
|
return ProtocolInfo12::USE_ITEM_PACKET;
|
||||||
|
}
|
||||||
return ProtocolInfo::USE_ITEM_PACKET;
|
return ProtocolInfo::USE_ITEM_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -30,9 +41,11 @@ class UseItemPacket extends RakNetDataPacket{
|
||||||
$this->fx = $this->getFloat();
|
$this->fx = $this->getFloat();
|
||||||
$this->fy = $this->getFloat();
|
$this->fy = $this->getFloat();
|
||||||
$this->fz = $this->getFloat();
|
$this->fz = $this->getFloat();
|
||||||
$this->posX = $this->getFloat();
|
if ($this->PROTOCOL > ProtocolInfo9::CURRENT_PROTOCOL_9) {
|
||||||
$this->posY = $this->getFloat();
|
$this->posX = $this->getFloat();
|
||||||
$this->posZ = $this->getFloat();
|
$this->posY = $this->getFloat();
|
||||||
|
$this->posZ = $this->getFloat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,11 @@ abstract class RakNetDataPacket extends stdClass{
|
||||||
public $splitCount;
|
public $splitCount;
|
||||||
public $splitID;
|
public $splitID;
|
||||||
public $splitIndex;
|
public $splitIndex;
|
||||||
|
|
||||||
private $offset = 0;
|
private $offset = 0;
|
||||||
|
|
||||||
|
public $PROTOCOL = ProtocolInfo::CURRENT_PROTOCOL;
|
||||||
|
|
||||||
abstract public function encode();
|
abstract public function encode();
|
||||||
|
|
||||||
abstract public function decode();
|
abstract public function decode();
|
||||||
|
|
@ -34,8 +37,22 @@ abstract class RakNetDataPacket extends stdClass{
|
||||||
$this->setBuffer(chr($this->pid()));
|
$this->setBuffer(chr($this->pid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isPacketExist(int $protocol) : int{
|
||||||
|
|
||||||
|
$exist = true;
|
||||||
|
return $exist;
|
||||||
|
}
|
||||||
|
|
||||||
abstract public function pid();
|
abstract public function pid();
|
||||||
|
|
||||||
|
public function getInternalPid() : int{
|
||||||
|
$rawProtocol = $this->PROTOCOL;
|
||||||
|
$this->PROTOCOL = ProtocolInfo::CURRENT_PROTOCOL;
|
||||||
|
$pid = (int) $this->pid();
|
||||||
|
$this->PROTOCOL = $rawProtocol;
|
||||||
|
return $pid;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getLong($unsigned = false){
|
protected function getLong($unsigned = false){
|
||||||
return Utils::readLong($this->get(8), $unsigned);
|
return Utils::readLong($this->get(8), $unsigned);
|
||||||
}
|
}
|
||||||
|
|
@ -133,8 +150,8 @@ abstract class RakNetDataPacket extends stdClass{
|
||||||
return ord($this->get(1));
|
return ord($this->get(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function putSlot(Item $item){
|
protected function putSlot(Int $protocolId, Item $item){
|
||||||
$this->putShort($item->getID());
|
$this->putShort(BlockAPI::convertHighItemIdsToOldItemIds($protocolId, $item->getID()));
|
||||||
$this->putByte($item->count);
|
$this->putByte($item->count);
|
||||||
$this->putShort($item->getMetadata());
|
$this->putShort($item->getMetadata());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,13 @@ class RakNetParser{
|
||||||
|
|
||||||
public $packet;
|
public $packet;
|
||||||
private $buffer;
|
private $buffer;
|
||||||
|
private $source;
|
||||||
private $offset;
|
private $offset;
|
||||||
|
private $isparse = false;
|
||||||
|
|
||||||
public function __construct(&$buffer){
|
public function __construct(&$buffer, $source){
|
||||||
$this->buffer = &$buffer;
|
$this->source =& $source;
|
||||||
|
$this->buffer =& $buffer;
|
||||||
$this->offset = 0;
|
$this->offset = 0;
|
||||||
if(strlen($this->buffer) > 0){
|
if(strlen($this->buffer) > 0){
|
||||||
$this->parse();
|
$this->parse();
|
||||||
|
|
@ -56,7 +59,10 @@ class RakNetParser{
|
||||||
case RakNetInfo::DATA_PACKET_F:
|
case RakNetInfo::DATA_PACKET_F:
|
||||||
$this->packet->seqNumber = $this->getLTriad();
|
$this->packet->seqNumber = $this->getLTriad();
|
||||||
$this->packet->data = [];
|
$this->packet->data = [];
|
||||||
while(!$this->feof() and ($pk = $this->parseDataPacket()) instanceof RakNetDataPacket){
|
$this->packet->ip = $this->source;
|
||||||
|
$PROTOCOL = PlayerAPI::decodeProtocol($this->packet->ip);
|
||||||
|
|
||||||
|
while(!$this->feof() and ($pk = $this->parseDataPacket($PROTOCOL)) instanceof RakNetDataPacket){
|
||||||
$this->packet->data[] = $pk;
|
$this->packet->data[] = $pk;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -117,7 +123,7 @@ class RakNetParser{
|
||||||
return !isset($this->buffer[$this->offset]);
|
return !isset($this->buffer[$this->offset]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function parseDataPacket(){
|
private function parseDataPacket($protocol = ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
$packetFlags = $this->getByte();
|
$packetFlags = $this->getByte();
|
||||||
$reliability = ($packetFlags & 0b11100000) >> 5;
|
$reliability = ($packetFlags & 0b11100000) >> 5;
|
||||||
$hasSplit = ($packetFlags & 0b00010000) > 0;
|
$hasSplit = ($packetFlags & 0b00010000) > 0;
|
||||||
|
|
@ -164,65 +170,7 @@ class RakNetParser{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = match($pid){
|
$data = PacketPool::getPacket($pid, $protocol);
|
||||||
ProtocolInfo::PING_PACKET => new PingPacket(),
|
|
||||||
ProtocolInfo::PONG_PACKET => new PongPacket(),
|
|
||||||
ProtocolInfo::CLIENT_CONNECT_PACKET => new ClientConnectPacket(),
|
|
||||||
ProtocolInfo::SERVER_HANDSHAKE_PACKET => new ServerHandshakePacket(),
|
|
||||||
ProtocolInfo::DISCONNECT_PACKET => new DisconnectPacket(),
|
|
||||||
ProtocolInfo::LOGIN_PACKET => new LoginPacket(),
|
|
||||||
ProtocolInfo::LOGIN_STATUS_PACKET => new LoginStatusPacket(),
|
|
||||||
ProtocolInfo::READY_PACKET => new ReadyPacket(),
|
|
||||||
ProtocolInfo::MESSAGE_PACKET => new MessagePacket(),
|
|
||||||
ProtocolInfo::SET_TIME_PACKET => new SetTimePacket(),
|
|
||||||
ProtocolInfo::START_GAME_PACKET => new StartGamePacket(),
|
|
||||||
ProtocolInfo::ADD_MOB_PACKET => new AddMobPacket(),
|
|
||||||
ProtocolInfo::ADD_PLAYER_PACKET => new AddPlayerPacket(),
|
|
||||||
ProtocolInfo::REMOVE_PLAYER_PACKET => new RemovePlayerPacket(),
|
|
||||||
ProtocolInfo::ADD_ENTITY_PACKET => new AddEntityPacket(),
|
|
||||||
ProtocolInfo::REMOVE_ENTITY_PACKET => new RemoveEntityPacket(),
|
|
||||||
ProtocolInfo::ADD_ITEM_ENTITY_PACKET => new AddItemEntityPacket(),
|
|
||||||
ProtocolInfo::TAKE_ITEM_ENTITY_PACKET => new TakeItemEntityPacket(),
|
|
||||||
ProtocolInfo::MOVE_ENTITY_PACKET => new MoveEntityPacket(),
|
|
||||||
ProtocolInfo::MOVE_ENTITY_PACKET_POSROT => new MoveEntityPacket_PosRot(),
|
|
||||||
ProtocolInfo::ROTATE_HEAD_PACKET => new RotateHeadPacket(),
|
|
||||||
ProtocolInfo::MOVE_PLAYER_PACKET => new MovePlayerPacket(),
|
|
||||||
ProtocolInfo::REMOVE_BLOCK_PACKET => new RemoveBlockPacket(),
|
|
||||||
ProtocolInfo::UPDATE_BLOCK_PACKET => new UpdateBlockPacket(),
|
|
||||||
ProtocolInfo::ADD_PAINTING_PACKET => new AddPaintingPacket(),
|
|
||||||
ProtocolInfo::EXPLODE_PACKET => new ExplodePacket(),
|
|
||||||
ProtocolInfo::LEVEL_EVENT_PACKET => new LevelEventPacket(),
|
|
||||||
ProtocolInfo::TILE_EVENT_PACKET => new TileEventPacket(),
|
|
||||||
ProtocolInfo::ENTITY_EVENT_PACKET => new EntityEventPacket(),
|
|
||||||
ProtocolInfo::REQUEST_CHUNK_PACKET => new RequestChunkPacket(),
|
|
||||||
ProtocolInfo::CHUNK_DATA_PACKET => new ChunkDataPacket(),
|
|
||||||
ProtocolInfo::PLAYER_EQUIPMENT_PACKET => new PlayerEquipmentPacket(),
|
|
||||||
ProtocolInfo::PLAYER_ARMOR_EQUIPMENT_PACKET => new PlayerArmorEquipmentPacket(),
|
|
||||||
ProtocolInfo::INTERACT_PACKET => new InteractPacket(),
|
|
||||||
ProtocolInfo::USE_ITEM_PACKET => new UseItemPacket(),
|
|
||||||
ProtocolInfo::PLAYER_ACTION_PACKET => new PlayerActionPacket(),
|
|
||||||
ProtocolInfo::HURT_ARMOR_PACKET => new HurtArmorPacket(),
|
|
||||||
ProtocolInfo::SET_ENTITY_DATA_PACKET => new SetEntityDataPacket(),
|
|
||||||
ProtocolInfo::SET_ENTITY_MOTION_PACKET => new SetEntityMotionPacket(),
|
|
||||||
ProtocolInfo::SET_HEALTH_PACKET => new SetHealthPacket(),
|
|
||||||
ProtocolInfo::SET_SPAWN_POSITION_PACKET => new SetSpawnPositionPacket(),
|
|
||||||
ProtocolInfo::ANIMATE_PACKET => new AnimatePacket(),
|
|
||||||
ProtocolInfo::RESPAWN_PACKET => new RespawnPacket(),
|
|
||||||
ProtocolInfo::SEND_INVENTORY_PACKET => new SendInventoryPacket(),
|
|
||||||
ProtocolInfo::DROP_ITEM_PACKET => new DropItemPacket(),
|
|
||||||
ProtocolInfo::CONTAINER_OPEN_PACKET => new ContainerOpenPacket(),
|
|
||||||
ProtocolInfo::CONTAINER_CLOSE_PACKET => new ContainerClosePacket(),
|
|
||||||
ProtocolInfo::CONTAINER_SET_SLOT_PACKET => new ContainerSetSlotPacket(),
|
|
||||||
ProtocolInfo::CONTAINER_SET_DATA_PACKET => new ContainerSetDataPacket(),
|
|
||||||
ProtocolInfo::CONTAINER_SET_CONTENT_PACKET => new ContainerSetContentPacket(),
|
|
||||||
ProtocolInfo::CHAT_PACKET => new ChatPacket(),
|
|
||||||
ProtocolInfo::ADVENTURE_SETTINGS_PACKET => new AdventureSettingsPacket(),
|
|
||||||
ProtocolInfo::ENTITY_DATA_PACKET => new EntityDataPacket(),
|
|
||||||
ProtocolInfo::SET_ENTITY_LINK_PACKET => new SetEntityLinkPacket(),
|
|
||||||
ProtocolInfo::PLAYER_INPUT_PACKET => new PlayerInputPacket(),
|
|
||||||
default => new UnknownPacket($pid)
|
|
||||||
};
|
|
||||||
|
|
||||||
$data->reliability = $reliability;
|
$data->reliability = $reliability;
|
||||||
$data->hasSplit = $hasSplit;
|
$data->hasSplit = $hasSplit;
|
||||||
$data->messageIndex = $messageIndex;
|
$data->messageIndex = $messageIndex;
|
||||||
|
|
@ -236,8 +184,237 @@ class RakNetParser{
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function parseDataPacket12(){
|
||||||
|
$packetFlags = $this->getByte();
|
||||||
|
$reliability = ($packetFlags & 0b11100000) >> 5;
|
||||||
|
$hasSplit = ($packetFlags & 0b00010000) > 0;
|
||||||
|
$length = (int) ceil($this->getShort() / 8);
|
||||||
|
if($reliability === 2
|
||||||
|
or $reliability === 3
|
||||||
|
or $reliability === 4
|
||||||
|
or $reliability === 6
|
||||||
|
or $reliability === 7){
|
||||||
|
$messageIndex = $this->getLTriad();
|
||||||
|
}else{
|
||||||
|
$messageIndex = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($reliability === 1
|
||||||
|
or $reliability === 3
|
||||||
|
or $reliability === 4
|
||||||
|
or $reliability === 7){
|
||||||
|
$orderIndex = $this->getLTriad();
|
||||||
|
$orderChannel = $this->getByte();
|
||||||
|
}else{
|
||||||
|
$orderIndex = false;
|
||||||
|
$orderChannel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($hasSplit){
|
||||||
|
$splitCount = $this->getInt();
|
||||||
|
$splitID = $this->getShort();
|
||||||
|
$splitIndex = $this->getInt();
|
||||||
|
}else{
|
||||||
|
$splitCount = false;
|
||||||
|
$splitID = false;
|
||||||
|
$splitIndex = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($length <= 0
|
||||||
|
or $orderChannel >= 32
|
||||||
|
or ($hasSplit === true and $splitIndex >= $splitCount)){
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
$pid = $this->getByte();
|
||||||
|
$buffer = $this->get($length - 1);
|
||||||
|
if(strlen($buffer) < ($length - 1)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch($pid){
|
||||||
|
case ProtocolInfo12::PING_PACKET:
|
||||||
|
$data = new PingPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::PONG_PACKET:
|
||||||
|
$data = new PongPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::CLIENT_CONNECT_PACKET:
|
||||||
|
$data = new ClientConnectPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::SERVER_HANDSHAKE_PACKET:
|
||||||
|
$data = new ServerHandshakePacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::DISCONNECT_PACKET:
|
||||||
|
$data = new DisconnectPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::LOGIN_PACKET:
|
||||||
|
$data = new LoginPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::LOGIN_STATUS_PACKET:
|
||||||
|
$data = new LoginStatusPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::READY_PACKET:
|
||||||
|
$data = new ReadyPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::MESSAGE_PACKET:
|
||||||
|
$data = new MessagePacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::SET_TIME_PACKET:
|
||||||
|
$data = new SetTimePacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::START_GAME_PACKET:
|
||||||
|
$data = new StartGamePacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::ADD_MOB_PACKET:
|
||||||
|
$data = new AddMobPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::ADD_PLAYER_PACKET:
|
||||||
|
$data = new AddPlayerPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::REMOVE_PLAYER_PACKET:
|
||||||
|
$data = new RemovePlayerPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::ADD_ENTITY_PACKET:
|
||||||
|
$data = new AddEntityPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::REMOVE_ENTITY_PACKET:
|
||||||
|
$data = new RemoveEntityPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::ADD_ITEM_ENTITY_PACKET:
|
||||||
|
$data = new AddItemEntityPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::TAKE_ITEM_ENTITY_PACKET:
|
||||||
|
$data = new TakeItemEntityPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::MOVE_ENTITY_PACKET:
|
||||||
|
$data = new MoveEntityPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::MOVE_ENTITY_PACKET_POSROT:
|
||||||
|
$data = new MoveEntityPacket_PosRot;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::ROTATE_HEAD_PACKET:
|
||||||
|
$data = new RotateHeadPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::MOVE_PLAYER_PACKET:
|
||||||
|
$data = new MovePlayerPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::REMOVE_BLOCK_PACKET:
|
||||||
|
$data = new RemoveBlockPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::UPDATE_BLOCK_PACKET:
|
||||||
|
$data = new UpdateBlockPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::ADD_PAINTING_PACKET:
|
||||||
|
$data = new AddPaintingPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::EXPLODE_PACKET:
|
||||||
|
$data = new ExplodePacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::LEVEL_EVENT_PACKET:
|
||||||
|
$data = new LevelEventPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::TILE_EVENT_PACKET:
|
||||||
|
$data = new TileEventPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::ENTITY_EVENT_PACKET:
|
||||||
|
$data = new EntityEventPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::REQUEST_CHUNK_PACKET:
|
||||||
|
$data = new RequestChunkPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::CHUNK_DATA_PACKET:
|
||||||
|
$data = new ChunkDataPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::PLAYER_EQUIPMENT_PACKET:
|
||||||
|
$data = new PlayerEquipmentPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::PLAYER_ARMOR_EQUIPMENT_PACKET:
|
||||||
|
$data = new PlayerArmorEquipmentPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::INTERACT_PACKET:
|
||||||
|
$data = new InteractPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::USE_ITEM_PACKET:
|
||||||
|
$data = new UseItemPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::PLAYER_ACTION_PACKET:
|
||||||
|
$data = new PlayerActionPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::HURT_ARMOR_PACKET:
|
||||||
|
$data = new HurtArmorPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::SET_ENTITY_DATA_PACKET:
|
||||||
|
$data = new SetEntityDataPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::SET_ENTITY_MOTION_PACKET:
|
||||||
|
$data = new SetEntityMotionPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::SET_HEALTH_PACKET:
|
||||||
|
$data = new SetHealthPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::SET_SPAWN_POSITION_PACKET:
|
||||||
|
$data = new SetSpawnPositionPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::ANIMATE_PACKET:
|
||||||
|
$data = new AnimatePacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::RESPAWN_PACKET:
|
||||||
|
$data = new RespawnPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::SEND_INVENTORY_PACKET:
|
||||||
|
$data = new SendInventoryPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::DROP_ITEM_PACKET:
|
||||||
|
$data = new DropItemPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::CONTAINER_OPEN_PACKET:
|
||||||
|
$data = new ContainerOpenPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::CONTAINER_CLOSE_PACKET:
|
||||||
|
$data = new ContainerClosePacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::CONTAINER_SET_SLOT_PACKET:
|
||||||
|
$data = new ContainerSetSlotPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::CONTAINER_SET_DATA_PACKET:
|
||||||
|
$data = new ContainerSetDataPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::CONTAINER_SET_CONTENT_PACKET:
|
||||||
|
$data = new ContainerSetContentPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::CHAT_PACKET:
|
||||||
|
$data = new ChatPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::ADVENTURE_SETTINGS_PACKET:
|
||||||
|
$data = new AdventureSettingsPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::ENTITY_DATA_PACKET:
|
||||||
|
$data = new EntityDataPacket;
|
||||||
|
break;
|
||||||
|
case ProtocolInfo12::SET_ENTITY_LINK_PACKET:
|
||||||
|
$data = new SetEntityLinkPacket;
|
||||||
|
case ProtocolInfo12::PLAYER_INPUT_PACKET:
|
||||||
|
$data = new PlayerInputPacket;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$data = new UnknownPacket();
|
||||||
|
$data->packetID = $pid;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$data->reliability = $reliability;
|
||||||
|
$data->hasSplit = $hasSplit;
|
||||||
|
$data->messageIndex = $messageIndex;
|
||||||
|
$data->orderIndex = $orderIndex;
|
||||||
|
$data->orderChannel = $orderChannel;
|
||||||
|
$data->splitCount = $splitCount;
|
||||||
|
$data->splitID = $splitID;
|
||||||
|
$data->splitIndex = $splitIndex;
|
||||||
|
$data->setBuffer($buffer);
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
private function getInt($unsigned = false){
|
private function getInt($unsigned = false){
|
||||||
return Utils::readInt($this->get(4), $unsigned);
|
return Utils::readInt($this->get(4), $unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue