mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-28 06:09:57 +00:00
More awesomeness, No AI flag!
This commit is contained in:
parent
38f3dda13b
commit
4e934654ef
@ -105,6 +105,7 @@ use pocketmine\network\protocol\SetSpawnPositionPacket;
|
|||||||
use pocketmine\network\protocol\SetTimePacket;
|
use pocketmine\network\protocol\SetTimePacket;
|
||||||
use pocketmine\network\protocol\StartGamePacket;
|
use pocketmine\network\protocol\StartGamePacket;
|
||||||
use pocketmine\network\protocol\TakeItemEntityPacket;
|
use pocketmine\network\protocol\TakeItemEntityPacket;
|
||||||
|
use pocketmine\network\protocol\UpdateBlockPacket;
|
||||||
use pocketmine\network\SourceInterface;
|
use pocketmine\network\SourceInterface;
|
||||||
use pocketmine\permission\PermissibleBase;
|
use pocketmine\permission\PermissibleBase;
|
||||||
use pocketmine\permission\PermissionAttachment;
|
use pocketmine\permission\PermissionAttachment;
|
||||||
@ -1714,7 +1715,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$target = $this->level->getBlock($blockVector);
|
$target = $this->level->getBlock($blockVector);
|
||||||
$block = $target->getSide($packet->face);
|
$block = $target->getSide($packet->face);
|
||||||
|
|
||||||
$this->level->sendBlocks([$this], [$target, $block]);
|
$this->level->sendBlocks([$this], [$target, $block], UpdateBlockPacket::FLAG_ALL_PRIORITY);
|
||||||
break;
|
break;
|
||||||
}elseif($packet->face === 0xff){
|
}elseif($packet->face === 0xff){
|
||||||
if($this->isCreative()){
|
if($this->isCreative()){
|
||||||
@ -1891,7 +1892,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$target = $this->level->getBlock($vector);
|
$target = $this->level->getBlock($vector);
|
||||||
$tile = $this->level->getTile($vector);
|
$tile = $this->level->getTile($vector);
|
||||||
|
|
||||||
$this->level->sendBlocks([$this], [$target]);
|
$this->level->sendBlocks([$this], [$target], UpdateBlockPacket::FLAG_ALL_PRIORITY);
|
||||||
|
|
||||||
if($tile instanceof Spawnable){
|
if($tile instanceof Spawnable){
|
||||||
$tile->spawnTo($this);
|
$tile->spawnTo($this);
|
||||||
|
@ -83,6 +83,7 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
const DATA_SHOW_NAMETAG = 3;
|
const DATA_SHOW_NAMETAG = 3;
|
||||||
const DATA_POTION_COLOR = 7;
|
const DATA_POTION_COLOR = 7;
|
||||||
const DATA_POTION_VISIBLE = 8;
|
const DATA_POTION_VISIBLE = 8;
|
||||||
|
const DATA_NO_AI = 15;
|
||||||
|
|
||||||
|
|
||||||
const DATA_FLAG_ONFIRE = 0;
|
const DATA_FLAG_ONFIRE = 0;
|
||||||
@ -1474,14 +1475,16 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*/
|
*/
|
||||||
public function setDataProperty($id, $type, $value){
|
public function setDataProperty($id, $type, $value){
|
||||||
$this->dataProperties[$id] = [$type, $value];
|
if($this->getDataProperty($id) !== $value){
|
||||||
|
$this->dataProperties[$id] = [$type, $value];
|
||||||
|
|
||||||
$targets = $this->hasSpawned;
|
$targets = $this->hasSpawned;
|
||||||
if($this instanceof Player){
|
if($this instanceof Player){
|
||||||
$targets[] = $this;
|
$targets[] = $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->sendData($targets, [$id => $this->dataProperties[$id]]);
|
$this->sendData($targets, [$id => $this->dataProperties[$id]]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,7 +161,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
/** @var FullChunk[]|Chunk[] */
|
/** @var FullChunk[]|Chunk[] */
|
||||||
private $chunks = [];
|
private $chunks = [];
|
||||||
|
|
||||||
/** @var Block[][] */
|
/** @var Vector3[][] */
|
||||||
protected $changedBlocks = [];
|
protected $changedBlocks = [];
|
||||||
|
|
||||||
/** @var ReversePriorityQueue */
|
/** @var ReversePriorityQueue */
|
||||||
@ -591,7 +591,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$p->unloadChunk($X, $Z);
|
$p->unloadChunk($X, $Z);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->sendBlocks($this->getUsingChunk($X, $Z), $blocks);
|
$this->sendBlocks($this->getUsingChunk($X, $Z), $blocks, UpdateBlockPacket::FLAG_ALL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -618,8 +618,12 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
if($b === null){
|
if($b === null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if($b instanceof Block){
|
||||||
$pk->records[] = [$b->x, $b->z, $b->y, $b->getId(), $b->getDamage(), $flags];
|
$pk->records[] = [$b->x, $b->z, $b->y, $b->getId(), $b->getDamage(), $flags];
|
||||||
|
}else{
|
||||||
|
$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);
|
||||||
|
$pk->records[] = [$b->x, $b->z, $b->y, $fullBlock >> 4, $fullBlock & 0xf, $flags];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Server::broadcastPacket($target, $pk);
|
Server::broadcastPacket($target, $pk);
|
||||||
}
|
}
|
||||||
|
@ -91,8 +91,9 @@ class FloatingTextParticle extends Particle{
|
|||||||
$pk->metadata = [
|
$pk->metadata = [
|
||||||
Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE, 1 << Entity::DATA_FLAG_INVISIBLE],
|
Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE, 1 << Entity::DATA_FLAG_INVISIBLE],
|
||||||
Entity::DATA_AIR => [Entity::DATA_TYPE_SHORT, 300],
|
Entity::DATA_AIR => [Entity::DATA_TYPE_SHORT, 300],
|
||||||
Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE, 1]
|
Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE, 1],
|
||||||
];
|
Entity::DATA_NO_AI => [Entity::DATA_TYPE_BYTE, 1]
|
||||||
|
];
|
||||||
|
|
||||||
$p[] = $pk;
|
$p[] = $pk;
|
||||||
}
|
}
|
||||||
|
@ -28,13 +28,14 @@ class UpdateBlockPacket extends DataPacket{
|
|||||||
public static $pool = [];
|
public static $pool = [];
|
||||||
public static $next = 0;
|
public static $next = 0;
|
||||||
|
|
||||||
const FLAG_NONE = 0b0;
|
const FLAG_NONE = 0b0000;
|
||||||
const FLAG_NEIGHBORS = 0b1;
|
const FLAG_NEIGHBORS = 0b0001;
|
||||||
const FLAG_NOGRAPHIC = 0b100;
|
const FLAG_NETWORK = 0b0010;
|
||||||
const FLAG_PRIORITY = 0b1000;
|
const FLAG_NOGRAPHIC = 0b0100;
|
||||||
|
const FLAG_PRIORITY = 0b1000;
|
||||||
|
|
||||||
const FLAG_ALL = self::FLAG_NEIGHBORS;
|
const FLAG_ALL = (self::FLAG_NEIGHBORS | self::FLAG_NETWORK);
|
||||||
const FLAG_ALL_PRIORITY = self::FLAG_NEIGHBORS | self::FLAG_PRIORITY;
|
const FLAG_ALL_PRIORITY = (self::FLAG_ALL | self::FLAG_PRIORITY);
|
||||||
|
|
||||||
public $records = []; //x, z, y, blockId, blockData, flags
|
public $records = []; //x, z, y, blockId, blockData, flags
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user