From 2bfb67d1059964d748a770f7144dacc0a2ccfd73 Mon Sep 17 00:00:00 2001
From: GameHerobrine <55945072+GameHerobrine@users.noreply.github.com>
Date: Tue, 21 Feb 2023 16:08:20 +0300
Subject: [PATCH 1/2] Update README.md
---
README.md | 24 +++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)
diff --git a/README.md b/README.md
index 47f996e1..d230f8df 100644
--- a/README.md
+++ b/README.md
@@ -4,30 +4,12 @@
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.8.0, 0.8.1 (maybe 0.8.2)
+Supported MCPE versions: 0.9.5 and maybe other 0.9.x versions
(Special thx to GullCraft Network and DartMiner43)
-
Why should you use NostalgiaCore to run a Minecraft Pocket Edition 0.8.1 server?
-
-• Items are dropping normally.
-
-• Dupes, that were in PocketMine by mistake are fixed.
-
-• Player hotbar is saved.
-
-• Extra options (like in-game messages to discord)
-
-• Vector2 is fixed.
-
-• Working Nether Reactor.
-
-• PHAR plugins support
-
-• Mob AI
-
-...and etc.
-
+ Why should you use NostalgiaCore to run a Minecraft Pocket Edition 0.9.5 server?
+You should not use it now.
Download Stable NostalgiaCore
https://github.com/kotyaralih/NostalgiaCore/releases/
From 1ecbc1d3089417357df6fd49086f9f79cb5cf6f0 Mon Sep 17 00:00:00 2001
From: GameHerobrine
Date: Tue, 21 Feb 2023 16:25:34 +0300
Subject: [PATCH 2/2] fixes related to packets and entities
---
src/Player.php | 9 ++++-----
src/entity/Entity.php | 13 +++++--------
src/entity/ai/EntityAI.php | 2 +-
src/material/block/GenericBlock.php | 1 +
src/network/protocol/packet/UpdateBlockPacket.php | 1 -
src/network/protocol/packet/UseItemPacket.php | 2 +-
6 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/src/Player.php b/src/Player.php
index e71d31a5..a7ffee7c 100755
--- a/src/Player.php
+++ b/src/Player.php
@@ -1266,7 +1266,6 @@ class Player{
if(EventHandler::callEvent(new DataPacketReceiveEvent($this, $packet)) === BaseEvent::DENY){
return;
}
-
switch($packet->pid()){
case 0x01:
break;
@@ -1359,8 +1358,6 @@ class Player{
return;
}
- $this->server->send2Discord($this->username . " joined the game");
-
$this->auth = true;
if(!$this->data->exists("inventory") or ($this->gamemode & 0x01) === 0x01){
if(($this->gamemode & 0x01) === 0x01){
@@ -1610,7 +1607,10 @@ class Player{
//$this->lastChunk = [$packet->chunkX, $packet->chunkZ];
break;
case ProtocolInfo::UPDATE_BLOCK_PACKET:
- $this->level->setBlock(new Vector3($packet->x, $packet->y, $packet->z), BlockAPI::get($packet->block, $packet->meta));
+ if($this->gamemode & 0x01 === 0){
+ $this->level->setBlock(new Vector3($packet->x, $packet->y, $packet->z), BlockAPI::get($packet->block, $packet->meta));
+ }
+
break;
case ProtocolInfo::USE_ITEM_PACKET:
if(!($this->entity instanceof Entity)){
@@ -1658,7 +1658,6 @@ class Player{
$data["posX"] = $packet->posX;
$data["posY"] = $packet->posY;
$data["posZ"] = $packet->posZ;
-
if($packet->face >= 0 and $packet->face <= 5){ //Use Block, place
if($this->entity->inAction === true){
$this->entity->inAction = false;
diff --git a/src/entity/Entity.php b/src/entity/Entity.php
index fb8fbb37..37e99346 100644
--- a/src/entity/Entity.php
+++ b/src/entity/Entity.php
@@ -628,9 +628,9 @@ class Entity extends Position
$fall = $this->level->getBlock(new Vector3(intval($this->x - 0.5), intval(ceil($this->y)), intval($this->z - 0.5)));
$down = $this->level->getBlock(new Vector3(intval($this->x - 0.5), intval(ceil($this->y) - 1), intval($this->z - 0.5)));
if($fall->isFullBlock === false or $down->isFullBlock === false){
- $this->server->api->entity->drop($this, BlockAPI::getItem($this->data["Tile"] & 0xFFFF, 0, 1), true);
+ $this->server->api->entity->drop($this, BlockAPI::getItem($this->data["Tile"] & 0xFFFF, $this->data["Metadata"], 1), true);
} else{
- $this->level->setBlock($fall, BlockAPI::get($this->data["Tile"]), true, false, true);
+ $this->level->setBlock($fall, BlockAPI::get($this->data["Tile"], $this->data["Metadata"]), true, false, true);
}
$this->server->api->handle("entity.motion", $this);
$this->close();
@@ -969,13 +969,13 @@ class Entity extends Position
$player->dataPacket($pk);
break;
case ENTITY_FALLING:
- $pk = new AddEntityPacket();
+ $pk = new AddEntityPacket(); //TODO fix
$pk->eid = $this->eid;
$pk->type = $this->type;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
- $pk->did = - $this->data["Tile"];
+ $pk->did = -($this->data["Tile"] | $this->data["Metadata"] << 0x10);
$player->dataPacket($pk);
$pk = new SetEntityMotionPacket();
@@ -1251,10 +1251,7 @@ class Entity extends Position
public function sendMotion()
{
$pk = new SetEntityMotionPacket();
- $pk->eid = $this->eid;
- $pk->speedX = $this->speedX;
- $pk->speedY = $this->speedY;
- $pk->speedZ = $this->speedZ;
+ $pk->entities = [[$this->eid, $this->speedX, $this->speedY, $this->speedZ]];
$this->server->api->player->broadcastPacket($this->level->players, $pk);
}
diff --git a/src/entity/ai/EntityAI.php b/src/entity/ai/EntityAI.php
index 96ff9c09..14a4648c 100644
--- a/src/entity/ai/EntityAI.php
+++ b/src/entity/ai/EntityAI.php
@@ -55,7 +55,7 @@ class EntityAI
}
public function updateTasks(){
- if(!isset($entity) or !($this->entity instanceof Entity)){
+ if(!isset($this->entity) or !($this->entity instanceof Entity)){
return;
}
foreach($this->tasks as $t){
diff --git a/src/material/block/GenericBlock.php b/src/material/block/GenericBlock.php
index 7fbb33a2..ba5ffaa2 100644
--- a/src/material/block/GenericBlock.php
+++ b/src/material/block/GenericBlock.php
@@ -61,6 +61,7 @@ class GenericBlock extends Block{
"y" => $this->y + 0.5,
"z" => $this->z + 0.5,
"Tile" => $this->id,
+ "Metadata" => $this->getMetadata()
);
$server = ServerAPI::request();
$this->level->setBlock($this, new AirBlock(), false, false, true);
diff --git a/src/network/protocol/packet/UpdateBlockPacket.php b/src/network/protocol/packet/UpdateBlockPacket.php
index 020fc63b..230e969b 100644
--- a/src/network/protocol/packet/UpdateBlockPacket.php
+++ b/src/network/protocol/packet/UpdateBlockPacket.php
@@ -12,7 +12,6 @@ class UpdateBlockPacket extends RakNetDataPacket{
}
public function decode(){
-
}
public function encode(){
diff --git a/src/network/protocol/packet/UseItemPacket.php b/src/network/protocol/packet/UseItemPacket.php
index 0136ed5b..b4807724 100644
--- a/src/network/protocol/packet/UseItemPacket.php
+++ b/src/network/protocol/packet/UseItemPacket.php
@@ -25,7 +25,7 @@ class UseItemPacket extends RakNetDataPacket{
$this->z = $this->getInt();
$this->face = $this->getInt();
$this->item = $this->getShort();
- $this->meta = $this->getByte(); //Mojang: fix this
+ $this->meta = $this->getShort();
$this->eid = $this->getInt();
$this->fx = $this->getFloat();
$this->fy = $this->getFloat();