mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
Support MCPE 0.3.2 - 0.6.0
This commit is contained in:
parent
6cfc8f1385
commit
e428f39736
21 changed files with 1079 additions and 139 deletions
|
|
@ -4,7 +4,9 @@ class AdventureSettingsPacket extends RakNetDataPacket{
|
|||
public $flags;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ class AnimatePacket extends RakNetDataPacket{
|
|||
public $eid;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($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;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ class ChatPacket extends RakNetDataPacket{
|
|||
public $message;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($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;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ class ContainerClosePacket extends RakNetDataPacket{
|
|||
public $windowid;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($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;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ class ContainerOpenPacket extends RakNetDataPacket{
|
|||
public $z;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($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;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ class ContainerSetSlotPacket extends RakNetDataPacket{
|
|||
public $item;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($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;
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@ class DropItemPacket extends RakNetDataPacket{
|
|||
public $item;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo7::DROP_ITEM_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
return ProtocolInfo9::DROP_ITEM_PACKET;
|
||||
}else if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::DROP_ITEM_PACKET;
|
||||
}
|
||||
return ProtocolInfo::DROP_ITEM_PACKET;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ class EntityDataPacket extends RakNetDataPacket{
|
|||
public $namedtag;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ class InteractPacket extends RakNetDataPacket{
|
|||
public $target;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo7::INTERACT_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::INTERACT_PACKET;
|
||||
}
|
||||
return ProtocolInfo::INTERACT_PACKET;
|
||||
|
|
|
|||
|
|
@ -9,13 +9,17 @@ class MessagePacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
$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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ class PlayerActionPacket extends RakNetDataPacket{
|
|||
public $eid;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
if($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;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ class RespawnPacket extends RakNetDataPacket{
|
|||
public $z;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($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;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ class SendInventoryPacket extends RakNetDataPacket{
|
|||
public $armor = array();
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($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;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ class SetEntityDataPacket extends RakNetDataPacket{
|
|||
public $metadata;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
if($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;
|
||||
|
|
@ -17,6 +19,7 @@ class SetEntityDataPacket extends RakNetDataPacket{
|
|||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
if($this->PROTOCOL >= ProtocolInfo7::CURRENT_PROTOCOL_7)
|
||||
$this->putInt($this->eid);
|
||||
$this->put(Utils::writeMetadata($this->metadata));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ class SetEntityMotionPacket extends RakNetDataPacket{
|
|||
public $speedZ;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
if($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;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ class SetHealthPacket extends RakNetDataPacket{
|
|||
public $health;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($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;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ class SetSpawnPositionPacket extends RakNetDataPacket{
|
|||
public $y;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ class UseItemPacket extends RakNetDataPacket{
|
|||
public $posZ;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
if($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;
|
||||
|
|
@ -33,9 +35,11 @@ class UseItemPacket extends RakNetDataPacket{
|
|||
$this->fx = $this->getFloat();
|
||||
$this->fy = $this->getFloat();
|
||||
$this->fz = $this->getFloat();
|
||||
$this->posX = $this->getFloat();
|
||||
$this->posY = $this->getFloat();
|
||||
$this->posZ = $this->getFloat();
|
||||
if ($this->PROTOCOL > ProtocolInfo9::CURRENT_PROTOCOL_9) {
|
||||
$this->posX = $this->getFloat();
|
||||
$this->posY = $this->getFloat();
|
||||
$this->posZ = $this->getFloat();
|
||||
}
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue