Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 9aab294
Author: Benedikt05 <60869945+Benedikt05@users.noreply.github.com>
Date:   Thu Apr 27 00:37:13 2023 +0200

    1.19.80

commit 179c1b9
Author: Benedikt05 <60869945+Benedikt05@users.noreply.github.com>
Date:   Wed Apr 26 22:57:30 2023 +0200

    argument type constants for 1.19.80

commit 9c3ddbd
Author: Benedikt05 <60869945+Benedikt05@users.noreply.github.com>
Date:   Sun Apr 23 05:27:26 2023 +0200

    Update AvailableCommandsPacket.php

commit 58d6559
Author: JoseLuisHD <joseluis.herrejon.developer@gmail.com>
Date:   Sat Apr 22 20:16:11 2023 -0600

    1.19.80 signs support & sign editor mode

commit bb5daba
Author: Benedikt05 <60869945+Benedikt05@users.noreply.github.com>
Date:   Sat Apr 22 21:47:03 2023 +0200

    implement 1.19.80 support

commit dcfd2ca
Merge: 19fda72 9b6cd5c
Author: Benedikt05 <60869945+Benedikt05@users.noreply.github.com>
Date:   Fri Apr 14 00:02:07 2023 +0200

    Merge branch 'master' into 1.19.80

commit 19fda72
Author: Benedikt05 <60869945+Benedikt05@users.noreply.github.com>
Date:   Sun Apr 2 16:36:26 2023 +0200

    next is 1.13.0

commit df90040
Author: Benedikt05 <60869945+Benedikt05@users.noreply.github.com>
Date:   Sun Apr 2 16:04:29 2023 +0200

    1.19.80: joining works
  • Loading branch information
Benedikt05 committed Apr 26, 2023
1 parent caac805 commit 83c058d
Show file tree
Hide file tree
Showing 22 changed files with 471 additions and 132 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ Documentation/*
src/pocketmine/resources/vanilla/recipes/*
src/pocketmine/resources/vanilla/block_id_to_item_id_map.json
src/pocketmine/resources/vanilla/block_state_meta_map.json
src/pocketmine/resources/vanilla/command_arg_types.json
src/pocketmine/resources/vanilla/command_arg_types.json
src/pocketmine/resources/vanilla/item_tags.json
12 changes: 6 additions & 6 deletions composer.lock

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

3 changes: 1 addition & 2 deletions src/pocketmine/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -3322,7 +3322,6 @@ public function handlePlayerAction(PlayerActionPacket $packet) : bool{
$this->toggleSwim(false);
}
break;
break;
case PlayerActionPacket::ACTION_INTERACT_BLOCK: //TODO: ignored (for now)
break;
case PlayerActionPacket::ACTION_CREATIVE_PLAYER_DESTROY_BLOCK:
Expand Down Expand Up @@ -3566,7 +3565,7 @@ public function handleItemFrameDropItem(ItemFrameDropItemPacket $packet) : bool{
if(lcg_value() <= $tile->getItemDropChance()){
$this->level->dropItem($tile->getBlock(), $tile->getItem());
}
$tile->setItem(null);
$tile->setItem();
$tile->setItemRotation(0);
}

Expand Down
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.12.1";
const FORK_VERSION = "1.13.0";
const IS_DEVELOPMENT_BUILD = false;
const BUILD_CHANNEL = "master";
27 changes: 27 additions & 0 deletions src/pocketmine/block/SignPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\OpenSignPacket;
use pocketmine\Player;
use pocketmine\tile\Sign as TileSign;
use pocketmine\tile\Tile;
Expand Down Expand Up @@ -57,7 +58,18 @@ protected function recalculateBoundingBox() : ?AxisAlignedBB{
return null;
}

protected function onOpenEditor(Player $player, Vector3 $vector3) : void{
$pk = new OpenSignPacket();
$pk->isFrontSide = true;
$pk->x = $vector3->getX();
$pk->y = $vector3->getY();
$pk->z = $vector3->getZ();
$player->sendDataPacket($pk);
}

public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
$this->onOpenEditor($player, $blockReplace);

if($face !== Vector3::SIDE_DOWN){

if($face === Vector3::SIDE_UP){
Expand All @@ -79,6 +91,21 @@ public function place(Item $item, Block $blockReplace, Block $blockClicked, int
return false;
}

public function onActivate(Item $item, Player $player = null) : bool{
if(!$player instanceof Player){
return false;
}

$signPos = new Vector3($this->getX(), $this->getFloorY(), $this->getZ());
if($player->distance($signPos) > 4){
return false;
}

$this->onOpenEditor($player, $signPos);

return true;
}

public function onNearbyBlockChange() : void{
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){
$this->getLevelNonNull()->useBreakOn($this);
Expand Down
11 changes: 6 additions & 5 deletions src/pocketmine/network/mcpe/NetworkSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@
use pocketmine\network\mcpe\protocol\NpcDialoguePacket;
use pocketmine\network\mcpe\protocol\NpcRequestPacket;
use pocketmine\network\mcpe\protocol\OnScreenTextureAnimationPacket;
use pocketmine\network\mcpe\protocol\OpenSignPacket;
use pocketmine\network\mcpe\protocol\PacketViolationWarningPacket;
use pocketmine\network\mcpe\protocol\PassengerJumpPacket;
use pocketmine\network\mcpe\protocol\PhotoInfoRequestPacket;
use pocketmine\network\mcpe\protocol\PhotoTransferPacket;
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
use pocketmine\network\mcpe\protocol\PlayerArmorDamagePacket;
Expand Down Expand Up @@ -878,10 +878,6 @@ public function handleUpdateSubChunkBlocks(UpdateSubChunkBlocksPacket $packet) :
return false;
}

public function handlePhotoInfoRequest(PhotoInfoRequestPacket $packet) : bool{
return false;
}

public function handleSubChunk(SubChunkPacket $packet) : bool{
return false;
}
Expand Down Expand Up @@ -941,4 +937,9 @@ public function handleRequestAbility(RequestAbilityPacket $packet) : bool{
public function handleUpdateClientInputLocks(UpdateClientInputLocksPacket $packet) : bool{
return false;
}

public function handleOpenSign(OpenSignPacket $packet) : bool{
return false;
}

}
39 changes: 19 additions & 20 deletions src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,37 +50,36 @@ class AvailableCommandsPacket extends DataPacket{
* Basic parameter types. These must be combined with the ARG_FLAG_VALID constant.
* ARG_FLAG_VALID | (type const)
*/
//TODO: Update to 1.19.30
public const ARG_TYPE_INT = 0x01;
public const ARG_TYPE_FLOAT = 0x03;
public const ARG_TYPE_VALUE = 0x04;
public const ARG_TYPE_WILDCARD_INT = 0x05;
public const ARG_TYPE_OPERATOR = 0x06;
public const ARG_TYPE_COMPARE_OPERATOR = 0x07;
public const ARG_TYPE_TARGET = 0x08;

