From 0fefb140f47cffc61c1c189e680081a4ac9d65f3 Mon Sep 17 00:00:00 2001 From: yefengeeeeeeeeeee <403749250@qq.com> Date: Sun, 12 Jul 2026 17:55:36 +0800 Subject: [PATCH] Support 0.7.0 --- src/API/BlockAPI.php | 4 +- src/Player.php | 39 ++++++++++++------- src/entity/Entity.php | 2 +- src/network/protocol/ProtocolInfo.php | 1 + src/network/protocol/packet/AnimatePacket.php | 2 +- src/network/protocol/packet/ChatPacket.php | 2 +- .../protocol/packet/ContainerAckPacket.php | 2 +- .../protocol/packet/ContainerClosePacket.php | 2 +- .../protocol/packet/ContainerOpenPacket.php | 6 +-- .../packet/ContainerSetContentPacket.php | 2 +- .../packet/ContainerSetDataPacket.php | 2 +- .../packet/ContainerSetSlotPacket.php | 2 +- .../protocol/packet/DropItemPacket.php | 7 +--- .../protocol/packet/EntityDataPacket.php | 2 +- src/network/protocol/packet/LoginPacket.php | 1 - src/network/protocol/packet/MessagePacket.php | 4 +- .../protocol/packet/PlayerEquipmentPacket.php | 4 +- src/network/protocol/packet/RespawnPacket.php | 2 +- .../protocol/packet/SendInventoryPacket.php | 2 +- .../protocol/packet/SetHealthPacket.php | 2 +- .../packet/SetSpawnPositionPacket.php | 2 +- 21 files changed, 48 insertions(+), 44 deletions(-) diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index fcd53a8c..2fffa346 100755 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -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; } diff --git a/src/Player.php b/src/Player.php index 9cf9bf66..64f8d1eb 100755 --- a/src/Player.php +++ b/src/Player.php @@ -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(); } diff --git a/src/entity/Entity.php b/src/entity/Entity.php index e68a0d80..5fb27688 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -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; diff --git a/src/network/protocol/ProtocolInfo.php b/src/network/protocol/ProtocolInfo.php index f500ae3a..ac8b7071 100644 --- a/src/network/protocol/ProtocolInfo.php +++ b/src/network/protocol/ProtocolInfo.php @@ -78,6 +78,7 @@ abstract class ProtocolInfo{ abstract class ProtocolInfo12{ const CURRENT_PROTOCOL_12 = 12; + const CURRENT_PROTOCOL_11 = 11; const PING_PACKET = 0x00; diff --git a/src/network/protocol/packet/AnimatePacket.php b/src/network/protocol/packet/AnimatePacket.php index 99f3d28a..5904f504 100644 --- a/src/network/protocol/packet/AnimatePacket.php +++ b/src/network/protocol/packet/AnimatePacket.php @@ -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; diff --git a/src/network/protocol/packet/ChatPacket.php b/src/network/protocol/packet/ChatPacket.php index 1a69c7b7..cbdf6c9f 100644 --- a/src/network/protocol/packet/ChatPacket.php +++ b/src/network/protocol/packet/ChatPacket.php @@ -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; diff --git a/src/network/protocol/packet/ContainerAckPacket.php b/src/network/protocol/packet/ContainerAckPacket.php index 7f0aad22..316b755a 100644 --- a/src/network/protocol/packet/ContainerAckPacket.php +++ b/src/network/protocol/packet/ContainerAckPacket.php @@ -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; diff --git a/src/network/protocol/packet/ContainerClosePacket.php b/src/network/protocol/packet/ContainerClosePacket.php index bff84659..b7647e25 100644 --- a/src/network/protocol/packet/ContainerClosePacket.php +++ b/src/network/protocol/packet/ContainerClosePacket.php @@ -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; diff --git a/src/network/protocol/packet/ContainerOpenPacket.php b/src/network/protocol/packet/ContainerOpenPacket.php index 49b0b692..a86ce835 100644 --- a/src/network/protocol/packet/ContainerOpenPacket.php +++ b/src/network/protocol/packet/ContainerOpenPacket.php @@ -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); diff --git a/src/network/protocol/packet/ContainerSetContentPacket.php b/src/network/protocol/packet/ContainerSetContentPacket.php index bff53407..747a7778 100644 --- a/src/network/protocol/packet/ContainerSetContentPacket.php +++ b/src/network/protocol/packet/ContainerSetContentPacket.php @@ -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; diff --git a/src/network/protocol/packet/ContainerSetDataPacket.php b/src/network/protocol/packet/ContainerSetDataPacket.php index 24c1fdb9..52a6d057 100644 --- a/src/network/protocol/packet/ContainerSetDataPacket.php +++ b/src/network/protocol/packet/ContainerSetDataPacket.php @@ -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; diff --git a/src/network/protocol/packet/ContainerSetSlotPacket.php b/src/network/protocol/packet/ContainerSetSlotPacket.php index 435a1199..ffc1a2c1 100644 --- a/src/network/protocol/packet/ContainerSetSlotPacket.php +++ b/src/network/protocol/packet/ContainerSetSlotPacket.php @@ -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; diff --git a/src/network/protocol/packet/DropItemPacket.php b/src/network/protocol/packet/DropItemPacket.php index c42be30e..d19ca288 100644 --- a/src/network/protocol/packet/DropItemPacket.php +++ b/src/network/protocol/packet/DropItemPacket.php @@ -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){ diff --git a/src/network/protocol/packet/EntityDataPacket.php b/src/network/protocol/packet/EntityDataPacket.php index 4b241d89..564a5a44 100644 --- a/src/network/protocol/packet/EntityDataPacket.php +++ b/src/network/protocol/packet/EntityDataPacket.php @@ -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; diff --git a/src/network/protocol/packet/LoginPacket.php b/src/network/protocol/packet/LoginPacket.php index 0d4225a6..f9ad37cd 100644 --- a/src/network/protocol/packet/LoginPacket.php +++ b/src/network/protocol/packet/LoginPacket.php @@ -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(); diff --git a/src/network/protocol/packet/MessagePacket.php b/src/network/protocol/packet/MessagePacket.php index 4aedf097..62efceab 100644 --- a/src/network/protocol/packet/MessagePacket.php +++ b/src/network/protocol/packet/MessagePacket.php @@ -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); diff --git a/src/network/protocol/packet/PlayerEquipmentPacket.php b/src/network/protocol/packet/PlayerEquipmentPacket.php index f166294b..19ec8e69 100644 --- a/src/network/protocol/packet/PlayerEquipmentPacket.php +++ b/src/network/protocol/packet/PlayerEquipmentPacket.php @@ -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){ diff --git a/src/network/protocol/packet/RespawnPacket.php b/src/network/protocol/packet/RespawnPacket.php index 32b38ef8..e7b49fb4 100644 --- a/src/network/protocol/packet/RespawnPacket.php +++ b/src/network/protocol/packet/RespawnPacket.php @@ -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; diff --git a/src/network/protocol/packet/SendInventoryPacket.php b/src/network/protocol/packet/SendInventoryPacket.php index 3845b644..24b3714d 100644 --- a/src/network/protocol/packet/SendInventoryPacket.php +++ b/src/network/protocol/packet/SendInventoryPacket.php @@ -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; diff --git a/src/network/protocol/packet/SetHealthPacket.php b/src/network/protocol/packet/SetHealthPacket.php index a556797d..6f48ebb1 100644 --- a/src/network/protocol/packet/SetHealthPacket.php +++ b/src/network/protocol/packet/SetHealthPacket.php @@ -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; diff --git a/src/network/protocol/packet/SetSpawnPositionPacket.php b/src/network/protocol/packet/SetSpawnPositionPacket.php index a072a131..302db498 100644 --- a/src/network/protocol/packet/SetSpawnPositionPacket.php +++ b/src/network/protocol/packet/SetSpawnPositionPacket.php @@ -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;