Some blocks and entity fixes

This commit is contained in:
ArkQuark 2021-12-24 19:32:52 +03:00
parent 3ad75fc9b6
commit 406ab32504
5 changed files with 33 additions and 5 deletions

View file

@ -63,10 +63,13 @@ define("ENTITY_MOB", 2);
define("MOB_PIGMAN", 36);
define("ENTITY_OBJECT", 3);
define("OBJECT_TRIPOD_CAMERA", 62);
define("OBJECT_PRIMEDTNT", 65);
define("OBJECT_ARROW", 80);
define("OBJECT_SNOWBALL", 81);
define("OBJECT_EGG", 82);
define("OBJECT_PAINTING", 83);
define("OBJECT_MINECART", 84);
define("ENTITY_ITEM", 4);

View file

@ -98,8 +98,8 @@ define("SIGN", 323);
define("WOODEN_DOOR", 324);
define("BUCKET", 325);
define("MINECART", 329);
define("MINECART", 328);
define("SADDLE", 329);
define("IRON_DOOR", 330);
define("REDSTONE", 331);
define("REDSTONE_DUST", 331);

View file

@ -27,6 +27,15 @@ class CobwebBlock extends FlowableBlock{
$this->hardness = 25;
}
public function getDrops(Item $item, Player $player){
return array();
if ($item->isSword()){
return array(
array(287, 0, 1),
);
}
elseif ($item->isShears()){
return array(
array(COBWEB, 0, 1),
);
}
}
}

View file

@ -45,4 +45,11 @@ class DeadBushBlock extends FlowableBlock{
return false;
}
public function getDrops(Item $item, Player $player){
if($item->isShears()){
return array(
array(DEAD_BUSH, 0, 1),
);
}
}
}

View file

@ -136,7 +136,7 @@ class Entity extends Position{
$this->setHealth(10000000, "generic");
$this->server->schedule(5, array($this, "updateFuse"), array(), true);
$this->update();
}elseif($this->type === OBJECT_ARROW){
}elseif($this->type === (OBJECT_ARROW or OBJECT_SNOWBALL)){
$this->server->schedule(1210, array($this, "update")); //Despawn
$this->update();
}
@ -266,7 +266,7 @@ class Entity extends Position{
$this->close(); //Despawn timer
return false;
}
}elseif($this->class === ENTITY_OBJECT and ($this->type === OBJECT_ARROW) or ($this->type === OBJECT_SNOWBALL)){
}elseif($this->class === ENTITY_OBJECT and ($this->type === OBJECT_ARROW or OBJECT_SNOWBALL)){
if(($time - $this->spawntime) >= 60){
$this->close(); //Despawn timer
return false;
@ -750,6 +750,15 @@ class Entity extends Position{
"z" => $this->z,
"did" => 0,
));
}elseif($this->type === OBJECT_MINECART){
$player->dataPacket(MC_ADD_ENTITY, array(
"eid" => $this->eid,
"type" => $this->type,
"x" => $this->x,
"y" => $this->y,
"z" => $this->z,
"did" => 0,
));
}elseif($this->type === OBJECT_ARROW){
$player->dataPacket(MC_ADD_ENTITY, array(
"eid" => $this->eid,