public const ARG_TYPE_WILDCARD_TARGET = 0x0a;
public const ARG_TYPE_INT = 1;
public const ARG_TYPE_FLOAT = 3;
public const ARG_TYPE_VALUE = 4;
public const ARG_TYPE_WILDCARD_INT = 5;
public const ARG_TYPE_OPERATOR = 6;
public const ARG_TYPE_COMPARE_OPERATOR = 7;
public const ARG_TYPE_TARGET = 8;

public const ARG_TYPE_FILEPATH = 0x11;
public const ARG_TYPE_WILDCARD_TARGET = 10;

public const ARG_TYPE_FULL_INTEGER_RANGE = 0x17;
public const ARG_TYPE_FILEPATH = 17;

public const ARG_TYPE_EQUIPMENT_SLOT = 0x26;
public const ARG_TYPE_STRING = 0x27;
public const ARG_TYPE_FULL_INTEGER_RANGE = 23;

public const ARG_TYPE_INT_POSITION = 0x2f;
public const ARG_TYPE_POSITION = 0x30;
public const ARG_TYPE_EQUIPMENT_SLOT = 43;
public const ARG_TYPE_STRING = 44;

public const ARG_TYPE_MESSAGE = 0x33;
public const ARG_TYPE_INT_POSITION = 52;
public const ARG_TYPE_POSITION = 53;

public const ARG_TYPE_RAWTEXT = 0x35;
public const ARG_TYPE_MESSAGE = 55;

public const ARG_TYPE_JSON = 0x39;
public const ARG_TYPE_RAWTEXT = 58;

public const ARG_TYPE_BLOCK_STATES = 0x43;
public const ARG_TYPE_JSON = 62;

public const ARG_TYPE_COMMAND = 0x46;
public const ARG_TYPE_BLOCK_STATES = 71;

