PocketMine-MP  1.4 - API 1.10.0
 All Classes Namespaces Functions Variables Pages
Stone.php
1 <?php
2 
3 /*
4  *
5  * ____ _ _ __ __ _ __ __ ____
6  * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7  * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8  * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9  * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * @author PocketMine Team
17  * @link http://www.pocketmine.net/
18  *
19  *
20 */
21 
22 namespace pocketmine\block;
23 
26 
27 class Stone extends Solid{
28  const NORMAL = 0;
29  const GRANITE = 1;
30  const POLISHED_GRANITE = 2;
31  const DIORITE = 3;
32  const POLISHED_DIORITE = 4;
33  const ANDESITE = 5;
34  const POLISHED_ANDESITE = 6;
35 
36  protected $id = self::STONE;
37 
38  public function __construct($meta = 0){
39  $this->meta = $meta;
40 
41  }
42 
43  public function getHardness(){
44  return 30;
45  }
46 
47  public function getName(){
48  static $names = [
49  self::NORMAL => "Stone",
50  self::GRANITE => "Granite",
51  self::POLISHED_GRANITE => "Polished Granite",
52  self::DIORITE => "Diorite",
53  self::POLISHED_DIORITE => "Polished Diorite",
54  self::ANDESITE => "Andesite",
55  self::POLISHED_ANDESITE => "Polished Andesite",
56  7 => "Unknown Stone",
57  ];
58  return $names[$this->meta & 0x07];
59  }
60 
61  public function getBreakTime(Item $item){
62  switch($item->isPickaxe()){
63  case 5:
64  return 0.4;
65  case 4:
66  return 0.5;
67  case 3:
68  return 0.75;
69  case 2:
70  return 0.25;
71  case 1:
72  return 1.5;
73  default:
74  return 7.5;
75  }
76  }
77 
78  public function getDrops(Item $item){
79  if($item->isPickaxe() >= Tool::TIER_WOODEN){
80  return [
81  [Item::COBBLESTONE, 0, 1],
82  ];
83  }else{
84  return [];
85  }
86  }
87 
88 }