Support 0.7.0

This commit is contained in:
yefengeeeeeeeeeee 2026-07-12 17:55:36 +08:00
parent 048dfd2e98
commit 0fefb140f4
21 changed files with 48 additions and 44 deletions

View file

@ -665,7 +665,7 @@ class BlockAPI{
private function cancelAction(Block $block, Player $player, $send = true){ private function cancelAction(Block $block, Player $player, $send = true){
$player->addBlockUpdateIntoQueue($block->x, $block->y, $block->z, $block->getID(), $block->getMetadata()); $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(); $player->sendInventory();
} }
return false; return false;
@ -859,7 +859,7 @@ class BlockAPI{
} }
public static function convertHighItemIdsToOldItemIds(int $protocolId, int $itemId, int $metaData = 0) : int{ //TODO Id metadata 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; return $itemId;
} }

View file

@ -1115,7 +1115,7 @@ class Player{
public function eventHandler($data, $event){ public function eventHandler($data, $event){
switch($event){ switch($event){
case "entity.link": case "entity.link":
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){ if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
break; break;
} }
$pk = new SetEntityLinkPacket(); $pk = new SetEntityLinkPacket();
@ -1424,6 +1424,9 @@ class Player{
$pk = new MessagePacket; $pk = new MessagePacket;
$pk->source = ($author instanceof Player) ? $author->username : $author; $pk->source = ($author instanceof Player) ? $author->username : $author;
$pk->message = TextFormat::clean($m); //Colors not implemented :( $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); $this->sendChatMessagePacket($pk);
} }
} }
@ -1552,7 +1555,7 @@ class Player{
} }
}elseif(($gm & 0x01) === 0x01){ }elseif(($gm & 0x01) === 0x01){
$inv = []; $inv = [];
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12){ if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11){
foreach(BlockAPI::$creative as $item){ foreach(BlockAPI::$creative as $item){
$inv[] = BlockAPI::getItem($item[0], $item[1], 1); $inv[] = BlockAPI::getItem($item[0], $item[1], 1);
} }
@ -2325,7 +2328,7 @@ class Player{
$inv[] = [0, 0, 1]; $inv[] = [0, 0, 1];
} }
}else{ }else{
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12){ if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11){
foreach(BlockAPI::$creative as $item){ foreach(BlockAPI::$creative as $item){
$inv[] = [$item[0], $item[1], 1]; $inv[] = [$item[0], $item[1], 1];
} }
@ -2571,7 +2574,7 @@ class Player{
$inv[] = [0, 0, 1]; $inv[] = [0, 0, 1];
} }
}else{ }else{
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12){ if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11){
foreach(BlockAPI::$creative as $item){ foreach(BlockAPI::$creative as $item){
$inv[] = [$item[0], $item[1], 1]; $inv[] = [$item[0], $item[1], 1];
} }
@ -2836,7 +2839,7 @@ class Player{
$data["eid"] = $packet->eid; $data["eid"] = $packet->eid;
$data["player"] = $this; $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) { if(($slot = $this->hasItem($packet->item, $packet->meta)) !== false) {
$packet->slot = $slot + 9; $packet->slot = $slot + 9;
}elseif ($packet->item === AIR && $packet->meta === AIR){ }elseif ($packet->item === AIR && $packet->meta === AIR){
@ -2866,7 +2869,7 @@ class Player{
} }
}elseif(($this->gamemode & 0x01) === CREATIVE){ }elseif(($this->gamemode & 0x01) === CREATIVE){
$packet->slot = false; $packet->slot = false;
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12){ if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11){
foreach(BlockAPI::$creative as $i => $d){ foreach(BlockAPI::$creative as $i => $d){
if($d[0] === $packet->item and $d[1] === $packet->meta){ if($d[0] === $packet->item and $d[1] === $packet->meta){
$packet->slot = $i; $packet->slot = $i;
@ -2984,7 +2987,7 @@ class Player{
$data["posY"] = $packet->posY; $data["posY"] = $packet->posY;
$data["posZ"] = $packet->posZ; $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); $target = $this->level->getBlock($blockVector);
if($target->getID() === WORKBENCH) $this->isWorkBench = true; if($target->getID() === WORKBENCH) $this->isWorkBench = true;
elseif ($target->getID() === STONECUTTER) $this->isStoneCutter = 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()); $this->addBlockUpdateIntoQueue($block->x, $block->y, $block->z, $block->getID(), $block->getMetadata());
break; break;
}elseif($packet->face === 0xff){ }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) { if($this->hasItem($data["item"], $data["meta"]) !== false) {
$handHeldItem = BlockAPI::getItem($data["item"], $data["meta"]); $handHeldItem = BlockAPI::getItem($data["item"], $data["meta"]);
$this->setCurrentSlot($handHeldItem); $this->setCurrentSlot($handHeldItem);
@ -3181,7 +3184,7 @@ class Player{
case 5: //Shot arrow case 5: //Shot arrow
if($this->entity->inAction){ if($this->entity->inAction){
$arrowSlot = $this->hasItem(ARROW); $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)){ 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); $arrowSlot = $this->hasItem(ARROW);
} }
@ -3230,7 +3233,7 @@ class Player{
} }
} }
}else{ //inv desynced, resend }else{ //inv desynced, resend
if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_12) { if($this->PROTOCOL >= ProtocolInfo12::CURRENT_PROTOCOL_11) {
$this->sendInventory(); $this->sendInventory();
} }
} }
@ -3273,7 +3276,7 @@ class Player{
} }
$slot = $this->armor[$i]; $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()){ if($this->hasItem($s->getID()) === false && $this->getArmor($i)->getID() !== $s->getID()){
$this->addCraftedItem($s->getID(), 0 , 1); $this->addCraftedItem($s->getID(), 0 , 1);
} }
@ -3439,7 +3442,7 @@ class Player{
$packet->eid = $this->eid; $packet->eid = $this->eid;
$prevItem = $packet->item; $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) { if (($droppingAbsoluteSlot = $this->getAccurateItemSlot($prevItem->getID(), $prevItem->getMetadata(), $prevItem->count)) !== false) {
$this->slot = $droppingAbsoluteSlot; $this->slot = $droppingAbsoluteSlot;
} elseif (($this->gamemode & 1) == SURVIVAL) { } elseif (($this->gamemode & 1) == SURVIVAL) {
@ -3556,6 +3559,12 @@ class Player{
$this->toCraft = []; $this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY; $this->craftingType = CraftingRecipes::TYPE_INVENTORY;
if(trim($packet->message) != "" and strlen($packet->message) <= 255){ 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; $message = $packet->message;
if($message[0] === "/"){ //Command if($message[0] === "/"){ //Command
if($this instanceof Player){ if($this instanceof Player){
@ -3732,7 +3741,7 @@ class Player{
$slot = $tile->getSlot($packet->slot); $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; $transCnt = $item->count - $slot->count;
if(($counts = $this->getItemCount($item->getID(), $item->getMetadata())) !== 0) { if(($counts = $this->getItemCount($item->getID(), $item->getMetadata())) !== 0) {
if($counts < $transCnt){ if($counts < $transCnt){
@ -3998,7 +4007,7 @@ class Player{
$this->toCraft[$index][$slot] += $count; $this->toCraft[$index][$slot] += $count;
//console("Result: $id, $meta, $count into $slot"); //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){ if($this->tryCraft() === false){
$this->sendInventory(); $this->sendInventory();
} }
@ -4015,7 +4024,7 @@ class Player{
if(!isset($this->craftingItems[$index][$slot])) $this->craftingItems[$index][$slot] = 0; if(!isset($this->craftingItems[$index][$slot])) $this->craftingItems[$index][$slot] = 0;
$this->craftingItems[$index][$slot] += $count; $this->craftingItems[$index][$slot] += $count;
//console("Ingridient: $id, $meta, $count into $slot"); //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){ if($this->tryCraft() === false){
$this->sendInventory(); $this->sendInventory();
} }

View file

@ -1716,7 +1716,7 @@ class Entity extends Position
$this->updateMetadata(); $this->updateMetadata();
$this->dead = true; $this->dead = true;
if($this->player instanceof Player){ 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 = new EntityEventPacket;
$pk->eid = $this->eid; $pk->eid = $this->eid;
$pk->event = EntityEventPacket::ENTITY_DEAD; $pk->event = EntityEventPacket::ENTITY_DEAD;

View file

@ -78,6 +78,7 @@ abstract class ProtocolInfo{
abstract class ProtocolInfo12{ abstract class ProtocolInfo12{
const CURRENT_PROTOCOL_12 = 12; const CURRENT_PROTOCOL_12 = 12;
const CURRENT_PROTOCOL_11 = 11;
const PING_PACKET = 0x00; const PING_PACKET = 0x00;

View file

@ -18,7 +18,7 @@ class AnimatePacket extends RakNetDataPacket{
return ProtocolInfo6::ANIMATE_PACKET; return ProtocolInfo6::ANIMATE_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::ANIMATE_PACKET; return ProtocolInfo8::ANIMATE_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){ }elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
return ProtocolInfo9::ANIMATE_PACKET; return ProtocolInfo9::ANIMATE_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::ANIMATE_PACKET; return ProtocolInfo12::ANIMATE_PACKET;

View file

@ -8,7 +8,7 @@ class ChatPacket extends RakNetDataPacket{
return ProtocolInfo6::CHAT_PACKET; return ProtocolInfo6::CHAT_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::CHAT_PACKET; return ProtocolInfo8::CHAT_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){ }elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
return ProtocolInfo9::CHAT_PACKET; return ProtocolInfo9::CHAT_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::CHAT_PACKET; return ProtocolInfo12::CHAT_PACKET;

View file

@ -16,7 +16,7 @@ class ContainerAckPacket extends RakNetDataPacket{
return ProtocolInfo6::CONTAINER_ACK_PACKET; return ProtocolInfo6::CONTAINER_ACK_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::CONTAINER_ACK_PACKET; return ProtocolInfo8::CONTAINER_ACK_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){ }elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
return ProtocolInfo9::CONTAINER_ACK_PACKET; return ProtocolInfo9::CONTAINER_ACK_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::CONTAINER_ACK_PACKET; return ProtocolInfo12::CONTAINER_ACK_PACKET;

View file

@ -12,7 +12,7 @@ class ContainerClosePacket extends RakNetDataPacket{
return ProtocolInfo6::CONTAINER_CLOSE_PACKET; return ProtocolInfo6::CONTAINER_CLOSE_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::CONTAINER_CLOSE_PACKET; return ProtocolInfo8::CONTAINER_CLOSE_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){ }elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
return ProtocolInfo9::CONTAINER_CLOSE_PACKET; return ProtocolInfo9::CONTAINER_CLOSE_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::CONTAINER_CLOSE_PACKET; return ProtocolInfo12::CONTAINER_CLOSE_PACKET;

View file

@ -17,8 +17,8 @@ class ContainerOpenPacket extends RakNetDataPacket{
}elseif($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8){ }elseif($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8){
return ProtocolInfo6::CONTAINER_OPEN_PACKET; return ProtocolInfo6::CONTAINER_OPEN_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::CONTAINER_OPN_PACKET; return ProtocolInfo8::CONTAINER_OPEN_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){ }elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
return ProtocolInfo9::CONTAINER_OPEN_PACKET; return ProtocolInfo9::CONTAINER_OPEN_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::CONTAINER_OPEN_PACKET; return ProtocolInfo12::CONTAINER_OPEN_PACKET;
@ -37,7 +37,7 @@ class ContainerOpenPacket extends RakNetDataPacket{
$this->putByte($this->slots); $this->putByte($this->slots);
if ($this->PROTOCOL <= ProtocolInfo9::CURRENT_PROTOCOL_9){ if ($this->PROTOCOL <= ProtocolInfo9::CURRENT_PROTOCOL_9){
$this->putString($this->unknownstring); $this->putString($this->unknownstring);
ConsoleAPI::debug($this->unknownstring); ConsoleAPI::info($this->unknownstring);
}else{ }else{
$this->putInt($this->x); $this->putInt($this->x);
$this->putInt($this->y); $this->putInt($this->y);

View file

@ -14,7 +14,7 @@ class ContainerSetContentPacket extends RakNetDataPacket{
return ProtocolInfo6::CONTAINER_SET_CONTENT_PACKET; return ProtocolInfo6::CONTAINER_SET_CONTENT_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::CONTAINER_SET_CONTENT_PACKET; 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; return ProtocolInfo9::CONTAINER_SET_CONTENT_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::CONTAINER_SET_CONTENT_PACKET; return ProtocolInfo12::CONTAINER_SET_CONTENT_PACKET;

View file

@ -14,7 +14,7 @@ class ContainerSetDataPacket extends RakNetDataPacket{
return ProtocolInfo6::CONTAINER_SET_DATA_PACKET; return ProtocolInfo6::CONTAINER_SET_DATA_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::CONTAINER_SET_DATA_PACKET; 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; return ProtocolInfo9::CONTAINER_SET_DATA_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::CONTAINER_SET_DATA_PACKET; return ProtocolInfo12::CONTAINER_SET_DATA_PACKET;

View file

@ -14,7 +14,7 @@ class ContainerSetSlotPacket extends RakNetDataPacket{
return ProtocolInfo6::CONTAINER_SET_SLOT_PACKET; return ProtocolInfo6::CONTAINER_SET_SLOT_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::CONTAINER_SET_SLOT_PACKET; 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; return ProtocolInfo9::CONTAINER_SET_SLOT_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::CONTAINER_SET_SLOT_PACKET; return ProtocolInfo12::CONTAINER_SET_SLOT_PACKET;

View file

@ -14,7 +14,7 @@ class DropItemPacket extends RakNetDataPacket{
return ProtocolInfo6::DROP_ITEM_PACKET; return ProtocolInfo6::DROP_ITEM_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::DROP_ITEM_PACKET; return ProtocolInfo8::DROP_ITEM_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){ }elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
return ProtocolInfo9::DROP_ITEM_PACKET; return ProtocolInfo9::DROP_ITEM_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::DROP_ITEM_PACKET; return ProtocolInfo12::DROP_ITEM_PACKET;
@ -23,17 +23,12 @@ class DropItemPacket extends RakNetDataPacket{
} }
public function decode(){ public function decode(){
//if($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8)$this->reset();
$this->eid = $this->getInt(); $this->eid = $this->getInt();
$this->randomly = $this->getByte(); $this->randomly = $this->getByte();
$this->item = $this->getSlot(); $this->item = $this->getSlot();
} }
public function encode(){ public function encode(){
/*$this->reset();
$this->putInt($this->eid);
$this->putByte($this->unknown);
$this->putSlot($this->item);*/
} }
public function eidsToGlobal(Player $p){ public function eidsToGlobal(Player $p){

View file

@ -15,7 +15,7 @@ class EntityDataPacket extends RakNetDataPacket{
return ProtocolInfo6::ENTITY_DATA_PACKET; return ProtocolInfo6::ENTITY_DATA_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9) { }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9) {
return ProtocolInfo8::ENTITY_DATA_PACKET; return ProtocolInfo8::ENTITY_DATA_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12) { }elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11) {
return ProtocolInfo9::ENTITY_DATA_PACKET; return ProtocolInfo9::ENTITY_DATA_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::ENTITY_DATA_PACKET; return ProtocolInfo12::ENTITY_DATA_PACKET;

View file

@ -12,7 +12,6 @@ class LoginPacket extends RakNetDataPacket{
} }
public function decode(){ public function decode(){
//if($this->PROTOCOL <= ProtocolInfo9::CURRENT_PROTOCOL_9)$this->reset();
$this->username = $this->getString(); $this->username = $this->getString();
$this->protocol1 = $this->getInt(); $this->protocol1 = $this->getInt();
$this->protocol2 = $this->getInt(); $this->protocol2 = $this->getInt();

View file

@ -12,7 +12,7 @@ class MessagePacket extends RakNetDataPacket{
} }
public function decode(){ 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(); $this->source = $this->getString();
}else { }else {
$this->source = ""; $this->source = "";
@ -22,7 +22,7 @@ class MessagePacket extends RakNetDataPacket{
public function encode(){ public function encode(){
$this->reset(); $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->source);
} }
$this->putString($this->message); $this->putString($this->message);

View file

@ -25,7 +25,7 @@ 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();
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(){ public function encode(){
@ -33,7 +33,7 @@ class PlayerEquipmentPacket extends RakNetDataPacket{
$this->putInt($this->eid); $this->putInt($this->eid);
$this->putShort(BlockAPI::convertHighItemIdsToOldItemIds($this->PROTOCOL, $this->item)); $this->putShort(BlockAPI::convertHighItemIdsToOldItemIds($this->PROTOCOL, $this->item));
$this->putShort($this->meta); $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){ public function eidsToGlobal(Player $p){

View file

@ -17,7 +17,7 @@ class RespawnPacket extends RakNetDataPacket{
return ProtocolInfo6::RESPAWN_PACKET; return ProtocolInfo6::RESPAWN_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::RESPAWN_PACKET; return ProtocolInfo8::RESPAWN_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){ }elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
return ProtocolInfo9::RESPAWN_PACKET; return ProtocolInfo9::RESPAWN_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::RESPAWN_PACKET; return ProtocolInfo12::RESPAWN_PACKET;

View file

@ -15,7 +15,7 @@ class SendInventoryPacket extends RakNetDataPacket{
return ProtocolInfo6::SEND_INVENTORY_PACKET; return ProtocolInfo6::SEND_INVENTORY_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::SEND_INVENTORY_PACKET; return ProtocolInfo8::SEND_INVENTORY_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){ }elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
return ProtocolInfo9::SEND_INVENTORY_PACKET; return ProtocolInfo9::SEND_INVENTORY_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::SEND_INVENTORY_PACKET; return ProtocolInfo12::SEND_INVENTORY_PACKET;

View file

@ -14,7 +14,7 @@ class SetHealthPacket extends RakNetDataPacket{
return ProtocolInfo6::SET_HEALTH_PACKET; return ProtocolInfo6::SET_HEALTH_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ }elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::SET_HEALTH_PACKET; return ProtocolInfo8::SET_HEALTH_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){ }elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11){
return ProtocolInfo9::SET_HEALTH_PACKET; return ProtocolInfo9::SET_HEALTH_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::SET_HEALTH_PACKET; return ProtocolInfo12::SET_HEALTH_PACKET;

View file

@ -8,7 +8,7 @@ class SetSpawnPositionPacket extends RakNetDataPacket{
public function pid(){ public function pid(){
if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){ if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9){
return ProtocolInfo8::SET_SPAWN_POSITION_PACKET; 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; return ProtocolInfo9::SET_SPAWN_POSITION_PACKET;
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){ }elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
return ProtocolInfo12::SET_SPAWN_POSITION_PACKET; return ProtocolInfo12::SET_SPAWN_POSITION_PACKET;