mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Merge branch 'release/3.1' into release/3.2
This commit is contained in:
commit
a0bb747d6d
@ -2785,7 +2785,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
break; //TODO
|
||||
case PlayerActionPacket::ACTION_CONTINUE_BREAK:
|
||||
$block = $this->level->getBlock($pos);
|
||||
$this->level->broadcastLevelEvent($pos, LevelEventPacket::EVENT_PARTICLE_PUNCH_BLOCK, BlockFactory::toStaticRuntimeId($block->getId(), $block->getDamage()) | ($packet->face << 24));
|
||||
$this->level->broadcastLevelEvent($pos, LevelEventPacket::EVENT_PARTICLE_PUNCH_BLOCK, $block->getRuntimeId() | ($packet->face << 24));
|
||||
//TODO: destroy-progress level event
|
||||
break;
|
||||
case PlayerActionPacket::ACTION_START_SWIMMING:
|
||||
|
@ -109,6 +109,14 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
return $this->itemId ?? $this->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return int
|
||||
*/
|
||||
public function getRuntimeId() : int{
|
||||
return BlockFactory::toStaticRuntimeId($this->getId(), $this->getDamage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
|
@ -71,7 +71,7 @@ class FallingBlock extends Entity{
|
||||
|
||||
$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{
|
||||
|
@ -872,16 +872,12 @@ class Level implements ChunkManager, Metadatable{
|
||||
$pk->z = $b->z;
|
||||
|
||||
if($b instanceof Block){
|
||||
$blockId = $b->getId();
|
||||
$blockData = $b->getDamage();
|
||||
$pk->blockRuntimeId = $b->getRuntimeId();
|
||||
}else{
|
||||
$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);
|
||||
$blockId = $fullBlock >> 4;
|
||||
$blockData = $fullBlock & 0xf;
|
||||
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($fullBlock >> 4, $fullBlock & 0xf);
|
||||
}
|
||||
|
||||
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($blockId, $blockData);
|
||||
|
||||
$pk->flags = $first ? $flags : UpdateBlockPacket::FLAG_NONE;
|
||||
|
||||
$packets[] = $pk;
|
||||
@ -898,16 +894,12 @@ class Level implements ChunkManager, Metadatable{
|
||||
$pk->z = $b->z;
|
||||
|
||||
if($b instanceof Block){
|
||||
$blockId = $b->getId();
|
||||
$blockData = $b->getDamage();
|
||||
$pk->blockRuntimeId = $b->getRuntimeId();
|
||||
}else{
|
||||
$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);
|
||||
$blockId = $fullBlock >> 4;
|
||||
$blockData = $fullBlock & 0xf;
|
||||
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($fullBlock >> 4, $fullBlock & 0xf);
|
||||
}
|
||||
|
||||
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($blockId, $blockData);
|
||||
|
||||
$pk->flags = $flags;
|
||||
|
||||
$packets[] = $pk;
|
||||
@ -1864,7 +1856,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
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();
|
||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace pocketmine\level\particle;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
|
||||
@ -35,7 +34,7 @@ class DestroyBlockParticle extends Particle{
|
||||
|
||||
public function __construct(Vector3 $pos, Block $b){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z);
|
||||
$this->data = BlockFactory::toStaticRuntimeId($b->getId(), $b->getDamage());
|
||||
$this->data = $b->getRuntimeId();
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
|
@ -24,11 +24,10 @@ declare(strict_types=1);
|
||||
namespace pocketmine\level\particle;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class TerrainParticle extends GenericParticle{
|
||||
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