Pocketmine-MP非公式日本語wiki - サーバーに0.14.0と0.14.1両方に対応させる方法
このサーバーなんだよ、俺0.14.0だから入れねーじゃねーか

という方がいると思います。解消するにはどうすればいいか、そうですサーバーを0.14.0と0.14.1に対応させればいいのです!!

注意事項:この説明はNIGHTMARE3832氏が配布しているsrc(master)を前提に書かれています


方法

1.まずsrc>>pocketmine>>network>>protocol>>info.php を開きましょう

下のようになっていると思います
<?php

/*
 *
 *  ____            _        _   __  __ _                  __  __ ____  
 * |  _ \ ___   ___| | _____| |_|  \/  (_)_ __   ___      |  \/  |  _ \ 
 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
 * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ 
 * |_|   \___/ \___|_|\_\___|\__|_|  |_|_|_| |_|\___|     |_|  |_|_| 
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * @author PocketMine Team
 * @link http://www.pocketmine.net/
 * 
 *
*/

/**
 * Minecraft: PE multiplayer protocol implementation
 */
namespace pocketmine\network\protocol;


interface Info{

/**
 * Actual Minecraft: PE protocol version
 */
const CURRENT_PROTOCOL = 42;

const LOGIN_PACKET = 0x8f;
const PLAY_STATUS_PACKET = 0x90;
const DISCONNECT_PACKET = 0x91;
const BATCH_PACKET = 0x92;
const TEXT_PACKET = 0x93;
const SET_TIME_PACKET = 0x94;
const START_GAME_PACKET = 0x95;
const ADD_PLAYER_PACKET = 0x96;
const REMOVE_PLAYER_PACKET = 0x97;
const ADD_ENTITY_PACKET = 0x98;
const REMOVE_ENTITY_PACKET = 0x99;
const ADD_ITEM_ENTITY_PACKET = 0x9a;
const TAKE_ITEM_ENTITY_PACKET = 0x9b;
const MOVE_ENTITY_PACKET = 0x9c;
const MOVE_PLAYER_PACKET = 0x9d;
const REMOVE_BLOCK_PACKET = 0x9e;
const UPDATE_BLOCK_PACKET = 0x9f;
const ADD_PAINTING_PACKET = 0xa0;
const EXPLODE_PACKET = 0xa1;
const LEVEL_EVENT_PACKET = 0xa2;
const BLOCK_EVENT_PACKET = 0xa3;
const ENTITY_EVENT_PACKET = 0xa4;
const MOB_EFFECT_PACKET = 0xa5;
const UPDATE_ATTRIBUTES_PACKET = 0xa6;
const MOB_EQUIPMENT_PACKET = 0xa7;
const MOB_ARMOR_EQUIPMENT_PACKET = 0xa8;
const INTERACT_PACKET = 0xa9;
const USE_ITEM_PACKET = 0xaa;
const PLAYER_ACTION_PACKET = 0xab;
const HURT_ARMOR_PACKET = 0xac;
const SET_ENTITY_DATA_PACKET = 0xad;
const SET_ENTITY_MOTION_PACKET = 0xae;
const SET_ENTITY_LINK_PACKET = 0xaf;
const SET_HEALTH_PACKET = 0xb0;
const SET_SPAWN_POSITION_PACKET = 0xb1;
const ANIMATE_PACKET = 0xb2;
const RESPAWN_PACKET = 0xb3;
const DROP_ITEM_PACKET = 0xb4;
const CONTAINER_OPEN_PACKET = 0xb5;
const CONTAINER_CLOSE_PACKET = 0xb6;
const CONTAINER_SET_SLOT_PACKET = 0xb7;
const CONTAINER_SET_DATA_PACKET = 0xb8;
const CONTAINER_SET_CONTENT_PACKET = 0xb9;
const CRAFTING_DATA_PACKET = 0xba;
const CRAFTING_EVENT_PACKET = 0xbb;
const ADVENTURE_SETTINGS_PACKET = 0xbc;
const BLOCK_ENTITY_DATA_PACKET = 0xbd;
//const PLAYER_INPUT_PACKET = 0xbe;
const FULL_CHUNK_DATA_PACKET = 0xbf;
const SET_DIFFICULTY_PACKET = 0xc0;
//const CHANGE_DIMENSION_PACKET = 0xc1;
const SET_PLAYER_GAMETYPE_PACKET = 0xc2;
const PLAYER_LIST_PACKET = 0xc3;
//const TELEMETRY_EVENT_PACKET = 0xc4;
//const SPAWN_EXPERIENCE_ORB_PACKET = 0xc5
const TILE_EVENT_PACKET = 0xa3;
const TILE_ENTITY_DATA_PACKET = 0xbd;
}
2.そしたら33行目
const CURRENT_PROTOCOL = 42;
となっているところで42を45にしましょう
下のようになるはずです
<?php

/*
 *
 *  ____            _        _   __  __ _                  __  __ ____  
 * |  _ \ ___   ___| | _____| |_|  \/  (_)_ __   ___      |  \/  |  _ \ 
 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
 * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ 
 * |_|   \___/ \___|_|\_\___|\__|_|  |_|_|_| |_|\___|     |_|  |_|_| 
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * @author PocketMine Team
 * @link http://www.pocketmine.net/
 * 
 *
*/

/**
 * Minecraft: PE multiplayer protocol implementation
 */
namespace pocketmine\network\protocol;


interface Info{

/**
 * Actual Minecraft: PE protocol version
 */
const CURRENT_PROTOCOL = 45;

const LOGIN_PACKET = 0x8f;
const PLAY_STATUS_PACKET = 0x90;
const DISCONNECT_PACKET = 0x91;
const BATCH_PACKET = 0x92;
const TEXT_PACKET = 0x93;
const SET_TIME_PACKET = 0x94;
const START_GAME_PACKET = 0x95;
const ADD_PLAYER_PACKET = 0x96;
const REMOVE_PLAYER_PACKET = 0x97;
const ADD_ENTITY_PACKET = 0x98;
const REMOVE_ENTITY_PACKET = 0x99;
const ADD_ITEM_ENTITY_PACKET = 0x9a;
const TAKE_ITEM_ENTITY_PACKET = 0x9b;
const MOVE_ENTITY_PACKET = 0x9c;
const MOVE_PLAYER_PACKET = 0x9d;
const REMOVE_BLOCK_PACKET = 0x9e;
const UPDATE_BLOCK_PACKET = 0x9f;
const ADD_PAINTING_PACKET = 0xa0;
const EXPLODE_PACKET = 0xa1;
const LEVEL_EVENT_PACKET = 0xa2;
const BLOCK_EVENT_PACKET = 0xa3;
const ENTITY_EVENT_PACKET = 0xa4;
const MOB_EFFECT_PACKET = 0xa5;
const UPDATE_ATTRIBUTES_PACKET = 0xa6;
const MOB_EQUIPMENT_PACKET = 0xa7;
const MOB_ARMOR_EQUIPMENT_PACKET = 0xa8;
const INTERACT_PACKET = 0xa9;
const USE_ITEM_PACKET = 0xaa;
const PLAYER_ACTION_PACKET = 0xab;
const HURT_ARMOR_PACKET = 0xac;
const SET_ENTITY_DATA_PACKET = 0xad;
const SET_ENTITY_MOTION_PACKET = 0xae;
const SET_ENTITY_LINK_PACKET = 0xaf;
const SET_HEALTH_PACKET = 0xb0;
const SET_SPAWN_POSITION_PACKET = 0xb1;
const ANIMATE_PACKET = 0xb2;
const RESPAWN_PACKET = 0xb3;
const DROP_ITEM_PACKET = 0xb4;
const CONTAINER_OPEN_PACKET = 0xb5;
const CONTAINER_CLOSE_PACKET = 0xb6;
const CONTAINER_SET_SLOT_PACKET = 0xb7;
const CONTAINER_SET_DATA_PACKET = 0xb8;
const CONTAINER_SET_CONTENT_PACKET = 0xb9;
const CRAFTING_DATA_PACKET = 0xba;
const CRAFTING_EVENT_PACKET = 0xbb;
const ADVENTURE_SETTINGS_PACKET = 0xbc;
const BLOCK_ENTITY_DATA_PACKET = 0xbd;
//const PLAYER_INPUT_PACKET = 0xbe;
const FULL_CHUNK_DATA_PACKET = 0xbf;
const SET_DIFFICULTY_PACKET = 0xc0;
//const CHANGE_DIMENSION_PACKET = 0xc1;
const SET_PLAYER_GAMETYPE_PACKET = 0xc2;
const PLAYER_LIST_PACKET = 0xc3;
//const TELEMETRY_EVENT_PACKET = 0xc4;
//const SPAWN_EXPERIENCE_ORB_PACKET = 0xc5
const TILE_EVENT_PACKET = 0xa3;
const TILE_ENTITY_DATA_PACKET = 0xbd;
}
ただしこのままでは0.14.0が入れるようになっただけです
なのでここから0.14.1でも入れるようにしていきます

