fixed painting particles, removed DestroyParticle

it didn't last long because they changed how this works... yuk
This commit is contained in:
Dylan K. Taylor 2018-04-09 16:26:15 +01:00
parent 05a1e61e5b
commit 646455f6e8
3 changed files with 20 additions and 50 deletions

View File

@ -23,12 +23,14 @@ declare(strict_types=1);
namespace pocketmine\entity\object;
use pocketmine\block\Block;
use pocketmine\block\BlockFactory;
use pocketmine\entity\Entity;
use pocketmine\event\entity\EntityDamageByEntityEvent;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\level\Level;
use pocketmine\level\particle\DestroyParticle;
use pocketmine\level\particle\DestroyBlockParticle;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\ByteTag;
@ -100,7 +102,7 @@ class Painting extends Entity{
//non-living entities don't have a way to create drops generically yet
$this->level->dropItem($this, ItemFactory::get(Item::PAINTING));
}
$this->level->addParticle(new DestroyParticle($this->add(0.5, 0.5, 0.5), Item::PAINTING));
$this->level->addParticle(new DestroyBlockParticle($this->add(0.5, 0.5, 0.5), BlockFactory::get(Block::PLANKS)));
}
protected function recalculateBoundingBox() : void{

View File

@ -26,10 +26,24 @@ namespace pocketmine\level\particle;
use pocketmine\block\Block;
use pocketmine\block\BlockFactory;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class DestroyBlockParticle extends DestroyParticle{
class DestroyBlockParticle extends Particle{
/** @var int */
protected $data;
public function __construct(Vector3 $pos, Block $b){
parent::__construct($pos, BlockFactory::toStaticRuntimeId($b->getId(), $b->getDamage()));
parent::__construct($pos->x, $pos->y, $pos->z);
$this->data = BlockFactory::toStaticRuntimeId($b->getId(), $b->getDamage());
}
public function encode(){
$pk = new LevelEventPacket;
$pk->evid = LevelEventPacket::EVENT_PARTICLE_DESTROY;
$pk->position = $this->asVector3();
$pk->data = $this->data;
return $pk;
}
}

View File

@ -1,46 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\level\particle;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class DestroyParticle extends Particle{
/** @var int */
protected $data;
public function __construct(Vector3 $pos, int $data){
parent::__construct($pos->x, $pos->y, $pos->z);
$this->data = $data;
}
public function encode(){
$pk = new LevelEventPacket;
$pk->evid = LevelEventPacket::EVENT_PARTICLE_DESTROY;
$pk->position = $this->asVector3();
$pk->data = $this->data;
return $pk;
}
}