diff --git a/README.md b/README.md index 07d2bf03..3f6be009 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ 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.9.5 and maybe other 0.9.x versions +Supported MCPE versions: 0.10.x (Special thx to GullCraft Network and DartMiner43) -

Why should you use NostalgiaCore to run a Minecraft Pocket Edition 0.9.5 server?

+

Why should you use NostalgiaCore to run a Minecraft Pocket Edition 0.10.x server?

You should not use it now.

Download Stable NostalgiaCore

diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index f71346c1..1550a6ba 100755 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -141,7 +141,17 @@ class BlockAPI{ [WOODEN_DOOR, 0], [TRAPDOOR, 0], [FENCE, 0], + [FENCE, 1], + [FENCE, 2], + [FENCE, 3], + [FENCE, 4], + [FENCE, 5], [FENCE_GATE, 0], + [SPRUCE_FENCE_GATE, 0], + [BIRCH_FENCE_GATE, 0], + [JUNGLE_FENCE_GATE, 0], + [ACACIA_FENCE_GATE, 0], + [DARK_OAK_FENCE_GATE, 0], [IRON_BARS, 0], [BED, 0], [BOOKSHELF, 0], diff --git a/src/Player.php b/src/Player.php index 97d45111..b33b5c21 100755 --- a/src/Player.php +++ b/src/Player.php @@ -278,7 +278,6 @@ class Player{ if($this->connected === false){ return false; } - if(EventHandler::callEvent(new DataPacketSendEvent($this, $packet)) === BaseEvent::DENY){ return; } diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index 34fa1b4c..427cca2e 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -227,7 +227,7 @@ class PocketMinecraftServer{ "url" => $url, "data" => [ "username" => $name, - "content" => $this->extraprops->get("discord-ru-smiles") ? str_replace("@", " ", str_replace("Û", "<:imp_cool:1151085500396998719>", str_replace("Ü", "<:imp_badphp5:1151085478410457120>", str_replace("Ú", "<:imp_gudjava:1151085431962742784>", str_replace("¨", "<:imp_wut:1151085524241621012>", $msg))))) : str_replace("@", "", $msg) + "content" => $this->extraprops->get("discord-ru-smiles") ? str_replace("@", " ", str_replace("�", "<:imp_cool:1151085500396998719>", str_replace("�", "<:imp_badphp5:1151085478410457120>", str_replace("�", "<:imp_gudjava:1151085431962742784>", str_replace("�", "<:imp_wut:1151085524241621012>", $msg))))) : str_replace("@", "", $msg) ], ], null); } diff --git a/src/config.php b/src/config.php index cc63e55a..b87c3fb9 100644 --- a/src/config.php +++ b/src/config.php @@ -48,9 +48,9 @@ set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH); ini_set("memory_limit", "256M"); //Default define("LOG", true); define("START_TIME", microtime(true)); -define("MAJOR_VERSION", "2.0.0dev"); -define("CODENAME", "Breadfence"); //i'm not very creative - kotyaralih -define("CURRENT_MINECRAFT_VERSION", "v0.9.5 alpha"); +define("MAJOR_VERSION", "3.0.0dev"); +define("CODENAME", "Pumpkin Pie"); //i'm not very creative - kotyaralih +define("CURRENT_MINECRAFT_VERSION", "v0.10.5 alpha"); define("CURRENT_API_VERSION", '13.1'); define("CURRENT_PHP_VERSION", "8.0"); $gitsha1 = false; diff --git a/src/constants/BlockIDs.php b/src/constants/BlockIDs.php index 2651f043..d4771437 100755 --- a/src/constants/BlockIDs.php +++ b/src/constants/BlockIDs.php @@ -159,6 +159,11 @@ define("REEDS", 83); define("SUGARCANE_BLOCK", 83); define("FENCE", 85); +define("SPRUCE_FENCE", "85:1"); +define("BIRCH_FENCE", "85:2"); +define("JUNGLE_FENCE", "85:3"); +define("ACACIA_FENCE", "85:4"); +define("DARK_OAK_FENCE", "85:5"); define("PUMPKIN", 86); define("NETHERRACK", 87); define("SOUL_SAND", 88); @@ -186,6 +191,11 @@ define("PUMPKIN_STEM", 104); define("MELON_STEM", 105); define("VINES", 106); define("FENCE_GATE", 107); +define("SPRUCE_FENCE_GATE", 183); +define("BIRCH_FENCE_GATE", 184); +define("JUNGLE_FENCE_GATE", 185); +define("ACACIA_FENCE_GATE", 186); +define("DARK_OAK_FENCE_GATE", 187); define("BRICK_STAIRS", 108); define("STONE_BRICK_STAIRS", 109); define("MYCELIUM", 110); diff --git a/src/entity/Entity.php b/src/entity/Entity.php index e30e6cf5..1369c044 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -785,7 +785,6 @@ class Entity extends Position $pk->bodyYaw = $this->yaw; $this->server->api->player->broadcastPacket($players, $pk); } else{ - $pk = new MoveEntityPacket; $pk->entities = [[$this->eid, $this->x, $this->y, $this->z, $this->yaw, $this->pitch]]; $this->server->api->player->broadcastPacket($players, $pk); diff --git a/src/material/Block.php b/src/material/Block.php index 4ea821be..62fae68d 100755 --- a/src/material/Block.php +++ b/src/material/Block.php @@ -152,6 +152,11 @@ abstract class Block extends Position{ STAINED_CLAY => "StainedClayBlock", LILY_PAD => "LilypadBlock", DOUBLE_PLANT => "DoubleTallGrass", + SPRUCE_FENCE_GATE => "SpruceFenceGateBlock", + BIRCH_FENCE_GATE => "BirchFenceGateBlock", + JUNGLE_FENCE_GATE => "JungleFenceGateBlock", + ACACIA_FENCE_GATE => "AcaciaFenceGateBlock", + DARK_OAK_FENCE_GATE => "DarkOakFenceGateBlock" ); protected $id; protected $meta; diff --git a/src/material/block/nonfull/AcaciaFenceGateBlock.php b/src/material/block/nonfull/AcaciaFenceGateBlock.php new file mode 100644 index 00000000..244af041 --- /dev/null +++ b/src/material/block/nonfull/AcaciaFenceGateBlock.php @@ -0,0 +1,44 @@ +isActivable = true; + if(($this->meta & 0x04) === 0x04){ + $this->isFullBlock = true; + }else{ + $this->isFullBlock = false; + } + $this->hardness = 15; + } + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + $faces = array( + 0 => 3, + 1 => 0, + 2 => 1, + 3 => 2, + ); + $this->meta = $faces[$player->entity->getDirection()] & 0x03; + $this->level->setBlock($block, $this, true, false, true); + return true; + } + public function getDrops(Item $item, Player $player){ + return array( + array($this->id, 0, 1), + ); + } + public function onActivate(Item $item, Player $player){ + $this->meta ^= 0x04; + $this->level->setBlock($this, $this, true, false, true); + $players = ServerAPI::request()->api->player->getAll($this->level); + unset($players[$player->CID]); + $pk = new LevelEventPacket; + $pk->x = $this->x; + $pk->y = $this->y; + $pk->z = $this->z; + $pk->evid = 1003; + $pk->data = 0; + ServerAPI::request()->api->player->broadcastPacket($players, $pk); + return true; + } +} diff --git a/src/material/block/nonfull/BirchFenceGateBlock.php b/src/material/block/nonfull/BirchFenceGateBlock.php new file mode 100644 index 00000000..3f31de1a --- /dev/null +++ b/src/material/block/nonfull/BirchFenceGateBlock.php @@ -0,0 +1,44 @@ +isActivable = true; + if(($this->meta & 0x04) === 0x04){ + $this->isFullBlock = true; + }else{ + $this->isFullBlock = false; + } + $this->hardness = 15; + } + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + $faces = array( + 0 => 3, + 1 => 0, + 2 => 1, + 3 => 2, + ); + $this->meta = $faces[$player->entity->getDirection()] & 0x03; + $this->level->setBlock($block, $this, true, false, true); + return true; + } + public function getDrops(Item $item, Player $player){ + return array( + array($this->id, 0, 1), + ); + } + public function onActivate(Item $item, Player $player){ + $this->meta ^= 0x04; + $this->level->setBlock($this, $this, true, false, true); + $players = ServerAPI::request()->api->player->getAll($this->level); + unset($players[$player->CID]); + $pk = new LevelEventPacket; + $pk->x = $this->x; + $pk->y = $this->y; + $pk->z = $this->z; + $pk->evid = 1003; + $pk->data = 0; + ServerAPI::request()->api->player->broadcastPacket($players, $pk); + return true; + } +} diff --git a/src/material/block/nonfull/DarkOakFenceGateBlock.php b/src/material/block/nonfull/DarkOakFenceGateBlock.php new file mode 100644 index 00000000..94f21070 --- /dev/null +++ b/src/material/block/nonfull/DarkOakFenceGateBlock.php @@ -0,0 +1,44 @@ +isActivable = true; + if(($this->meta & 0x04) === 0x04){ + $this->isFullBlock = true; + }else{ + $this->isFullBlock = false; + } + $this->hardness = 15; + } + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + $faces = array( + 0 => 3, + 1 => 0, + 2 => 1, + 3 => 2, + ); + $this->meta = $faces[$player->entity->getDirection()] & 0x03; + $this->level->setBlock($block, $this, true, false, true); + return true; + } + public function getDrops(Item $item, Player $player){ + return array( + array($this->id, 0, 1), + ); + } + public function onActivate(Item $item, Player $player){ + $this->meta ^= 0x04; + $this->level->setBlock($this, $this, true, false, true); + $players = ServerAPI::request()->api->player->getAll($this->level); + unset($players[$player->CID]); + $pk = new LevelEventPacket; + $pk->x = $this->x; + $pk->y = $this->y; + $pk->z = $this->z; + $pk->evid = 1003; + $pk->data = 0; + ServerAPI::request()->api->player->broadcastPacket($players, $pk); + return true; + } +} diff --git a/src/material/block/nonfull/FenceBlock.php b/src/material/block/nonfull/FenceBlock.php index 50e1d6cc..f38f7bf1 100644 --- a/src/material/block/nonfull/FenceBlock.php +++ b/src/material/block/nonfull/FenceBlock.php @@ -1,8 +1,17 @@ "Oak Fence", + 1 => "Spruce Fence", + 2 => "Birch Fence", + 3 => "Jungle Fence", + 4 => "Acacia Fence", + 5 => "Dark Oak Fence" + ]; + $this->name = $names[$this->meta & 0x07]; $this->isFullBlock = false; $this->hardness = 15; } diff --git a/src/material/block/nonfull/JungleFenceGateBlock.php b/src/material/block/nonfull/JungleFenceGateBlock.php new file mode 100644 index 00000000..28b346d4 --- /dev/null +++ b/src/material/block/nonfull/JungleFenceGateBlock.php @@ -0,0 +1,44 @@ +isActivable = true; + if(($this->meta & 0x04) === 0x04){ + $this->isFullBlock = true; + }else{ + $this->isFullBlock = false; + } + $this->hardness = 15; + } + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + $faces = array( + 0 => 3, + 1 => 0, + 2 => 1, + 3 => 2, + ); + $this->meta = $faces[$player->entity->getDirection()] & 0x03; + $this->level->setBlock($block, $this, true, false, true); + return true; + } + public function getDrops(Item $item, Player $player){ + return array( + array($this->id, 0, 1), + ); + } + public function onActivate(Item $item, Player $player){ + $this->meta ^= 0x04; + $this->level->setBlock($this, $this, true, false, true); + $players = ServerAPI::request()->api->player->getAll($this->level); + unset($players[$player->CID]); + $pk = new LevelEventPacket; + $pk->x = $this->x; + $pk->y = $this->y; + $pk->z = $this->z; + $pk->evid = 1003; + $pk->data = 0; + ServerAPI::request()->api->player->broadcastPacket($players, $pk); + return true; + } +} diff --git a/src/material/block/nonfull/SpruceFenceGateBlock.php b/src/material/block/nonfull/SpruceFenceGateBlock.php new file mode 100644 index 00000000..2b7f6720 --- /dev/null +++ b/src/material/block/nonfull/SpruceFenceGateBlock.php @@ -0,0 +1,44 @@ +isActivable = true; + if(($this->meta & 0x04) === 0x04){ + $this->isFullBlock = true; + }else{ + $this->isFullBlock = false; + } + $this->hardness = 15; + } + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + $faces = array( + 0 => 3, + 1 => 0, + 2 => 1, + 3 => 2, + ); + $this->meta = $faces[$player->entity->getDirection()] & 0x03; + $this->level->setBlock($block, $this, true, false, true); + return true; + } + public function getDrops(Item $item, Player $player){ + return array( + array($this->id, 0, 1), + ); + } + public function onActivate(Item $item, Player $player){ + $this->meta ^= 0x04; + $this->level->setBlock($this, $this, true, false, true); + $players = ServerAPI::request()->api->player->getAll($this->level); + unset($players[$player->CID]); + $pk = new LevelEventPacket; + $pk->x = $this->x; + $pk->y = $this->y; + $pk->z = $this->z; + $pk->evid = 1003; + $pk->data = 0; + ServerAPI::request()->api->player->broadcastPacket($players, $pk); + return true; + } +} diff --git a/src/network/protocol/ProtocolInfo.php b/src/network/protocol/ProtocolInfo.php index d59cb9e2..e8331bc1 100644 --- a/src/network/protocol/ProtocolInfo.php +++ b/src/network/protocol/ProtocolInfo.php @@ -1,7 +1,7 @@ x = $this->getInt(); $this->y = $this->getInt(); $this->z = $this->getInt(); - $this->face = $this->getInt(); + $this->face = $this->getByte(); $this->item = $this->getShort(); $this->meta = $this->getShort(); $this->eid = $this->getInt(); diff --git a/src/recipes/CraftingRecipes.php b/src/recipes/CraftingRecipes.php index 666719f9..3dad0cd4 100644 --- a/src/recipes/CraftingRecipes.php +++ b/src/recipes/CraftingRecipes.php @@ -92,8 +92,18 @@ class CraftingRecipes{ //Building "WOOL:?x3,WOODEN_PLANKS:?x3=>BED:0x1", "WOODEN_PLANKS:?x8=>CHEST:0x1", - "STICK:?x6=>FENCE:0x2", - "STICK:?x4,WOODEN_PLANKS:?x2=>FENCE_GATE:0x1", + "STICK:?x2,WOODEN_PLANKS:0x4=>FENCE:0x3", + "STICK:?x2,WOODEN_PLANKS:1x4=>FENCE:1x3", + "STICK:?x2,WOODEN_PLANKS:2x4=>FENCE:2x3", + "STICK:?x2,WOODEN_PLANKS:3x4=>FENCE:3x3", + "STICK:?x2,WOODEN_PLANKS:4x4=>FENCE:4x3", + "STICK:?x2,WOODEN_PLANKS:5x4=>FENCE:5x3", + "STICK:?x4,WOODEN_PLANKS:0x2=>FENCE_GATE:0x1", + "STICK:?x4,WOODEN_PLANKS:1x2=>SPRUCE_FENCE_GATE:0x1", + "STICK:?x4,WOODEN_PLANKS:2x2=>BIRCH_FENCE_GATE:0x1", + "STICK:?x4,WOODEN_PLANKS:3x2=>JUNGLE_FENCE_GATE:0x1", + "STICK:?x4,WOODEN_PLANKS:4x2=>ACACIA_FENCE_GATE:0x1", + "STICK:?x4,WOODEN_PLANKS:5x2=>DARK_OAK_FENCE_GATE:0x1", "COBBLESTONE:?x8=>FURNACE:0x1", "GLASS:?x6=>GLASS_PANE:0x16", "STICK:?x7=>LADDER:0x2", diff --git a/src/recipes/FuelData.php b/src/recipes/FuelData.php index e0c61bab..e476cdbc 100644 --- a/src/recipes/FuelData.php +++ b/src/recipes/FuelData.php @@ -16,6 +16,11 @@ class FuelData{ STICK => 5, FENCE => 15, FENCE_GATE => 15, + SPRUCE_FENCE_GATE => 15, + BIRCH_FENCE_GATE => 15, + JUNGLE_FENCE_GATE => 15, + ACACIA_FENCE_GATE => 15, + DARK_OAK_FENCE_GATE => 15, WOODEN_STAIRS => 15, SPRUCE_WOOD_STAIRS => 15, BIRCH_WOOD_STAIRS => 15,