mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Support 0.7.0
This commit is contained in:
parent
048dfd2e98
commit
0fefb140f4
21 changed files with 48 additions and 44 deletions
|
|
@ -665,7 +665,7 @@ class BlockAPI{
|
|||
|
||||
private function cancelAction(Block $block, Player $player, $send = true){
|
||||
$player->addBlockUpdateIntoQueue($block->x, $block->y, $block->z, $block->getID(), $block->getMetadata());
|
||||
if($send === true && $player->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($send === true && $player->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
$player->sendInventory();
|
||||
}
|
||||
return false;
|
||||
|
|
@ -859,7 +859,7 @@ class BlockAPI{
|
|||
}
|
||||
|
||||
public static function convertHighItemIdsToOldItemIds(int $protocolId, int $itemId, int $metaData = 0) : int{ //TODO Id metadata
|
||||
if ($protocolId >= ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
||||
if ($protocolId >= ProtocolInfo12::CURRENT_PROTOCOL_11) {
|
||||
return $itemId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1115,7 +1115,7 @@ class Player{
|
|||
public function eventHandler($data, $event){
|
||||
switch($event){
|
||||
case "entity.link":
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
break;
|
||||
}
|
||||
$pk = new SetEntityLinkPacket();
|
||||
|
|
@ -1424,6 +1424,9 @@ class Player{
|
|||
$pk = new MessagePacket;
|
||||
$pk->source = ($author instanceof Player) ? $author->username : $author;
|
||||
$pk->message = TextFormat::clean($m); //Colors not implemented :(
|
||||
if($this->PROTOCOL <= ProtocolInfo12::CURRENT_PROTOCOL_11 && $pk->source !== $author) {
|
||||
$pk->message = "<" . $pk->source . "> " . $pk->message;
|
||||
}
|
||||
$this->sendChatMessagePacket($pk);
|
||||
}
|
||||
}
|
||||
|
|
@ -1552,7 +1555,7 @@ class Player{
|
|||
}
|
||||
}elseif(($gm & 0x01) === 0x01){
|
||||
$inv = [];
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
foreach(BlockAPI::$creative as $item){
|
||||
$inv[] = BlockAPI::getItem($item[0], $item[1], 1);
|
||||
}
|
||||
|
|
@ -2325,7 +2328,7 @@ class Player{
|
|||
$inv[] = [0, 0, 1];
|
||||
}
|
||||
}else{
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
foreach(BlockAPI::$creative as $item){
|
||||
$inv[] = [$item[0], $item[1], 1];
|
||||
}
|
||||
|
|
@ -2571,7 +2574,7 @@ class Player{
|
|||
$inv[] = [0, 0, 1];
|
||||
}
|
||||
}else{
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
foreach(BlockAPI::$creative as $item){
|
||||
$inv[] = [$item[0], $item[1], 1];
|
||||
}
|
||||
|
|
@ -2836,7 +2839,7 @@ class Player{
|
|||
$data["eid"] = $packet->eid;
|
||||
$data["player"] = $this;
|
||||
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
if(($slot = $this->hasItem($packet->item, $packet->meta)) !== false) {
|
||||
$packet->slot = $slot + 9;
|
||||
}elseif ($packet->item === AIR && $packet->meta === AIR){
|
||||
|
|
@ -2866,7 +2869,7 @@ class Player{
|
|||
}
|
||||
}elseif(($this->gamemode & 0x01) === CREATIVE){
|
||||
$packet->slot = false;
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
foreach(BlockAPI::$creative as $i => $d){
|
||||
if($d[0] === $packet->item and $d[1] === $packet->meta){
|
||||
$packet->slot = $i;
|
||||
|
|
@ -2984,7 +2987,7 @@ class Player{
|
|||
$data["posY"] = $packet->posY;
|
||||
$data["posZ"] = $packet->posZ;
|
||||
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){ //TODO Emulate and Calcuate slot for version under 0.6.0
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){ //TODO Emulate and Calcuate slot for version under 0.6.0
|
||||
$target = $this->level->getBlock($blockVector);
|
||||
if($target->getID() === WORKBENCH) $this->isWorkBench = true;
|
||||
elseif ($target->getID() === STONECUTTER) $this->isStoneCutter = true;
|
||||
|
|
@ -3044,7 +3047,7 @@ class Player{
|
|||
$this->addBlockUpdateIntoQueue($block->x, $block->y, $block->z, $block->getID(), $block->getMetadata());
|
||||
break;
|
||||
}elseif($packet->face === 0xff){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){ //TODO Emulate and Calcuate slot for version under 0.6.0
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
if($this->hasItem($data["item"], $data["meta"]) !== false) {
|
||||
$handHeldItem = BlockAPI::getItem($data["item"], $data["meta"]);
|
||||
$this->setCurrentSlot($handHeldItem);
|
||||
|
|
@ -3181,7 +3184,7 @@ class Player{
|
|||
case 5: //Shot arrow
|
||||
if($this->entity->inAction){
|
||||
$arrowSlot = $this->hasItem(ARROW);
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12 && $arrowSlot === false){
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11 && $arrowSlot === false){
|
||||
if(($this->gamemode & 1) == SURVIVAL && $this->isWorkBench && $this->getHeldItem()->getID() === BOW && $this->PROTOCOL >= ProtocolInfo6::CURRENT_PROTOCOL_6 && $this->addCraftedItem(ARROW, 0, 1)){
|
||||
$arrowSlot = $this->hasItem(ARROW);
|
||||
}
|
||||
|
|
@ -3230,7 +3233,7 @@ class Player{
|
|||
}
|
||||
}
|
||||
}else{ //inv desynced, resend
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11) {
|
||||
$this->sendInventory();
|
||||
}
|
||||
}
|
||||
|
|
@ -3273,7 +3276,7 @@ class Player{
|
|||
}
|
||||
$slot = $this->armor[$i];
|
||||
|
||||
if(($this->gamemode & 1) == SURVIVAL && $this->isWorkBench && $this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12 && $this->PROTOCOL >= ProtocolInfo6::CURRENT_PROTOCOL_6) {
|
||||
if(($this->gamemode & 1) == SURVIVAL && $this->isWorkBench && $this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11 && $this->PROTOCOL >= ProtocolInfo6::CURRENT_PROTOCOL_6) {
|
||||
if($this->hasItem($s->getID()) === false && $this->getArmor($i)->getID() !== $s->getID()){
|
||||
$this->addCraftedItem($s->getID(), 0 , 1);
|
||||
}
|
||||
|
|
@ -3439,7 +3442,7 @@ class Player{
|
|||
$packet->eid = $this->eid;
|
||||
$prevItem = $packet->item;
|
||||
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11) {
|
||||
if (($droppingAbsoluteSlot = $this->getAccurateItemSlot($prevItem->getID(), $prevItem->getMetadata(), $prevItem->count)) !== false) {
|
||||
$this->slot = $droppingAbsoluteSlot;
|
||||
} elseif (($this->gamemode & 1) == SURVIVAL) {
|
||||
|
|
@ -3556,6 +3559,12 @@ class Player{
|
|||
$this->toCraft = [];
|
||||
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
|
||||
if(trim($packet->message) != "" and strlen($packet->message) <= 255){
|
||||
if($this->PROTOCOL === ProtocolInfo12::CURRENT_PROTOCOL_11 && str_contains($packet->message, ">") !== false){
|
||||
$rawMessage = explode(">", $packet->message, 2)[1];
|
||||
if(strlen($rawMessage ) >= 2){
|
||||
$packet->message = substr($rawMessage, 1);
|
||||
}
|
||||
}
|
||||
$message = $packet->message;
|
||||
if($message[0] === "/"){ //Command
|
||||
if($this instanceof Player){
|
||||
|
|
@ -3732,7 +3741,7 @@ class Player{
|
|||
|
||||
$slot = $tile->getSlot($packet->slot);
|
||||
|
||||
if(($this->gamemode & 1) == SURVIVAL && $this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12 && $this->PROTOCOL >= ProtocolInfo6::CURRENT_PROTOCOL_6 && $slot->count < $item->count && !CraftingRecipes::getEnoughItem($this, $slot->getID(), $slot->getMetadata(), $item->count - $slot->count)){
|
||||
if(($this->gamemode & 1) == SURVIVAL && $this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11 && $this->PROTOCOL >= ProtocolInfo6::CURRENT_PROTOCOL_6 && $slot->count < $item->count && !CraftingRecipes::getEnoughItem($this, $slot->getID(), $slot->getMetadata(), $item->count - $slot->count)){
|
||||
$transCnt = $item->count - $slot->count;
|
||||
if(($counts = $this->getItemCount($item->getID(), $item->getMetadata())) !== 0) {
|
||||
if($counts < $transCnt){
|
||||
|
|
@ -3998,7 +4007,7 @@ class Player{
|
|||
$this->toCraft[$index][$slot] += $count;
|
||||
|
||||
//console("Result: $id, $meta, $count into $slot");
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11) {
|
||||
if($this->tryCraft() === false){
|
||||
$this->sendInventory();
|
||||
}
|
||||
|
|
@ -4015,7 +4024,7 @@ class Player{
|
|||
if(!isset($this->craftingItems[$index][$slot])) $this->craftingItems[$index][$slot] = 0;
|
||||
$this->craftingItems[$index][$slot] += $count;
|
||||
//console("Ingridient: $id, $meta, $count into $slot");
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11) {
|
||||
if($this->tryCraft() === false){
|
||||
$this->sendInventory();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1716,7 +1716,7 @@ class Entity extends Position
|
|||
$this->updateMetadata();
|
||||
$this->dead = true;
|
||||
if($this->player instanceof Player){
|
||||
if($this->player->PROTOCOL <= ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
if($this->player->PROTOCOL <= ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
$pk = new EntityEventPacket;
|
||||
$pk->eid = $this->eid;
|
||||
$pk->event = EntityEventPacket::ENTITY_DEAD;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ abstract class ProtocolInfo{
|
|||
abstract class ProtocolInfo12{
|
||||
|
||||
const CURRENT_PROTOCOL_12 = 12;
|
||||
const CURRENT_PROTOCOL_11 = 11;
|
||||
|
||||
const PING_PACKET = 0x00;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class AnimatePacket extends RakNetDataPacket{
|
|||
return ProtocolInfo6::ANIMATE_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::ANIMATE_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::ANIMATE_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::ANIMATE_PACKET;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class ChatPacket extends RakNetDataPacket{
|
|||
return ProtocolInfo6::CHAT_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::CHAT_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::CHAT_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::CHAT_PACKET;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class ContainerAckPacket extends RakNetDataPacket{
|
|||
return ProtocolInfo6::CONTAINER_ACK_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::CONTAINER_ACK_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::CONTAINER_ACK_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::CONTAINER_ACK_PACKET;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class ContainerClosePacket extends RakNetDataPacket{
|
|||
return ProtocolInfo6::CONTAINER_CLOSE_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::CONTAINER_CLOSE_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::CONTAINER_CLOSE_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::CONTAINER_CLOSE_PACKET;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ class ContainerOpenPacket extends RakNetDataPacket{
|
|||
}elseif($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
return ProtocolInfo6::CONTAINER_OPEN_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::CONTAINER_OPN_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
return ProtocolInfo8::CONTAINER_OPEN_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::CONTAINER_OPEN_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::CONTAINER_OPEN_PACKET;
|
||||
|
|
@ -37,7 +37,7 @@ class ContainerOpenPacket extends RakNetDataPacket{
|
|||
$this->putByte($this->slots);
|
||||
if ($this->PROTOCOL <= ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
$this->putString($this->unknownstring);
|
||||
ConsoleAPI::debug($this->unknownstring);
|
||||
ConsoleAPI::info($this->unknownstring);
|
||||
}else{
|
||||
$this->putInt($this->x);
|
||||
$this->putInt($this->y);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class ContainerSetContentPacket extends RakNetDataPacket{
|
|||
return ProtocolInfo6::CONTAINER_SET_CONTENT_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::CONTAINER_SET_CONTENT_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::CONTAINER_SET_CONTENT_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::CONTAINER_SET_CONTENT_PACKET;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class ContainerSetDataPacket extends RakNetDataPacket{
|
|||
return ProtocolInfo6::CONTAINER_SET_DATA_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::CONTAINER_SET_DATA_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::CONTAINER_SET_DATA_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::CONTAINER_SET_DATA_PACKET;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class ContainerSetSlotPacket extends RakNetDataPacket{
|
|||
return ProtocolInfo6::CONTAINER_SET_SLOT_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::CONTAINER_SET_SLOT_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::CONTAINER_SET_SLOT_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::CONTAINER_SET_SLOT_PACKET;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class DropItemPacket extends RakNetDataPacket{
|
|||
return ProtocolInfo6::DROP_ITEM_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::DROP_ITEM_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::DROP_ITEM_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::DROP_ITEM_PACKET;
|
||||
|
|
@ -23,17 +23,12 @@ class DropItemPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function decode(){
|
||||
//if($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8)$this->reset();
|
||||
$this->eid = $this->getInt();
|
||||
$this->randomly = $this->getByte();
|
||||
$this->item = $this->getSlot();
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
/*$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putByte($this->unknown);
|
||||
$this->putSlot($this->item);*/
|
||||
}
|
||||
|
||||
public function eidsToGlobal(Player $p){
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class EntityDataPacket extends RakNetDataPacket{
|
|||
return ProtocolInfo6::ENTITY_DATA_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9) {
|
||||
return ProtocolInfo8::ENTITY_DATA_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11) {
|
||||
return ProtocolInfo9::ENTITY_DATA_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::ENTITY_DATA_PACKET;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ class LoginPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function decode(){
|
||||
//if($this->PROTOCOL <= ProtocolInfo9::CURRENT_PROTOCOL_9)$this->reset();
|
||||
$this->username = $this->getString();
|
||||
$this->protocol1 = $this->getInt();
|
||||
$this->protocol2 = $this->getInt();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class MessagePacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function decode(){
|
||||
if($this->PROTOCOL > ProtocolInfo9::CURRENT_PROTOCOL_9){ //0.6.1 and below From NostalgiaCore-BackPort Author:Gameherobrine
|
||||
if($this->PROTOCOL > ProtocolInfo12::CURRENT_PROTOCOL_11){ //0.6.1 and below From NostalgiaCore-BackPort Author:Gameherobrine
|
||||
$this->source = $this->getString();
|
||||
}else {
|
||||
$this->source = "";
|
||||
|
|
@ -22,7 +22,7 @@ class MessagePacket extends RakNetDataPacket{
|
|||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
if($this->PROTOCOL > ProtocolInfo9::CURRENT_PROTOCOL_9){ //0.6.1 and below From NostalgiaCore-BackPort Author:Gameherobrine
|
||||
if($this->PROTOCOL > ProtocolInfo12::CURRENT_PROTOCOL_11){ //0.6.1 and below From NostalgiaCore-BackPort Author:Gameherobrine
|
||||
$this->putString($this->source);
|
||||
}
|
||||
$this->putString($this->message);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class PlayerEquipmentPacket extends RakNetDataPacket{
|
|||
$this->eid = $this->getInt();
|
||||
$this->item = $this->getShort();
|
||||
$this->meta = $this->getShort();
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12){$this->slot = $this->getSignedByte();}
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11){$this->slot = $this->getSignedByte();}
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
|
|
@ -33,7 +33,7 @@ class PlayerEquipmentPacket extends RakNetDataPacket{
|
|||
$this->putInt($this->eid);
|
||||
$this->putShort(BlockAPI::convertHighItemIdsToOldItemIds($this->PROTOCOL, $this->item));
|
||||
$this->putShort($this->meta);
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12){$this->putByte($this->slot);}
|
||||
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11){$this->putByte($this->slot);}
|
||||
}
|
||||
|
||||
public function eidsToGlobal(Player $p){
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class RespawnPacket extends RakNetDataPacket{
|
|||
return ProtocolInfo6::RESPAWN_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::RESPAWN_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::RESPAWN_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::RESPAWN_PACKET;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class SendInventoryPacket extends RakNetDataPacket{
|
|||
return ProtocolInfo6::SEND_INVENTORY_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::SEND_INVENTORY_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::SEND_INVENTORY_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::SEND_INVENTORY_PACKET;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class SetHealthPacket extends RakNetDataPacket{
|
|||
return ProtocolInfo6::SET_HEALTH_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::SET_HEALTH_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::SET_HEALTH_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::SET_HEALTH_PACKET;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class SetSpawnPositionPacket extends RakNetDataPacket{
|
|||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return ProtocolInfo8::SET_SPAWN_POSITION_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
|
||||
return ProtocolInfo9::SET_SPAWN_POSITION_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::SET_SPAWN_POSITION_PACKET;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue