Support MCPI

This commit is contained in:
yefengeeeeeeeeeee 2026-07-12 18:47:38 +08:00
parent 0fefb140f4
commit 426fd93cb6
3 changed files with 40 additions and 2 deletions

View file

@ -4,7 +4,7 @@
NostalgiaCore is a fork of Legacy PocketMine-MP 1.3.12, which fixes bugs of Legacy PocketMine-MP, and adds new content
Supported MCPE versions: 0.3.0 ~ 0.8.1 (maybe 0.8.2)
Supported MCPI & MCPE versions: 0.3.0 ~ 0.8.1 (maybe 0.8.2)
(Special thx to GullCraft Network and DartMiner43)

View file

@ -3595,6 +3595,44 @@ class Player{
}
}
break;
case ProtocolInfo::CHAT_PACKET:
if($this->spawned === false){
break;
}
$this->craftingItems = [];
$this->toCraft = [];
$this->craftingType = CraftingRecipes::TYPE_INVENTORY;
if(trim($packet->message) != "" and strlen($packet->message) <= 255){
$message = $packet->message;
if($message[0] === "/"){ //Command
if($this instanceof Player){
console("[DEBUG] " . FORMAT_AQUA . $this->username . FORMAT_RESET . " issued server command: " . $message);
}else{
console("[DEBUG] " . FORMAT_YELLOW . "*" . $this . FORMAT_RESET . " issued server command: " . $message);
}
$this->server->api->console->run(substr($message, 1), $this);
}else{
$data = ["player" => $this, "message" => $message];
if(Player::$disableEmojisInChat && Utils::hasEmoji($data["message"])){
$this->sendChat("Your message contains illegal characters");
break;
}
//if($message == "pf"){
// Living::$pathfind = !Living::$pathfind;
//}
if($this->server->api->handle("player.chat", $data) !== false){
$this->server->send2Discord("<" . $this->username . "> " . $message);
if(isset($data["message"])){
$this->server->api->chat->send($this, $data["message"]);
}else{
$this->server->api->chat->send($this, $message);
}
}
}
}
break;
case ProtocolInfo::CONTAINER_CLOSE_PACKET:
if($this->spawned === false){
break;

View file

@ -17,7 +17,7 @@ class ChatPacket extends RakNetDataPacket{
}
public function decode(){
console($this->getString());
$this->message = $this->getString();
}
public function encode(){