では次にsrc>>pocketmine>>player.phpを開きましょう
(1900行目から表示しているため行数を書いています)
1900 if($packet->protocol1 !== ProtocolInfo::CURRENT_PROTOCOL){
1901 if($packet->protocol1 < ProtocolInfo::CURRENT_PROTOCOL){
1902 $message = "disconnectionScreen.outdatedClient";
1903 
1904 $pk = new PlayStatusPacket();
1905 $pk->status = PlayStatusPacket::LOGIN_FAILED_CLIENT;
1906 $this->directDataPacket($pk);
1907 }else{
1908 $message = "disconnectionScreen.outdatedServer";
1909 
1910 $pk = new PlayStatusPacket();
1911 $pk->status = PlayStatusPacket::LOGIN_FAILED_SERVER;
1912 $this->directDataPacket($pk);
1913 }
1914 $this->close("", $message, false);
1915 
1916 break;
1917 }

1900,1901行を少しいじります
1900 if($packet->protocol1 !== ProtocolInfo::CURRENT_PROTOCOL){
1901 if($packet->protocol1 < ProtocolInfo::CURRENT_PROTOCOL){
この部分を
1900 if($packet->protocol1 === ProtocolInfo::CURRENT_PROTOCOL || $packet->protocol1  === 46){
1901 }else{
1902 if($packet->protocol1 < ProtocolInfo::CURRENT_PROTOCOL){
と書き換えてください

1900 if($packet->protocol1 === ProtocolInfo::CURRENT_PROTOCOL || $packet->protocol1  === 46){
1901 }else{
1902 if($packet->protocol1 < ProtocolInfo::CURRENT_PROTOCOL){
1903 $message = "disconnectionScreen.outdatedClient";
1904 
1905 $pk = new PlayStatusPacket();
1906 $pk->status = PlayStatusPacket::LOGIN_FAILED_CLIENT;
1907 $this->directDataPacket($pk);
1908 }else{
1909 $message = "disconnectionScreen.outdatedServer";
1910 
1911 $pk = new PlayStatusPacket();
1912 $pk->status = PlayStatusPacket::LOGIN_FAILED_SERVER;
1913 $this->directDataPacket($pk);
1914 }
1915 $this->close("", $message, false);
1916 
1917 break;
1918 }
となるはずです
これで0.14.0,0.14.1両対応できました
最後にマイクラ画面での表示が変わるようにしましょう

src>>pocketmine>>pocketmine.php を開きましょう
下のようになっています
56 const VERSION = '1.8dev';
57 const API_VERSION = "1.14.0";
58 const CODENAME = "[NIGHTMARE]";
59 const MINECRAFT_VERSION = "v0.14.0 alpha";
60 const MINECRAFT_VERSION_NETWORK = "0.14.0";
下のように書き直してください
56 const VERSION = '1.8dev';
57 const API_VERSION = "1.14.0";
58 const CODENAME = "[NIGHTMARE]";
59 const MINECRAFT_VERSION = "v0.14.X alpha";
60 const MINECRAFT_VERSION_NETWORK = "0.14.0.0.14.1";


これで完成ですお疲れ様でした



当ページについて

記事タイトルサーバーに0.14.0と0.14.1両方に対応させる方法
記事編集ken77731