Skip to content

Commit

Permalink
feat: 1.20.80 support (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt05 authored Apr 24, 2024
1 parent f6bf45d commit ce473e7
Show file tree
Hide file tree
Showing 20 changed files with 127 additions and 55 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center">
<img src="https://github.com/Benedikt05/BetterAltay/blob/master/.github/logo.png"></img><br>
<b>A feature-rich server software for Minecraft: BE. This is a Fork of </b><a href="https://github.com/pmmp/PocketMine-MP/tree/3.28.0">PocketMine-MP</a><b> and </b><a href="https://github.com/unresolved3169/Altay">Altay</a><br><br>This fork was created due to the inactivity of Altay.
It contains support for Minecraft: Bedrock Edition v1.20.70<br><br><br>
It currently supports Minecraft: Bedrock Edition v1.20.80<br><br><br>
</p>
<p align="center">
<a href="https://discord.gg/spquK3Q66W"><img src="https://img.shields.io/discord/930544524655202317?logo=Discord" alt="Discord" /></a>
Expand Down
27 changes: 13 additions & 14 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/pocketmine/VersionInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@

const NAME = "BetterAltay";
const BASE_VERSION = "3.28.0"; //Don't change this anymore. Change the FORK_VERSION instead.
const FORK_VERSION = "1.20.0";
const IS_DEVELOPMENT_BUILD = true;
const FORK_VERSION = "1.21.0";
const IS_DEVELOPMENT_BUILD = false;
const BUILD_CHANNEL = "master";
8 changes: 6 additions & 2 deletions src/pocketmine/command/defaults/HudCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(string $name){
[
new CommandParameter("player", AvailableCommandsPacket::ARG_TYPE_TARGET, false),
new CommandParameter("visible", AvailableCommandsPacket::ARG_TYPE_STRING, false, new CommandEnum("HudVisibility", ["hide", "reset"])),
new CommandParameter("hud_element", AvailableCommandsPacket::ARG_TYPE_STRING, true, new CommandEnum("HudElement", ["air_bubbles", "all", "armor", "crosshair", "health", "horse_health", "hotbar", "hunger", "paperdoll", "progress_bar", "tooltips", "touch_controls"])),
new CommandParameter("hud_element", AvailableCommandsPacket::ARG_TYPE_STRING, true, new CommandEnum("HudElement", ["air_bubbles", "all", "armor", "crosshair", "health", "horse_health", "hotbar", "hunger", "item_text", "paperdoll", "progress_bar", "status_effects", "tooltips", "touch_controls"])),
]
]);
$this->setPermission("altay.command.hud");
Expand Down Expand Up @@ -61,8 +61,10 @@ public function execute(CommandSender $sender, string $commandLabel, array $args
"horse_health" => [HudElement::VEHICLE_HEALTH],
"hotbar" => [HudElement::HOTBAR],
"hunger" => [HudElement::FOOD],
"item_text" => [HudElement::ITEM_TEXT_POPUP],
"paperdoll" => [HudElement::PAPER_DOLL],
"progress_bar" => [HudElement::XP],
"status_effects" => [HudElement::STATUS_EFFECTS],
"tooltips" => [HudElement::TOOLTIPS],
"touch_controls" => [HudElement::TOUCH_CONTROLS],
"all" => [
Expand All @@ -76,7 +78,9 @@ public function execute(CommandSender $sender, string $commandLabel, array $args
HudElement::PAPER_DOLL,
HudElement::XP,
HudElement::TOOLTIPS,
HudElement::TOUCH_CONTROLS
HudElement::TOUCH_CONTROLS,
HudElement::STATUS_EFFECTS,
HudElement::ITEM_TEXT_POPUP,
],
default => throw new InvalidCommandSyntaxException()
};
Expand Down
4 changes: 4 additions & 0 deletions src/pocketmine/entity/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
public const DATA_FLAG_FEELING_HAPPY = 112;
public const DATA_FLAG_SEARCHING = 113;
public const DATA_FLAG_CRAWLING = 114;
public const DATA_FLAG_TIMER_FLAG_1 = 115;
public const DATA_FLAG_TIMER_FLAG_2 = 116;
public const DATA_FLAG_TIMER_FLAG_3 = 117;
public const DATA_FLAG_BODY_ROTATION_BLOCKED = 118;

public const DATA_PLAYER_FLAG_SLEEP = 1;
public const DATA_PLAYER_FLAG_DEAD = 2; //TODO: CHECK
Expand Down
1 change: 1 addition & 0 deletions src/pocketmine/level/particle/Particle.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ abstract class Particle extends Vector3{
public const TYPE_WHITE_SMOKE = 89;
public const TYPE_VAULT_CONNECTION = 90;
public const TYPE_WIND_EXPLOSION = 91;
public const TYPE_WOLF_ARMOR_CRACK = 92;

/**
* @return DataPacket|DataPacket[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,23 @@ class CorrectPlayerMovePredictionPacket extends DataPacket/* implements Clientbo
{
public const NETWORK_ID = ProtocolInfo::CORRECT_PLAYER_MOVE_PREDICTION_PACKET;

/** @var Vector3 */
private $position;
/** @var Vector3 */
private $delta;
/** @var bool */
private $onGround;
/** @var int */
private $tick;

public static function create(Vector3 $position, Vector3 $delta, bool $onGround, int $tick) : self{
public const PREDICTION_TYPE_VEHICLE = 0;
public const PREDICTION_TYPE_PLAYER = 1;

private Vector3 $position;
private Vector3 $delta;
private bool $onGround;
private int $tick;
private int $predictionType;


public static function create(Vector3 $position, Vector3 $delta, bool $onGround, int $tick, int $predictionType) : self{
$result = new self;
$result->position = $position;
$result->delta = $delta;
$result->onGround = $onGround;
$result->tick = $tick;
$result->predictionType = $predictionType;
return $result;
}

Expand All @@ -58,18 +60,28 @@ public function isOnGround() : bool{ return $this->onGround; }

public function getTick() : int{ return $this->tick; }

public function getPredictionType() : int{ return $this->predictionType; }

protected function decodePayload() : void{
$this->position = $this->getVector3();
$this->delta = $this->getVector3();
$this->onGround = $this->getBool();
$this->tick = $this->getUnsignedVarLong();
$this->predictionType = $this->getByte();

//$this->getLFloat();
//$this->getLFloat();
}

protected function encodePayload() : void{
$this->putVector3($this->position);
$this->putVector3($this->delta);
$this->putBool($this->onGround);
$this->putUnsignedVarLong($this->tick);
$this->putByte($this->predictionType);
//TODO: vehicleRotation
//$this->putLFloat();
//$this->putLFloat();
}

public function handle(NetworkSession $session) : bool{
Expand Down
14 changes: 7 additions & 7 deletions src/pocketmine/network/mcpe/protocol/CraftingDataPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,17 @@ class CraftingDataPacket extends DataPacket{
public const ENTRY_SHAPED_CHEMISTRY = 7; //TODO

/** @var object[] */
public $entries = [];
public array $entries = [];
/** @var PotionTypeRecipe[] */
public $potionTypeRecipes = [];
public array $potionTypeRecipes = [];
/** @var PotionContainerChangeRecipe[] */
public $potionContainerRecipes = [];
public array $potionContainerRecipes = [];
/** @var MaterialReducerRecipe[] */
public $materialReducerRecipes = [];
/** @var bool */
public $cleanRecipes = false;
public array $materialReducerRecipes = [];
public bool $cleanRecipes = false;

/** @var mixed[][] */
public $decodedEntries = [];
public array $decodedEntries = [];

public function clean(){
$this->entries = [];
Expand Down Expand Up @@ -247,6 +246,7 @@ private static function writeShapedRecipe(ShapedRecipe $recipe, NetworkBinaryStr
$stream->put(str_repeat("\x00", 16)); //Null UUID
$stream->putString("crafting_table"); //TODO: blocktype (no prefix) (this might require internal API breaks)
$stream->putVarInt(50); //TODO: priority
$stream->putBool(true); //TODO: assume symmetry
$stream->putUnsignedVarInt($pos); //TODO: ANOTHER recipe ID, only used on the network

return CraftingDataPacket::ENTRY_SHAPED;
Expand Down
4 changes: 2 additions & 2 deletions src/pocketmine/network/mcpe/protocol/ProtocolInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ interface ProtocolInfo{
*/

/** Actual Minecraft: PE protocol version */
public const CURRENT_PROTOCOL = 662;
public const CURRENT_PROTOCOL = 671;
/** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */
public const MINECRAFT_VERSION = 'v' . self::MINECRAFT_VERSION_NETWORK;
/** Version number sent to clients in ping responses. */
public const MINECRAFT_VERSION_NETWORK = '1.20.70';
public const MINECRAFT_VERSION_NETWORK = '1.20.80';

public const LOGIN_PACKET = 0x01;
public const PLAY_STATUS_PACKET = 0x02;
Expand Down
19 changes: 8 additions & 11 deletions src/pocketmine/network/mcpe/protocol/ResourcePackStackPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,14 @@
class ResourcePackStackPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_STACK_PACKET;

/** @var bool */
public $mustAccept = false;

public bool $mustAccept = false;
/** @var ResourcePack[] */
public $behaviorPackStack = [];
public array $behaviorPackStack = [];
/** @var ResourcePack[] */
public $resourcePackStack = [];

/** @var string */
public $baseGameVersion = ProtocolInfo::MINECRAFT_VERSION_NETWORK;

/** @var Experiments */
public $experiments;
public array $resourcePackStack = [];
public string $baseGameVersion = ProtocolInfo::MINECRAFT_VERSION_NETWORK;
public Experiments $experiments;
public bool $includeEditorPacks = false;

protected function decodePayload(){
$this->mustAccept = $this->getBool();
Expand All @@ -65,6 +60,7 @@ protected function decodePayload(){

$this->baseGameVersion = $this->getString();
$this->experiments = Experiments::read($this);
$this->includeEditorPacks = $this->getBool();
}

protected function encodePayload(){
Expand All @@ -86,6 +82,7 @@ protected function encodePayload(){

$this->putString($this->baseGameVersion);
$this->experiments->write($this);
$this->putBool($this->includeEditorPacks);
}

public function handle(NetworkSession $session) : bool{
Expand Down
3 changes: 3 additions & 0 deletions src/pocketmine/network/mcpe/protocol/StartGamePacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class StartGamePacket extends DataPacket{
public SpawnSettings $spawnSettings;
public int $generator = GeneratorType::OVERWORLD;
public int $worldGamemode;
public bool $hardcoreMode = false;
public int $difficulty;
public int $spawnX;
public int $spawnY;
Expand Down Expand Up @@ -157,6 +158,7 @@ protected function decodePayload(){
$this->spawnSettings = SpawnSettings::read($this);
$this->generator = $this->getVarInt();
$this->worldGamemode = $this->getVarInt();
$this->hardcoreMode = $this->getBool();
$this->difficulty = $this->getVarInt();
$this->getBlockPosition($this->spawnX, $this->spawnY, $this->spawnZ);
$this->hasAchievementsDisabled = $this->getBool();
Expand Down Expand Up @@ -256,6 +258,7 @@ protected function encodePayload(){
$this->spawnSettings->write($this);
$this->putVarInt($this->generator);
$this->putVarInt($this->worldGamemode);
$this->putBool($this->hardcoreMode);
$this->putVarInt($this->difficulty);
$this->putBlockPosition($this->spawnX, $this->spawnY, $this->spawnZ);
$this->putBool($this->hasAchievementsDisabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,37 @@ class UpdatePlayerGameTypePacket extends DataPacket/* implements ClientboundPack
public const NETWORK_ID = ProtocolInfo::UPDATE_PLAYER_GAME_TYPE_PACKET;

/**
* @var int
* @see GameMode
*/
private $gameMode;
private int $gameMode;
private int $playerEntityUniqueId;
private int $tick;

/** @var int */
private $playerEntityUniqueId;

public static function create(int $gameMode, int $playerEntityUniqueId) : self{
public static function create(int $gameMode, int $playerEntityUniqueId, int $tick) : self{
$result = new self;
$result->gameMode = $gameMode;
$result->playerEntityUniqueId = $playerEntityUniqueId;
$result->tick = $tick;
return $result;
}

public function getGameMode() : int{ return $this->gameMode; }

public function getPlayerEntityUniqueId() : int{ return $this->playerEntityUniqueId; }

public function getTick() : int{ return $this->tick; }

protected function decodePayload() : void{
$this->gameMode = $this->getVarInt();
$this->playerEntityUniqueId = $this->getEntityUniqueId();
$this->tick = $this->getUnsignedVarInt();
}

protected function encodePayload() : void{
$this->putVarInt($this->gameMode);
$this->putEntityUniqueId($this->playerEntityUniqueId);
$this->putUnsignedVarInt($this->tick);
}

public function handle(NetworkSession $session) : bool{
Expand Down
3 changes: 3 additions & 0 deletions src/pocketmine/network/mcpe/protocol/types/WindowTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,8 @@ interface WindowTypes{
public const HUD = 31;
public const JIGSAW_EDITOR = 32;
public const SMITHING_TABLE = 33;
public const CHEST_BOAT = 34;
public const DECORATED_POT = 35;
public const CRAFTER = 36;

}
2 changes: 2 additions & 0 deletions src/pocketmine/network/mcpe/protocol/types/hud/HudElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ private function __construct(){
public const FOOD = 8;
public const AIR_BUBBLES = 9;
public const VEHICLE_HEALTH = 10;
public const STATUS_EFFECTS = 11;
public const ITEM_TEXT_POPUP = 12;
}
1 change: 1 addition & 0 deletions src/pocketmine/resources/vanilla/biome_id_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"birch_forest_hills": 28,
"birch_forest_hills_mutated": 156,
"birch_forest_mutated": 155,
"cherry_grove": 192,
"cold_beach": 26,
"cold_ocean": 44,
"cold_taiga": 30,
Expand Down
Binary file modified src/pocketmine/resources/vanilla/canonical_block_states.nbt
Binary file not shown.
Loading

0 comments on commit ce473e7

Please sign in to comment.