public const ARG_TYPE_COMMAND = 74;
/**
* Enums are a little different: they are composed as follows:
* ARG_FLAG_ENUM | ARG_FLAG_VALID | (enum index)
Expand Down
10 changes: 9 additions & 1 deletion src/pocketmine/network/mcpe/protocol/LevelEventPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class LevelEventPacket extends DataPacket{
public const EVENT_SOUND_ARMOR_STAND_HIT = 1061;
public const EVENT_SOUND_ARMOR_STAND_FALL = 1062;
public const EVENT_SOUND_ARMOR_STAND_PLACE = 1063;
public const EVENT_SOUND_AMETHYST_RESONATE = 1067;

//TODO: check 2000-2017
public const EVENT_PARTICLE_SHOOT = 2000;
Expand Down Expand Up @@ -120,7 +121,14 @@ class LevelEventPacket extends DataPacket{

public const EVENT_BLOCK_START_BREAK = 3600;
public const EVENT_BLOCK_STOP_BREAK = 3601;
public const EVENT_PLAYERS_SLEEPING = 3603;
public const EVENT_PARTICLES_CRACK_BLOCK_DOWN = 3603;
public const EVENT_PARTICLE_BREAK_BLOCK_UP = 3604;
public const EVENT_PARTICLE_BREAK_BLOCK_NORTH = 3605;
public const EVENT_PARTICLE_BREAK_BLOCK_SOUTH = 3606;
public const EVENT_PARTICLE_BREAK_BLOCK_WEST = 3607;
public const EVENT_PARTICLE_BREAK_BLOCK_EAST = 3608;
public const EVENT_PLAYERS_SLEEPING = 3609;


public const EVENT_SET_DATA = 4000;

Expand Down
33 changes: 33 additions & 0 deletions src/pocketmine/network/mcpe/protocol/OpenSignPacket.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php


declare(strict_types=1);

namespace pocketmine\network\mcpe\protocol;

#include <rules/DataPacket.h>

use pocketmine\network\mcpe\NetworkSession;

class OpenSignPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::OPEN_SIGN_PACKET;

public int $x;
public int $y;
public int $z;
public bool $isFrontSide;

public function decodePayload(){
$this->getBlockPosition($this->x, $this->y, $this->z);
$this->isFrontSide = $this->getBool();
}

public function encodePayload(){
$this->putBlockPosition($this->x, $this->y, $this->z);
$this->putBool($this->isFrontSide);
}

public function handle(NetworkSession $session) : bool{
return $session->handleOpenSign($this);
}
}
4 changes: 2 additions & 2 deletions src/pocketmine/network/mcpe/protocol/PacketPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PacketPool{
* @return void
*/
public static function init(){
static::$pool = new SplFixedArray(256);
static::$pool = new SplFixedArray(512);

static::registerPacket(new LoginPacket());
static::registerPacket(new PlayStatusPacket());
Expand Down Expand Up @@ -203,7 +203,6 @@ public static function init(){
static::registerPacket(new EduUriResourcePacket());
static::registerPacket(new CreatePhotoPacket());
static::registerPacket(new UpdateSubChunkBlocksPacket());
static::registerPacket(new PhotoInfoRequestPacket());
static::registerPacket(new SubChunkPacket());
static::registerPacket(new SubChunkRequestPacket());
static::registerPacket(new PlayerStartItemCooldownPacket());
Expand All @@ -219,6 +218,7 @@ public static function init(){
static::registerPacket(new DeathInfoPacket());
static::registerPacket(new RequestAbilityPacket());
static::registerPacket(new UpdateClientInputLocksPacket());
static::registerPacket(new OpenSignPacket());
}

/**
Expand Down
52 changes: 0 additions & 52 deletions src/pocketmine/network/mcpe/protocol/PhotoInfoRequestPacket.php

This file was deleted.

9 changes: 4 additions & 5 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 = 575;
public const CURRENT_PROTOCOL = 582;
/** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */
public const MINECRAFT_VERSION = 'v1.19.70';
public const MINECRAFT_VERSION = 'v' . self::MINECRAFT_VERSION_NETWORK;
/** Version number sent to clients in ping responses. */
public const MINECRAFT_VERSION_NETWORK = '1.19.70';
public const MINECRAFT_VERSION_NETWORK = '1.19.80';

public const LOGIN_PACKET = 0x01;
public const PLAY_STATUS_PACKET = 0x02;
Expand Down Expand Up @@ -214,7 +214,6 @@ interface ProtocolInfo{
public const EDU_URI_RESOURCE_PACKET = 0xaa;
public const CREATE_PHOTO_PACKET = 0xab;
public const UPDATE_SUB_CHUNK_BLOCKS_PACKET = 0xac;
public const PHOTO_INFO_REQUEST_PACKET = 0xad;
public const SUB_CHUNK_PACKET = 0xae;
public const SUB_CHUNK_REQUEST_PACKET = 0xaf;
public const PLAYER_START_ITEM_COOLDOWN_PACKET = 0xb0;
Expand All @@ -230,5 +229,5 @@ interface ProtocolInfo{
public const DEATH_INFO_PACKET = 0xbd;
public const REQUEST_ABILITY_PACKET = 0xb8;
public const UPDATE_CLIENT_INPUT_LOCKS_PACKET = 0xc4;

public const OPEN_SIGN_PACKET = 0x12f;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@
class RequestChunkRadiusPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::REQUEST_CHUNK_RADIUS_PACKET;

/** @var int */
public $radius;
public int $radius;
public int $maxRadius;

protected function decodePayload(){
$this->radius = $this->getVarInt();
$this->maxRadius = $this->getByte();
}

protected function encodePayload(){
$this->putVarInt($this->radius);
$this->putByte($this->maxRadius);
}

public function handle(NetworkSession $session) : bool{
Expand Down
Loading

0 comments on commit 83c058d

Please sign in to comment.