mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
paintings are separated from Entity.php, removed Moved too Quickly warning, small fixes with commands
This commit is contained in:
parent
218dd4ffa4
commit
af79b29f26
7 changed files with 49 additions and 28 deletions
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
//Useless Interface
|
||||
interface Attachable{
|
||||
|
||||
}
|
||||
|
|
@ -124,9 +124,7 @@ class Entity extends Position{
|
|||
$this->setHealth(1, "generic");
|
||||
//$this->setName((isset($objects[$this->type]) ? $objects[$this->type]:$this->type));
|
||||
$this->size = 1;
|
||||
if($this->type === OBJECT_PAINTING){
|
||||
$this->isStatic = true;
|
||||
}elseif($this->type === OBJECT_SNOWBALL){
|
||||
if($this->type === OBJECT_SNOWBALL){
|
||||
$this->server->schedule(1210, array($this, "update")); //Despawn
|
||||
$this->update();
|
||||
}elseif($this->type == OBJECT_MINECART){
|
||||
|
|
@ -161,10 +159,6 @@ class Entity extends Position{
|
|||
return $inv;
|
||||
}elseif($this->class === ENTITY_OBJECT){
|
||||
switch($this->type){
|
||||
case OBJECT_PAINTING:
|
||||
return array(
|
||||
array(PAINTING, 0, 1),
|
||||
);
|
||||
case OBJECT_MINECART:
|
||||
return array(
|
||||
array(MINECART, 0, 1),
|
||||
|
|
@ -672,16 +666,7 @@ class Entity extends Position{
|
|||
$player->dataPacket($pk);
|
||||
break;
|
||||
case ENTITY_OBJECT:
|
||||
if($this->type === OBJECT_PAINTING){
|
||||
$pk = new AddPaintingPacket;
|
||||
$pk->eid = $this->eid;
|
||||
$pk->x = (int) $this->x;
|
||||
$pk->y = (int) $this->y;
|
||||
$pk->z = (int) $this->z;
|
||||
$pk->direction = $this->getDirection();
|
||||
$pk->title = $this->data["Motive"];
|
||||
$player->dataPacket($pk);
|
||||
}elseif($this->type === OBJECT_MINECART){
|
||||
if($this->type === OBJECT_MINECART){
|
||||
$pk = new AddEntityPacket;
|
||||
$pk->eid = $this->eid;
|
||||
$pk->type = $this->type;
|
||||
|
|
@ -698,7 +683,6 @@ class Entity extends Position{
|
|||
$pk->speedY = $this->speedY;
|
||||
$pk->speedZ = $this->speedZ;
|
||||
$player->dataPacket($pk);
|
||||
|
||||
}
|
||||
break;
|
||||
case ENTITY_FALLING:
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ class EntityRegistry{
|
|||
self::registerEntity(Zombie::class);
|
||||
self::registerEntity(Arrow::class);
|
||||
self::registerEntity(PrimedTNT::class);
|
||||
self::registerEntity(Painting::class);
|
||||
}
|
||||
|
||||
/*Register an Entity*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
//Useless Class(or not so usless =D?)
|
||||
abstract class Hanging extends Entity implements Attachable{
|
||||
const CLASS_TYPE = ENTITY_OBJECT;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
class Painting extends Hanging{
|
||||
const TYPE = OBJECT_PAINTING;
|
||||
public function __construct(Level $level, $eid, $class, $type = 0, $data = array()){
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->x = isset($this->data["TileX"]) ? $this->data["TileX"]:$this->x;
|
||||
$this->y = isset($this->data["TileY"]) ? $this->data["TileY"]:$this->y;
|
||||
$this->z = isset($this->data["TileZ"]) ? $this->data["TileZ"]:$this->z;
|
||||
$this->setHealth(1, "generic");
|
||||
$this->size = 1;
|
||||
$this->isStatic = true;
|
||||
}
|
||||
|
||||
public function getDrops(){
|
||||
return array(array(PAINTING, 0, 1));
|
||||
}
|
||||
public function spawn($player){
|
||||
$pk = new AddPaintingPacket;
|
||||
$pk->eid = $this->eid;
|
||||
$pk->x = (int) $this->x;
|
||||
$pk->y = (int) $this->y;
|
||||
$pk->z = (int) $this->z;
|
||||
$pk->direction = $this->getDirection();
|
||||
$pk->title = $this->data["Motive"];
|
||||
$player->dataPacket($pk);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue