Added Hardened Clay and Stained Clay

This commit is contained in:
Shoghi Cervantes 2014-06-16 16:02:01 +02:00
parent 28926832df
commit 778ec96d72
7 changed files with 133 additions and 6 deletions

View File

@ -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(),

View File

@ -0,0 +1,49 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
class HardenedClay extends Solid{
public function __construct(){
parent::__construct(self::HARDENED_CLAY, 0, "Hardened Clay");
$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;
}
}
}

View File

@ -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--;

View File

@ -0,0 +1,68 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
class StainedClay extends Solid{
public function __construct($meta = 0){
parent::__construct(self::STAINED_CLAY, $meta, "Stained Clay");
$names = array(
0 => "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;
}
}
}

View File

@ -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)));

View File

@ -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;

View File

@ -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: