Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
Added block break tool type, fixed falling sand, fixed duplicated jun…
Browse files Browse the repository at this point in the history
…gle leaves
  • Loading branch information
shoghicp committed Jul 27, 2015
1 parent 866fde5 commit 0380e90
Show file tree
Hide file tree
Showing 75 changed files with 378 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/pocketmine/block/Chest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Compound;
Expand Down Expand Up @@ -52,6 +53,10 @@ public function getName(){
return "Chest";
}

public function getToolType(){
return Tool::TYPE_AXE;
}

protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x + 0.0625,
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/Clay.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;

class Clay extends Solid{

Expand All @@ -35,6 +36,10 @@ public function getHardness(){
return 0.6;
}

public function getToolType(){
return Tool::TYPE_SHOVEL;
}

public function getName(){
return "Clay Block";
}
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/Coal.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;

class Coal extends Solid{

Expand All @@ -35,6 +36,10 @@ public function getHardness(){
return 5;
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}

public function getName(){
return "Coal Block";
}
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/CoalOre.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;

class CoalOre extends Solid{

Expand All @@ -35,6 +36,10 @@ public function getHardness(){
return 3;
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}

public function getName(){
return "Coal Ore";
}
Expand Down
6 changes: 6 additions & 0 deletions src/pocketmine/block/CobblestoneStairs.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
namespace pocketmine\block;


use pocketmine\item\Tool;

class CobblestoneStairs extends Stair{

protected $id = self::COBBLESTONE_STAIRS;
Expand All @@ -34,6 +36,10 @@ public function getHardness(){
return 2;
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}

public function getName(){
return "Cobblestone Stairs";
}
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/Cobweb.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\item\Tool;

class Cobweb extends Flowable{

Expand All @@ -44,6 +45,10 @@ public function getHardness(){
return 4;
}

public function getToolType(){
return Tool::TYPE_SWORD;
}

public function onEntityCollide(Entity $entity){
$entity->resetFallDistance();
}
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/DarkOakWoodStairs.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;

class DarkOakWoodStairs extends Stair{

Expand All @@ -35,6 +36,10 @@ public function getName(){
return "Dark Oak Wood Stairs";
}

public function getToolType(){
return Tool::TYPE_AXE;
}

public function getDrops(Item $item){
return [
[$this->id, 0, 1],
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/Diamond.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;

class Diamond extends Solid{

Expand All @@ -39,6 +40,10 @@ public function getName(){
return "Diamond Block";
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}

public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
return [
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/DiamondOre.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;

class DiamondOre extends Solid{

Expand All @@ -39,6 +40,10 @@ public function getName(){
return "Diamond Ore";
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}

public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
return [
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/DoubleSlab.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;

class DoubleSlab extends Solid{

Expand All @@ -35,6 +36,10 @@ public function getHardness(){
return 2;
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}

public function getName(){
static $names = [
0 => "Stone",
Expand Down
4 changes: 4 additions & 0 deletions src/pocketmine/block/DoubleWoodSlab.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public function getHardness(){
return 2;
}

public function getToolType(){
return Tool::TYPE_AXE;
}

public function getName(){
static $names = [
0 => "Oak",
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/Emerald.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;

class Emerald extends Solid{

Expand All @@ -35,6 +36,10 @@ public function getHardness(){
return 5;
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}

public function getName(){
return "Emerald Block";
}
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/EmeraldOre.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;

class EmeraldOre extends Solid{

Expand All @@ -35,6 +36,10 @@ public function getName(){
return "Emerald Ore";
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}

public function getHardness(){
return 3;
}
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/EndStone.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;

class EndStone extends Solid{

Expand All @@ -35,6 +36,10 @@ public function getName(){
return "End Stone";
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}

public function getHardness(){
return 3;
}
Expand Down
3 changes: 2 additions & 1 deletion src/pocketmine/block/Fallable.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Double;
Expand All @@ -42,7 +43,7 @@ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy,

public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0);
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === self::AIR or ($down instanceof Liquid)){
$fall = Entity::createEntity("FallingSand", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new Compound("", [
"Pos" => new Enum("Pos", [
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/Farmland.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;

class Farmland extends Solid{
Expand All @@ -40,6 +41,10 @@ public function getHardness(){
return 0.6;
}

public function getToolType(){
return Tool::TYPE_SHOVEL;
}

protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x,
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/Fence.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

namespace pocketmine\block;

use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;

Expand All @@ -36,6 +37,10 @@ public function getHardness(){
return 2;
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}


public function getName(){
static $names = [
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/FenceGate.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\Player;

Expand All @@ -45,6 +46,10 @@ public function canBeActivated(){
return true;
}

public function getToolType(){
return Tool::TYPE_AXE;
}


protected function recalculateBoundingBox(){

Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/GlowingRedstoneOre.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\Level;

class GlowingRedstoneOre extends Solid{
Expand All @@ -40,6 +41,10 @@ public function getName(){
return "Glowing Redstone Ore";
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}

public function getLightLevel(){
return 9;
}
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/Glowstone.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;

class Glowstone extends Transparent{

Expand All @@ -39,6 +40,10 @@ public function getHardness(){
return 0.3;
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}

public function getLightLevel(){
return 15;
}
Expand Down
5 changes: 5 additions & 0 deletions src/pocketmine/block/Gold.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace pocketmine\block;

use pocketmine\item\Item;
use pocketmine\item\Tool;

class Gold extends Solid{

Expand All @@ -39,6 +40,10 @@ public function getHardness(){
return 3;
}

public function getToolType(){
return Tool::TYPE_PICKAXE;
}

public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
return [
Expand Down
Loading

0 comments on commit 0380e90

Please sign in to comment.