mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 17:29:44 +00:00
Merge branch 'release/3.3'
This commit is contained in:
commit
caca097300
@ -2167,7 +2167,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$this->level->broadcastLevelEvent(
|
$this->level->broadcastLevelEvent(
|
||||||
$pos,
|
$pos,
|
||||||
LevelEventPacket::EVENT_PARTICLE_PUNCH_BLOCK,
|
LevelEventPacket::EVENT_PARTICLE_PUNCH_BLOCK,
|
||||||
BlockFactory::toStaticRuntimeId($block->getId(), $block->getDamage()) | ($face << 24)
|
$block->getRuntimeId() | ($face << 24)
|
||||||
);
|
);
|
||||||
|
|
||||||
//TODO: destroy-progress level event
|
//TODO: destroy-progress level event
|
||||||
|
@ -110,6 +110,14 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
return $this->itemId ?? $this->getId();
|
return $this->itemId ?? $this->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getRuntimeId() : int{
|
||||||
|
return BlockFactory::toStaticRuntimeId($this->getId(), $this->getDamage());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
|
@ -71,7 +71,7 @@ class FallingBlock extends Entity{
|
|||||||
|
|
||||||
$this->block = BlockFactory::get($blockId, $damage);
|
$this->block = BlockFactory::get($blockId, $damage);
|
||||||
|
|
||||||
$this->propertyManager->setInt(self::DATA_VARIANT, BlockFactory::toStaticRuntimeId($this->block->getId(), $this->block->getDamage()));
|
$this->propertyManager->setInt(self::DATA_VARIANT, $this->block->getRuntimeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canCollideWith(Entity $entity) : bool{
|
public function canCollideWith(Entity $entity) : bool{
|
||||||
|
@ -877,16 +877,12 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$pk->z = $b->z;
|
$pk->z = $b->z;
|
||||||
|
|
||||||
if($b instanceof Block){
|
if($b instanceof Block){
|
||||||
$blockId = $b->getId();
|
$pk->blockRuntimeId = $b->getRuntimeId();
|
||||||
$blockData = $b->getDamage();
|
|
||||||
}else{
|
}else{
|
||||||
$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);
|
$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);
|
||||||
$blockId = $fullBlock >> 4;
|
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($fullBlock >> 4, $fullBlock & 0xf);
|
||||||
$blockData = $fullBlock & 0xf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($blockId, $blockData);
|
|
||||||
|
|
||||||
$pk->flags = $first ? $flags : UpdateBlockPacket::FLAG_NONE;
|
$pk->flags = $first ? $flags : UpdateBlockPacket::FLAG_NONE;
|
||||||
|
|
||||||
$packets[] = $pk;
|
$packets[] = $pk;
|
||||||
@ -903,16 +899,12 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$pk->z = $b->z;
|
$pk->z = $b->z;
|
||||||
|
|
||||||
if($b instanceof Block){
|
if($b instanceof Block){
|
||||||
$blockId = $b->getId();
|
$pk->blockRuntimeId = $b->getRuntimeId();
|
||||||
$blockData = $b->getDamage();
|
|
||||||
}else{
|
}else{
|
||||||
$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);
|
$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);
|
||||||
$blockId = $fullBlock >> 4;
|
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($fullBlock >> 4, $fullBlock & 0xf);
|
||||||
$blockData = $fullBlock & 0xf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($blockId, $blockData);
|
|
||||||
|
|
||||||
$pk->flags = $flags;
|
$pk->flags = $flags;
|
||||||
|
|
||||||
$packets[] = $pk;
|
$packets[] = $pk;
|
||||||
@ -1885,7 +1877,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($playSound){
|
if($playSound){
|
||||||
$this->broadcastLevelSoundEvent($hand, LevelSoundEventPacket::SOUND_PLACE, 1, BlockFactory::toStaticRuntimeId($hand->getId(), $hand->getDamage()));
|
$this->broadcastLevelSoundEvent($hand, LevelSoundEventPacket::SOUND_PLACE, 1, $hand->getRuntimeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->pop();
|
$item->pop();
|
||||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
namespace pocketmine\level\particle;
|
namespace pocketmine\level\particle;
|
||||||
|
|
||||||
use pocketmine\block\Block;
|
use pocketmine\block\Block;
|
||||||
use pocketmine\block\BlockFactory;
|
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||||
|
|
||||||
@ -35,7 +34,7 @@ class DestroyBlockParticle extends Particle{
|
|||||||
|
|
||||||
public function __construct(Vector3 $pos, Block $b){
|
public function __construct(Vector3 $pos, Block $b){
|
||||||
parent::__construct($pos->x, $pos->y, $pos->z);
|
parent::__construct($pos->x, $pos->y, $pos->z);
|
||||||
$this->data = BlockFactory::toStaticRuntimeId($b->getId(), $b->getDamage());
|
$this->data = $b->getRuntimeId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
|
@ -24,11 +24,10 @@ declare(strict_types=1);
|
|||||||
namespace pocketmine\level\particle;
|
namespace pocketmine\level\particle;
|
||||||
|
|
||||||
use pocketmine\block\Block;
|
use pocketmine\block\Block;
|
||||||
use pocketmine\block\BlockFactory;
|
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
|
|
||||||
class TerrainParticle extends GenericParticle{
|
class TerrainParticle extends GenericParticle{
|
||||||
public function __construct(Vector3 $pos, Block $b){
|
public function __construct(Vector3 $pos, Block $b){
|
||||||
parent::__construct($pos, Particle::TYPE_TERRAIN, BlockFactory::toStaticRuntimeId($b->getId(), $b->getDamage()));
|
parent::__construct($pos, Particle::TYPE_TERRAIN, $b->getRuntimeId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user