mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
Fix TNT flashing, add explosion particles and add DATA_FUSE_LENGTH entity data constant
This commit is contained in:
parent
ae6e0773ef
commit
5e6d452678
@ -104,6 +104,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
* 52 (short) */
|
||||
const DATA_BOUNDING_BOX_WIDTH = 53; //float
|
||||
const DATA_BOUNDING_BOX_HEIGHT = 54; //float
|
||||
const DATA_FUSE_LENGTH = 55; //int
|
||||
/* 56 (vector3f)
|
||||
* 57 (byte)
|
||||
* 58 (float)
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* 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
|
||||
@ -15,7 +15,7 @@
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@ -57,6 +57,9 @@ class PrimedTNT extends Entity implements Explosive{
|
||||
}else{
|
||||
$this->fuse = 80;
|
||||
}
|
||||
|
||||
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_IGNITED, true);
|
||||
$this->setDataProperty(self::DATA_FUSE_LENGTH, self::DATA_TYPE_INT, $this->fuse);
|
||||
}
|
||||
|
||||
|
||||
@ -81,6 +84,11 @@ class PrimedTNT extends Entity implements Explosive{
|
||||
if($tickDiff <= 0 and !$this->justCreated){
|
||||
return true;
|
||||
}
|
||||
|
||||
if($this->fuse % 5 === 0){ //don't spam it every tick, it's not necessary
|
||||
$this->setDataProperty(self::DATA_FUSE_LENGTH, self::DATA_TYPE_INT, $this->fuse);
|
||||
}
|
||||
|
||||
$this->lastUpdate = $currentTick;
|
||||
|
||||
$hasUpdate = $this->entityBaseTick($tickDiff);
|
||||
|
@ -29,6 +29,7 @@ use pocketmine\event\entity\EntityDamageByEntityEvent;
|
||||
use pocketmine\event\entity\EntityDamageEvent;
|
||||
use pocketmine\event\entity\EntityExplodeEvent;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\particle\HugeExplodeSeedParticle;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Math;
|
||||
use pocketmine\math\Vector3;
|
||||
@ -221,6 +222,8 @@ class Explosion{
|
||||
$pk->records = $send;
|
||||
$this->level->addChunkPacket($source->x >> 4, $source->z >> 4, $pk);
|
||||
|
||||
$this->level->addParticle(new HugeExplodeSeedParticle($source));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user