Added flowers compatible with MCPE 0.11.

Signed-off-by: Michael Yoo <michael@yoo.id.au>
This commit is contained in:
matcracker 2015-04-18 15:21:25 +02:00 committed by Michael Yoo
parent f64caf6c96
commit 388f5c2c91
No known key found for this signature in database
GPG Key ID: 409DBB63E3750CCD
3 changed files with 37 additions and 18 deletions

View File

@ -84,8 +84,7 @@ class Block extends Position implements Metadatable{
const DEAD_BUSH = 32; const DEAD_BUSH = 32;
const WOOL = 35; const WOOL = 35;
const DANDELION = 37; const DANDELION = 37;
const ROSE = 38; const RED_FLOWER = 38;
const POPPY = 38;
const BROWN_MUSHROOM = 39; const BROWN_MUSHROOM = 39;
const RED_MUSHROOM = 40; const RED_MUSHROOM = 40;
const GOLD_BLOCK = 41; const GOLD_BLOCK = 41;
@ -334,7 +333,7 @@ class Block extends Position implements Metadatable{
self::$list[self::DEAD_BUSH] = DeadBush::class; self::$list[self::DEAD_BUSH] = DeadBush::class;
self::$list[self::WOOL] = Wool::class; self::$list[self::WOOL] = Wool::class;
self::$list[self::DANDELION] = Dandelion::class; self::$list[self::DANDELION] = Dandelion::class;
self::$list[self::POPPY] = Poppy::class; self::$list[self::RED_FLOWER] = Flower::class;
self::$list[self::BROWN_MUSHROOM] = BrownMushroom::class; self::$list[self::BROWN_MUSHROOM] = BrownMushroom::class;
self::$list[self::RED_MUSHROOM] = RedMushroom::class; self::$list[self::RED_MUSHROOM] = RedMushroom::class;
self::$list[self::GOLD_BLOCK] = Gold::class; self::$list[self::GOLD_BLOCK] = Gold::class;

View File

@ -25,16 +25,38 @@ use pocketmine\item\Item;
use pocketmine\level\Level; use pocketmine\level\Level;
use pocketmine\Player; use pocketmine\Player;
class Poppy extends Flowable{ class Flower extends Flowable{
const POPPY = 0;
const BLUE_ORCHID = 1;
const ALLIUM = 2;
const AZURE_BLUET = 3;
const RED_TULIP = 4;
const ORANGE_TULIP = 5;
const WHITE_TULIP = 6;
const PINK_TULIP = 7;
const OXEYE_DAISY = 8;
protected $id = self::POPPY; protected $id = self::RED_FLOWER;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Poppy"; static $names = [
self::POPPY => "Poppy",
self::BLUE_ORCHID => "Blue Orchid",
self::ALLIUM => "Allium",
self::AZURE_BLUET => "Azure Bluet",
self::RED_TULIP => "Red Tulip",
self::ORANGE_TULIP => "Orange Tulip",
self::WHITE_TULIP => "White Tulip",
self::PINK_TULIP => "Pink Tulip",
self::OXEYE_DAISY => "Oxeye Daisy",
9 => "Unknown Flower",
];
return $names[$this->meta & 0x09];
} }

View File

@ -78,8 +78,7 @@ class Item{
const DEAD_BUSH = 32; const DEAD_BUSH = 32;
const WOOL = 35; const WOOL = 35;
const DANDELION = 37; const DANDELION = 37;
const ROSE = 38; const RED_FLOWER = 38;
const POPPY = 38;
const BROWN_MUSHROOM = 39; const BROWN_MUSHROOM = 39;
const RED_MUSHROOM = 40; const RED_MUSHROOM = 40;
const GOLD_BLOCK = 41; const GOLD_BLOCK = 41;
@ -499,7 +498,6 @@ class Item{
self::initCreativeItems(); self::initCreativeItems();
} }
private static $creative = []; private static $creative = [];
private static function initCreativeItems(){ private static function initCreativeItems(){
@ -645,15 +643,15 @@ class Item{
self::addCreativeItem(Item::get(Item::FURNACE, 0)); self::addCreativeItem(Item::get(Item::FURNACE, 0));
self::addCreativeItem(Item::get(Item::END_PORTAL, 0)); self::addCreativeItem(Item::get(Item::END_PORTAL, 0));
self::addCreativeItem(Item::get(Item::DANDELION, 0)); self::addCreativeItem(Item::get(Item::DANDELION, 0));
self::addCreativeItem(Item::get(Item::POPPY, 0)); self::addCreativeItem(Item::get(Item::RED_FLOWER, 0));
//TODO: blue orchid self::addCreativeItem(Item::get(Item::RED_FLOWER, 1));
//TODO: Allium self::addCreativeItem(Item::get(Item::RED_FLOWER, 2));
//TODO: Azure Bluet self::addCreativeItem(Item::get(Item::RED_FLOWER, 3));
//TODO: Red Tulip self::addCreativeItem(Item::get(Item::RED_FLOWER, 4));
//TODO: Orange Tulip self::addCreativeItem(Item::get(Item::RED_FLOWER, 5));
//TODO: White Tulip self::addCreativeItem(Item::get(Item::RED_FLOWER, 6));
//TODO: Pink Tulip self::addCreativeItem(Item::get(Item::RED_FLOWER, 7));
//TODO: Oxeye Daisy self::addCreativeItem(Item::get(Item::RED_FLOWER, 8));
//TODO: Lilac //TODO: Lilac
//TODO: Double Tallgrass //TODO: Double Tallgrass
//TODO: Large Fern //TODO: Large Fern