Skip to content

Commit

Permalink
Merge pull request #296 from Benedikt05/r/21_u3
Browse files Browse the repository at this point in the history
feat: 1.21.30 support
  • Loading branch information
Benedikt05 committed Sep 17, 2024
2 parents 79fc7bb + 8106735 commit 7ff81e7
Show file tree
Hide file tree
Showing 19 changed files with 739 additions and 579 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
<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 currently supports Minecraft: Bedrock Edition v1.21.21
This fork was created due to the inactivity of Altay. It currently supports Minecraft: Bedrock Edition v1.21.30
<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>
<a href="https://feedback.minecraft.net/hc/en-us/articles/29279683879949-Minecraft-1-21-21-Bedrock">
<img src="https://img.shields.io/badge/Minecraft_1.21.20-blue" alt="Minecraft">
<a href="https://feedback.minecraft.net/hc/en-us/articles/30220110283533-Minecraft-1-21-30-Bedrock">
<img src="https://img.shields.io/badge/Minecraft_1.21.30-blue" alt="Minecraft">
</a>
<a href="https://github.com/Mojang/bedrock-protocol-docs">
<img src="https://img.shields.io/badge/protocol-712-yellow" alt="Minecraft">
<img src="https://img.shields.io/badge/protocol-729-yellow" alt="Minecraft">
</a>
</p>
2 changes: 1 addition & 1 deletion 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.24.1";
const FORK_VERSION = "1.25.0";
const IS_DEVELOPMENT_BUILD = true;
const BUILD_CHANNEL = "master";
2 changes: 2 additions & 0 deletions src/pocketmine/network/mcpe/NetworkBinaryStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ public function putAttributeList(Attribute ...$attributes) : void{
$this->putLFloat($attribute->getMinValue());
$this->putLFloat($attribute->getMaxValue());
$this->putLFloat($attribute->getValue());
$this->putLFloat($attribute->getMinValue()); //default min value
$this->putLFloat($attribute->getMaxValue()); //default max value
$this->putLFloat($attribute->getDefaultValue());
$this->putString($attribute->getName());
$this->putUnsignedVarInt(0); //Modifiers
Expand Down
3 changes: 2 additions & 1 deletion src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,10 @@ public function handleEmote(EmotePacket $packet) : bool{
$this->player->level->broadcastPacketToViewers($this->player, EmotePacket::create(
$this->player->getId(),
$packet->getEmoteId(),
$packet->getEmoteTicks(),
"",
"",
EmotePacket::FLAG_SERVER
EmotePacket::FLAG_SERVER | EmotePacket::FLAG_MUTE_EMOTE_CHAT
));

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function create(int $predictionType, Vector3 $position, Vector3 $d
$result->delta = $delta;
$result->onGround = $onGround;
$result->tick = $tick;
if($predictionType === self::PREDICTION_TYPE_VEHICLE && $vehicleRotation == null){
if($predictionType === self::PREDICTION_TYPE_VEHICLE && $vehicleRotation === null){
throw new LogicException("CorrectPlayerMovePredictionPackets with type VEHICLE require a vehicleRotation to be provided");
}
$result->predictionType = $predictionType;
Expand Down
10 changes: 9 additions & 1 deletion src/pocketmine/network/mcpe/protocol/EmotePacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ class EmotePacket extends DataPacket/* implements ClientboundPacket, Serverbound

private int $entityRuntimeId;
private string $emoteId;
private int $emoteTicks;
private string $xuid;
private string $platformId;
private int $flags;


public static function create(int $entityRuntimeId, string $emoteId, string $xuid, string $platformId, int $flags) : self{
public static function create(int $entityRuntimeId, string $emoteId, int $emoteTicks, string $xuid, string $platformId, int $flags) : self{
$result = new self;
$result->entityRuntimeId = $entityRuntimeId;
$result->emoteId = $emoteId;
$result->emoteTicks = $emoteTicks;
$result->xuid = $xuid;
$result->platformId = $platformId;
$result->flags = $flags;
Expand All @@ -62,6 +64,10 @@ public function getEmoteId() : string{
return $this->emoteId;
}

public function getEmoteTicks() : int{
return $this->emoteTicks;
}

public function getXuid() : string{
return $this->xuid;
}
Expand All @@ -77,6 +83,7 @@ public function getFlags() : int{
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->emoteId = $this->getString();
$this->emoteTicks = $this->getUnsignedVarInt();
$this->xuid = $this->getString();
$this->platformId = $this->getString();
$this->flags = $this->getByte();
Expand All @@ -85,6 +92,7 @@ protected function decodePayload() : void{
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putString($this->emoteId);
$this->putUnsignedVarInt($this->emoteTicks);
$this->putString($this->xuid);
$this->putString($this->platformId);
$this->putByte($this->flags);
Expand Down
17 changes: 12 additions & 5 deletions src/pocketmine/network/mcpe/protocol/InventoryContentPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <rules/DataPacket.h>

use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\inventory\FullContainerName;
use pocketmine\network\mcpe\protocol\types\inventory\ItemStackWrapper;
use function count;

Expand All @@ -35,24 +36,30 @@ class InventoryContentPacket extends DataPacket{
public int $windowId;
/** @var ItemStackWrapper[] */
public array $items = [];
public int $dynamicContainerId = 0;//??
public ?FullContainerName $containerName = null;
public int $dynamicContainerSize = 0;

protected function decodePayload(){
protected function decodePayload() : void{
$this->windowId = $this->getUnsignedVarInt();
$count = $this->getUnsignedVarInt();
for($i = 0; $i < $count; ++$i){
$this->items[] = ItemStackWrapper::read($this);
}
$this->dynamicContainerId = $this->getUnsignedVarInt();
$this->containerName = FullContainerName::read($this);
$this->dynamicContainerSize = $this->getUnsignedVarInt();
}

protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->windowId);
$this->putUnsignedVarInt(count($this->items));
foreach($this->items as $item){
$item->write($this);
}
$this->putUnsignedVarInt($this->dynamicContainerId);
if($this->containerName === null){
$this->containerName = new FullContainerName(1);
}
$this->containerName->write($this);
$this->putUnsignedVarInt($this->dynamicContainerSize);
}

public function handle(NetworkSession $session) : bool{
Expand Down
13 changes: 10 additions & 3 deletions src/pocketmine/network/mcpe/protocol/InventorySlotPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,34 @@
#include <rules/DataPacket.h>

use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\inventory\FullContainerName;
use pocketmine\network\mcpe\protocol\types\inventory\ItemStackWrapper;

class InventorySlotPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::INVENTORY_SLOT_PACKET;

public int $windowId;
public int $inventorySlot;
public int $dynamicContainerId = 0;//??
public ?FullContainerName $containerName = null;
public int $dynamicContainerSize = 0;
public ItemStackWrapper $item;

protected function decodePayload() : void{
$this->windowId = $this->getUnsignedVarInt();
$this->inventorySlot = $this->getUnsignedVarInt();
$this->dynamicContainerId = $this->getUnsignedVarInt();
$this->containerName = FullContainerName::read($this);
$this->dynamicContainerSize = $this->getUnsignedVarInt();
$this->item = ItemStackWrapper::read($this);
}

protected function encodePayload() : void{
$this->putUnsignedVarInt($this->windowId);
$this->putUnsignedVarInt($this->inventorySlot);
$this->putUnsignedVarInt($this->dynamicContainerId);
if($this->containerName === null){
$this->containerName = new FullContainerName(1);
}
$this->containerName->write($this);
$this->putUnsignedVarInt($this->dynamicContainerSize);
$this->item->write($this);
}

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 = 712;
public const CURRENT_PROTOCOL = 729;
/** 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.21.20';
public const MINECRAFT_VERSION_NETWORK = '1.21.30';

public const LOGIN_PACKET = 0x01;
public const PLAY_STATUS_PACKET = 0x02;
Expand Down
31 changes: 4 additions & 27 deletions src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,13 @@ class ResourcePacksInfoPacket extends DataPacket{
public bool $mustAccept = false; //if true, forces client to choose between accepting packs or being disconnected
public bool $hasAddonPacks = false;
public bool $hasScripts = false; //if true, causes disconnect for any platform that doesn't support scripts yet
public bool $forceServerPacks = false;
/** @var ResourcePack[] */
public array $behaviorPackEntries = [];
/** @var ResourcePack[] */
public array $resourcePackEntries = [];

protected function decodePayload(){
protected function decodePayload() : void{
$this->mustAccept = $this->getBool();
$this->hasAddonPacks = $this->getBool();
$this->hasScripts = $this->getBool();
$this->forceServerPacks = $this->getBool();
$behaviorPackCount = $this->getLShort();
while($behaviorPackCount-- > 0){
$this->getString();
$this->getString();
$this->getLLong();
$this->getString();
$this->getString();
$this->getString();
$this->getBool();
}

$resourcePackCount = $this->getLShort();
while($resourcePackCount-- > 0){
Expand All @@ -66,25 +53,15 @@ protected function decodePayload(){
$this->getString();
$this->getBool();
$this->getBool();
$this->getBool();
}
//CDNEntries
}

protected function encodePayload() : void{
$this->putBool($this->mustAccept);
$this->putBool($this->hasAddonPacks);
$this->putBool($this->hasScripts);
$this->putBool($this->forceServerPacks);
$this->putLShort(count($this->behaviorPackEntries));
foreach($this->behaviorPackEntries as $entry){
$this->putString($entry->getPackId());
$this->putString($entry->getPackVersion());
$this->putLLong($entry->getPackSize());
$this->putString(""); //TODO: encryption key
$this->putString(""); //TODO: subpack name
$this->putString(""); //TODO: content identity
$this->putBool(false); //TODO: has scripts (?)
$this->putBool(false); //TODO: is addon pack
}
$this->putLShort(count($this->resourcePackEntries));
foreach($this->resourcePackEntries as $entry){
$this->putString($entry->getPackId());
Expand Down
13 changes: 7 additions & 6 deletions src/pocketmine/network/mcpe/protocol/TransferPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,20 @@
class TransferPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::TRANSFER_PACKET;

/** @var string */
public $address;
/** @var int */
public $port = 19132;
public string $address;
public int $port = 19132;
public bool $reloadWorld = false; //always false

protected function decodePayload(){
protected function decodePayload() : void{
$this->address = $this->getString();
$this->port = $this->getLShort();
$this->reloadWorld = $this->getBool();
}

protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->address);
$this->putLShort($this->port);
$this->putBool($this->reloadWorld);
}

public function handle(NetworkSession $session) : bool{
Expand Down
12 changes: 5 additions & 7 deletions src/pocketmine/network/mcpe/protocol/UpdateAttributesPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,18 @@
class UpdateAttributesPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::UPDATE_ATTRIBUTES_PACKET;

/** @var int */
public $entityRuntimeId;
public int $entityRuntimeId;
/** @var Attribute[] */
public $entries = [];
/** @var int */
public $tick = 0;
public array $entries = [];
public int $tick = 0;

protected function decodePayload(){
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->entries = $this->getAttributeList();
$this->tick = $this->getUnsignedVarLong();
}

protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putAttributeList(...$this->entries);
$this->putUnsignedVarLong($this->tick);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,24 @@
final class FullContainerName{
public function __construct(
private int $containerId,
private int $dynamicId = 0
private ?int $dynamicId = null
){}

public function getContainerId() : int{ return $this->containerId; }

public function getDynamicId() : int{ return $this->dynamicId; }
public function getDynamicId() : ?int{ return $this->dynamicId; }

public static function read(NetworkBinaryStream $in) : self{
$containerId = $in->getByte();
$dynamicId = $in->getLInt();
$dynamicId = $in->getBool() ? $in->getLInt() : null;
return new self($containerId, $dynamicId);
}

public function write(NetworkBinaryStream $out) : void{
$out->putByte($this->containerId);
$out->putLInt($this->dynamicId);
$out->putBool($this->dynamicId !== null);
if($this->dynamicId !== null){
$out->putLInt($this->dynamicId);
}
}
}
Binary file modified src/pocketmine/resources/vanilla/biome_definitions.nbt
Binary file not shown.
Binary file modified src/pocketmine/resources/vanilla/canonical_block_states.nbt
Binary file not shown.
5 changes: 4 additions & 1 deletion src/pocketmine/resources/vanilla/level_sound_id_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"ambient.baby": 11,
"ambient.basalt_deltas.additions": 326,
"ambient.basalt_deltas.loop": 321,
"ambient.basalt_deltas.mood": 306,
"ambient.candle": 362,
"ambient.cave": 295,
"ambient.crimson_forest.additions": 327,
Expand Down Expand Up @@ -137,6 +138,7 @@
"bullet.hit": 64,
"bundle.drop_contents": 445,
"bundle.insert": 446,
"bundle.insert_fail": 533,
"bundle.remove_one": 447,
"burp": 89,
"button.click_off": 450,
Expand Down Expand Up @@ -250,9 +252,11 @@
"imitate.breeze": 494,
"imitate.cave_spider": 146,
"imitate.creeper": 147,
"imitate.drowned": 531,
"imitate.elder_guardian": 148,
"imitate.ender_dragon": 149,
"imitate.enderman": 150,
"imitate.endermite": 151,
"imitate.evocation_illager": 152,
"imitate.ghast": 153,
"imitate.husk": 154,
Expand Down Expand Up @@ -408,7 +412,6 @@
"reflect": 499,
"remedy": 60,
"respawn_anchor.ambient": 311,
"respawn_anchor.basalt_deltas.mood": 306,
"respawn_anchor.charge": 308,
"respawn_anchor.deplete": 309,
"respawn_anchor.set_spawn": 310,
Expand Down
Binary file modified src/pocketmine/resources/vanilla/r12_to_current_block_map.bin
Binary file not shown.
Loading

0 comments on commit 7ff81e7

Please sign in to comment.