mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 11:18:52 +00:00
extra changes
This commit is contained in:
parent
2bf3f0de73
commit
6d5e2648cf
@ -50,6 +50,8 @@ abstract class Entity extends Position{
|
|||||||
public $lastUpdate;
|
public $lastUpdate;
|
||||||
public $maxFireTicks;
|
public $maxFireTicks;
|
||||||
public $fireTicks;
|
public $fireTicks;
|
||||||
|
public $namedtag;
|
||||||
|
|
||||||
protected $inWater;
|
protected $inWater;
|
||||||
public $noDamageTicks;
|
public $noDamageTicks;
|
||||||
private $justCreated;
|
private $justCreated;
|
||||||
@ -75,7 +77,7 @@ abstract class Entity extends Position{
|
|||||||
$this->level = $level;
|
$this->level = $level;
|
||||||
|
|
||||||
$this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
$this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
||||||
$this->setPosition(new Vector3($this->namedtag->x, $this->namedtag->y, $this->namedtag->z));
|
$this->setPosition(new Vector3($this->namedtag->Pos[0], $this->namedtag->Pos[1], $this->namedtag->Pos[2]));
|
||||||
$index = PMFLevel::getIndex($this->x >> 4, $this->z >> 4);
|
$index = PMFLevel::getIndex($this->x >> 4, $this->z >> 4);
|
||||||
$this->chunkIndex = $index;
|
$this->chunkIndex = $index;
|
||||||
Entity::$list[$this->id] = $this;
|
Entity::$list[$this->id] = $this;
|
||||||
@ -85,6 +87,12 @@ abstract class Entity extends Position{
|
|||||||
$this->initEntity();
|
$this->initEntity();
|
||||||
$this->server->api->dhandle("entity.add", $this);
|
$this->server->api->dhandle("entity.add", $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function saveNBT(){
|
||||||
|
$this->namedtag->Pos[0] = $this->x;
|
||||||
|
$this->namedtag->Pos[1] = $this->y;
|
||||||
|
$this->namedtag->Pos[2] = $this->z;
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract function initEntity();
|
protected abstract function initEntity();
|
||||||
|
|
||||||
@ -138,6 +146,8 @@ abstract class Entity extends Position{
|
|||||||
Entity::$needUpdate[$this->id] = $this;
|
Entity::$needUpdate[$this->id] = $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract function getMetadata();
|
||||||
|
|
||||||
public function setOnFire($seconds){
|
public function setOnFire($seconds){
|
||||||
$ticks = $seconds * 20;
|
$ticks = $seconds * 20;
|
||||||
if($ticks > $this->fireTicks){
|
if($ticks > $this->fireTicks){
|
||||||
|
@ -959,7 +959,7 @@ class Player{
|
|||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
$terrain = true;
|
$terrain = true;
|
||||||
|
|
||||||
foreach($this->server->api->player->getAll($this->level) as $player){
|
foreach($this->level->getPlayers() as $player){
|
||||||
if($player !== $this and $player->entity instanceof Entity){
|
if($player !== $this and $player->entity instanceof Entity){
|
||||||
$pk = new MoveEntityPacket_PosRot;
|
$pk = new MoveEntityPacket_PosRot;
|
||||||
$pk->eid = $player->entity->eid;
|
$pk->eid = $player->entity->eid;
|
||||||
|
@ -20,5 +20,50 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class HumanEntity extends CreatureEntity implements ProjectileSourceEntity{
|
class HumanEntity extends CreatureEntity implements ProjectileSourceEntity{
|
||||||
|
|
||||||
|
protected $nameTag;
|
||||||
|
|
||||||
|
protected function initEntity(){
|
||||||
|
if(isset($this->namedtag->nameTag)){
|
||||||
|
$this->nameTag = $this->namedtag->nameTag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function spawnTo(Player $player){
|
||||||
|
$pk = new AddPlayerPacket;
|
||||||
|
$pk->clientID = 0;
|
||||||
|
$pk->username = $this->nameTag;
|
||||||
|
$pk->eid = $this->id;
|
||||||
|
$pk->x = $this->x;
|
||||||
|
$pk->y = $this->y;
|
||||||
|
$pk->z = $this->z;
|
||||||
|
$pk->yaw = 0;
|
||||||
|
$pk->pitch = 0;
|
||||||
|
$pk->unknown1 = 0;
|
||||||
|
$pk->unknown2 = 0;
|
||||||
|
$pk->metadata = $this->getMetadata();
|
||||||
|
$player->dataPacket($pk);
|
||||||
|
|
||||||
|
/*
|
||||||
|
$pk = new SetEntityMotionPacket;
|
||||||
|
$pk->eid = $this->id;
|
||||||
|
$pk->speedX = $this->velocity->x;
|
||||||
|
$pk->speedY = $this->velocity->y;
|
||||||
|
$pk->speedZ = $this->velocity->z;
|
||||||
|
$player->dataPacket($pk);*/
|
||||||
|
|
||||||
|
$this->sendMotion($player);
|
||||||
|
|
||||||
|
/*
|
||||||
|
$pk = new PlayerEquipmentPacket;
|
||||||
|
$pk->eid = $this->id;
|
||||||
|
$pk->item = $this->player->getSlot($this->player->slot)->getID();
|
||||||
|
$pk->meta = $this->player->getSlot($this->player->slot)->getMetadata();
|
||||||
|
$pk->slot = 0;
|
||||||
|
$player->dataPacket($pk);*/
|
||||||
|
|
||||||
|
$this->sendEquipment($player)
|
||||||
|
|
||||||
|
$this->sendArmor($player);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user