From 406ab3250443289c856d70e491d85dd887f7b033 Mon Sep 17 00:00:00 2001 From: ArkQuark <74979909+ArkQuark@users.noreply.github.com> Date: Fri, 24 Dec 2021 19:32:52 +0300 Subject: [PATCH] Some blocks and entity fixes --- src/constants/GeneralConstants.php | 3 +++ src/constants/ItemIDs.php | 4 ++-- src/material/block/nonfull/Cobweb.php | 11 ++++++++++- src/material/block/plant/DeadBush.php | 7 +++++++ src/world/Entity.php | 13 +++++++++++-- 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/constants/GeneralConstants.php b/src/constants/GeneralConstants.php index 575dd1a2..6af9f80a 100644 --- a/src/constants/GeneralConstants.php +++ b/src/constants/GeneralConstants.php @@ -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); diff --git a/src/constants/ItemIDs.php b/src/constants/ItemIDs.php index eba8bca1..151941c7 100644 --- a/src/constants/ItemIDs.php +++ b/src/constants/ItemIDs.php @@ -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); diff --git a/src/material/block/nonfull/Cobweb.php b/src/material/block/nonfull/Cobweb.php index 4b82d9f6..77ce4ba0 100644 --- a/src/material/block/nonfull/Cobweb.php +++ b/src/material/block/nonfull/Cobweb.php @@ -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), + ); + } } } \ No newline at end of file diff --git a/src/material/block/plant/DeadBush.php b/src/material/block/plant/DeadBush.php index e5afe9b3..d36bf699 100644 --- a/src/material/block/plant/DeadBush.php +++ b/src/material/block/plant/DeadBush.php @@ -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), + ); + } + } } \ No newline at end of file diff --git a/src/world/Entity.php b/src/world/Entity.php index 5335f8ae..08cda07d 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -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,