Merge branch 'mc-0-10' into 0.9.5

This commit is contained in:
GameHerobrine 2023-12-10 00:23:20 +03:00 • committed by GitHub
commit f783b13be6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 281 additions and 14 deletions

View file

@ -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)
<h2> Why should you use NostalgiaCore to run a Minecraft Pocket Edition 0.9.5 server?</h2>
<h2> Why should you use NostalgiaCore to run a Minecraft Pocket Edition 0.10.x server?</h2>
You should not use it now.
<h3> Download Stable NostalgiaCore</h3>

View file

@ -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],

View file

@ -278,7 +278,6 @@ class Player{
if($this->connected === false){
return false;
}
if(EventHandler::callEvent(new DataPacketSendEvent($this, $packet)) === BaseEvent::DENY){
return;
}

View file

@ -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("<EFBFBD>", "<:imp_cool:1151085500396998719>", str_replace("<EFBFBD>", "<:imp_badphp5:1151085478410457120>", str_replace("<EFBFBD>", "<:imp_gudjava:1151085431962742784>", str_replace("<EFBFBD>", "<:imp_wut:1151085524241621012>", $msg))))) : str_replace("@", "", $msg)
],
], null);
}

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -0,0 +1,44 @@
<?php
class AcaciaFenceGateBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(ACACIA_FENCE_GATE, $meta, "Acacia Fence Gate");
$this->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;
}
}

View file

@ -0,0 +1,44 @@
<?php
class BirchFenceGateBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(BIRCH_FENCE_GATE, $meta, "Birch Fence Gate");
$this->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;
}
}

View file

@ -0,0 +1,44 @@
<?php
class DarkOakFenceGateBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(DARK_OAK_FENCE_GATE, $meta, "Dark Oak Fence Gate");
$this->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;
}
}

View file

@ -1,8 +1,17 @@
<?php
class FenceBlock extends TransparentBlock{
public function __construct(){
parent::__construct(FENCE, 0, "Fence");
public function __construct($meta){
parent::__construct(FENCE, $meta, "Fence");
$names = [
0 => "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;
}

View file

@ -0,0 +1,44 @@
<?php
class JungleFenceGateBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(JUNGLE_FENCE_GATE, $meta, "Jungle Fence Gate");
$this->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;
}
}

View file

@ -0,0 +1,44 @@
<?php
class SpruceFenceGateBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(SPRUCE_FENCE_GATE, $meta, "Spruce Fence Gate");
$this->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;
}
}

View file

@ -1,7 +1,7 @@
<?php
abstract class ProtocolInfo{
const CURRENT_PROTOCOL = 18;
const CURRENT_PROTOCOL = 20;
const PING_PACKET = 0x00;

View file

@ -23,7 +23,7 @@ class UseItemPacket extends RakNetDataPacket{
$this->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();

View file

@ -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",

View file

@ -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,