Fixed data sending, more particles

This commit is contained in:
Shoghi Cervantes 2015-03-18 12:11:44 +01:00
parent c00370cfbf
commit b31604a536
6 changed files with 7 additions and 81 deletions

View File

@ -176,7 +176,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
$item = $this->getInventory()->getItemInHand();
$pk->item = $item->getId();
$pk->meta = $item->getDamage();
$pk->metadata = $this->getData();
$pk->metadata = $this->dataProperties;
$player->dataPacket($pk);
$player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);

View File

@ -60,7 +60,7 @@ class Villager extends Creature implements NPC, Ageable{
$pk->z = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->metadata = $this->getData();
$pk->metadata = $this->dataProperties;
$player->dataPacket($pk);
$player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
@ -80,4 +80,4 @@ class Villager extends Creature implements NPC, Ageable{
public function getProfession(){
return $this->namedtag["Profession"];
}
}
}

View File

@ -48,7 +48,7 @@ class Zombie extends Monster{
$pk->z = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->metadata = $this->getData();
$pk->metadata = $this->dataProperties;
$player->dataPacket($pk);
$player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
@ -78,4 +78,4 @@ class Zombie extends Monster{
return $drops;
}
}
}

View File

@ -1342,8 +1342,6 @@ class Level implements ChunkManager, Metadatable{
$target = $this->getBlock($vector);
$block = $target->getSide($face);
$this->addParticle(new \pocketmine\level\particle\FloatingTextParticle($target->add(0.5, 1.5, 0.5), "TESTTTTT\nSssass"));
if($block->y > 127 or $block->y < 0){
return false;
}

View File

@ -28,7 +28,7 @@ use pocketmine\network\protocol\AddMobPacket;
use pocketmine\network\protocol\EntityEventPacket;
use pocketmine\network\protocol\RemoveEntityPacket;
class HearthParticle extends Particle{
class HeartParticle extends Particle{
//TODO: HACK!
//TODO: needs more testing!
@ -42,7 +42,7 @@ class HearthParticle extends Particle{
$pk->eid = $entityId;
$pk->type = Wolf::NETWORK_ID;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->y = $this->y - 1;
$pk->z = $this->z;
$pk->pitch = 0;
$pk->yaw = 0;

View File

@ -1,72 +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/
*
*
*/
namespace pocketmine\level\particle;
use pocketmine\entity\Entity;
use pocketmine\entity\Wolf;
use pocketmine\math\Vector3;
use pocketmine\network\protocol\AddEntityPacket;
use pocketmine\network\protocol\AddMobPacket;
use pocketmine\network\protocol\EntityEventPacket;
use pocketmine\network\protocol\RemoveEntityPacket;
use pocketmine\network\protocol\SetEntityDataPacket;
class WaterParticle extends Particle{
//TODO: HACK!
protected $angle;
public function __construct(Vector3 $pos, $angle = 0){
parent::__construct($pos->x, $pos->y, $pos->z);
$this->angle = $angle;
}
public function encode(){
$entityId = bcadd("1095216660480", mt_rand(0, 0x7fffffff)); //No conflict with other things
$pk = new AddEntityPacket();
$pk->eid = $entityId;
$pk->type = 77;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->did = 0;
$pk2 = new SetEntityDataPacket();
$pk2->eid = $entityId;
$pk2->metadata = [
Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE, 1 << Entity::DATA_FLAG_INVISIBLE],
Entity::DATA_AIR => [Entity::DATA_TYPE_SHORT, 300],
2 => [Entity::DATA_TYPE_FLOAT, $this->x],
4 => [Entity::DATA_TYPE_FLOAT, $this->z],
8 => [Entity::DATA_TYPE_FLOAT, $this->angle]
];
$pk3 = new EntityEventPacket();
$pk3->eid = $entityId;
$pk3->event = 12;
$pk4 = new RemoveEntityPacket();
$pk4->eid = $entityId;
return [$pk, $pk2, $pk3, $pk4];
}
}