diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index 686da7286..d8b2827d5 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -198,6 +198,8 @@ abstract class Block extends Position implements Metadatable{ const WOODEN_SLAB = 158; const WOOD_SLABS = 158; const WOODEN_SLABS = 158; + const STAINED_CLAY = 159; + const STAINED_HARDENED_CLAY = 159; const LEAVES2 = 161; const LEAVE2 = 161; @@ -209,7 +211,7 @@ abstract class Block extends Position implements Metadatable{ const HAY_BALE = 170; const CARPET = 171; - + const HARDENED_CLAY = 172; const COAL_BLOCK = 173; const BEETROOT_BLOCK = 244; @@ -553,14 +555,16 @@ abstract class Block extends Position implements Metadatable{ self::QUARTZ_STAIRS => new QuartzStairs(), self::DOUBLE_WOOD_SLAB => new DoubleWoodSlab(), self::WOOD_SLAB => new WoodSlab(), + self::STAINED_CLAY => new StainedClay(), + self::LEAVES2 => new Leaves2(), self::WOOD2 => new Wood2(), self::ACACIA_WOOD_STAIRS => new AcaciaWoodStairs(), self::DARK_OAK_WOOD_STAIRS => new DarkOakWoodStairs(), self::HAY_BALE => new HayBale(), self::CARPET => new Carpet(), - + self::HARDENED_CLAY => new HardenedClay(), self::COAL_BLOCK => new Coal(), self::BEETROOT_BLOCK => new Beetroot(), diff --git a/src/pocketmine/block/HardenedClay.php b/src/pocketmine/block/HardenedClay.php new file mode 100644 index 000000000..947ed8324 --- /dev/null +++ b/src/pocketmine/block/HardenedClay.php @@ -0,0 +1,49 @@ +hardness = 30; + } + + public function getBreakTime(Item $item){ + switch($item->isPickaxe()){ + case 5: + return 0.25; + case 4: + return 0.35; + case 3: + return 0.5; + case 2: + return 0.2; + case 1: + return 0.95; + default: + return 6.25; + } + } + +} \ No newline at end of file diff --git a/src/pocketmine/block/Sapling.php b/src/pocketmine/block/Sapling.php index 8bf4a4bf4..94fa70be9 100644 --- a/src/pocketmine/block/Sapling.php +++ b/src/pocketmine/block/Sapling.php @@ -62,6 +62,7 @@ class Sapling extends Flowable{ public function onActivate(Item $item, Player $player = null){ if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal + //TODO: change log type Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x07); if(($player->gamemode & 0x01) === 0){ $item->count--; diff --git a/src/pocketmine/block/StainedClay.php b/src/pocketmine/block/StainedClay.php new file mode 100644 index 000000000..1eaa041e6 --- /dev/null +++ b/src/pocketmine/block/StainedClay.php @@ -0,0 +1,68 @@ + "White Stained Clay", + 1 => "Orange Stained Clay", + 2 => "Magenta Stained Clay", + 3 => "Light Blue Stained Clay", + 4 => "Yellow Stained Clay", + 5 => "Lime Stained Clay", + 6 => "Pink Stained Clay", + 7 => "Gray Stained Clay", + 8 => "Light Gray Stained Clay", + 9 => "Cyan Stained Clay", + 10 => "Purple Stained Clay", + 11 => "Blue Stained Clay", + 12 => "Brown Stained Clay", + 13 => "Green Stained Clay", + 14 => "Red Stained Clay", + 15 => "Black Stained Clay", + ); + $this->name = $names[$this->meta]; + $this->hardness = 30; + } + + public function getBreakTime(Item $item){ + switch($item->isPickaxe()){ + case 5: + return 0.25; + case 4: + return 0.35; + case 3: + return 0.5; + case 2: + return 0.2; + case 1: + return 0.95; + default: + return 6.25; + } + } + +} \ No newline at end of file diff --git a/src/pocketmine/inventory/CraftingManager.php b/src/pocketmine/inventory/CraftingManager.php index 355e8bf16..839aec433 100644 --- a/src/pocketmine/inventory/CraftingManager.php +++ b/src/pocketmine/inventory/CraftingManager.php @@ -120,6 +120,8 @@ class CraftingManager{ $this->registerRecipe(new FurnaceRecipe(Item::get(Item::STEAK, 0, 1), Item::get(Item::RAW_BEEF, 0, 1))); $this->registerRecipe(new FurnaceRecipe(Item::get(Item::COOKED_CHICKEN, 0, 1), Item::get(Item::RAW_CHICKEN, 0, 1))); $this->registerRecipe(new FurnaceRecipe(Item::get(Item::BAKED_POTATO, 0, 1), Item::get(Item::POTATO, 0, 1))); + + $this->registerRecipe(new FurnaceRecipe(Item::get(Item::HARDENED_CLAY, 0, 1), Item::get(Item::CLAY_BLOCK, 0, 1))); } protected function registerStonecutter(){ @@ -213,7 +215,8 @@ class CraftingManager{ protected function registerDyes(){ for($i = 0; $i < 16; ++$i){ $this->registerRecipe((new ShapelessRecipe(Item::get(Item::WOOL, 15 - $i, 1)))->addIngredient(Item::get(Item::DYE, $i, 1))->addIngredient(Item::get(Item::WOOL, 0, 1))); - //TODO: add stained clay and glass things + $this->registerRecipe((new ShapelessRecipe(Item::get(Item::STAINED_CLAY, 15 - $i, 8)))->addIngredient(Item::get(Item::DYE, $i, 1))->addIngredient(Item::get(Item::HARDENED_CLAY, 0, 8))); + //TODO: add glass things? //$this->registerRecipe((new ShapelessRecipe(Item::get(Item::WOOL, 15 - $i, 1)))->addIngredient(Item::get(Item::DYE, $i, 1))->addIngredient(Item::get(Item::WOOL, 0, 1))); //$this->registerRecipe((new ShapelessRecipe(Item::get(Item::WOOL, 15 - $i, 1)))->addIngredient(Item::get(Item::DYE, $i, 1))->addIngredient(Item::get(Item::WOOL, 0, 1))); //$this->registerRecipe((new ShapelessRecipe(Item::get(Item::WOOL, 15 - $i, 1)))->addIngredient(Item::get(Item::DYE, $i, 1))->addIngredient(Item::get(Item::WOOL, 0, 1))); diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index cbd81296e..c2a286e65 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -196,6 +196,8 @@ class Item{ const WOODEN_SLAB = 158; const WOOD_SLABS = 158; const WOODEN_SLABS = 158; + const STAINED_CLAY = 159; + const STAINED_HARDENED_CLAY = 159; const LEAVES2 = 161; const LEAVE2 = 161; @@ -207,7 +209,7 @@ class Item{ const HAY_BALE = 170; const CARPET = 171; - + const HARDENED_CLAY = 172; const COAL_BLOCK = 173; const BEETROOT_BLOCK = 244; diff --git a/src/pocketmine/item/Tool.php b/src/pocketmine/item/Tool.php index 30605ef5b..2a0eefb2e 100644 --- a/src/pocketmine/item/Tool.php +++ b/src/pocketmine/item/Tool.php @@ -87,12 +87,12 @@ abstract class Tool extends Item{ public function isPickaxe(){ switch($this->id){ - case self::IRON_PICKAXE: - return 4; case self::WOODEN_PICKAXE: return 1; case self::STONE_PICKAXE: return 3; + case self::IRON_PICKAXE: + return 4; case self::DIAMOND_PICKAXE: return 5; case self::GOLD_PICKAXE: