Updating blocks and items

Added new blocks/items and added constants to existing blocks/items for
clearer recipe making.
This commit is contained in:
willowmaster66 2015-09-18 22:17:24 +02:00
parent cd6afb2020
commit a3bce67d35
11 changed files with 171 additions and 37 deletions

View File

@ -181,7 +181,7 @@ class Block extends Position implements Metadatable{
const LILY_PAD = 111;
const NETHER_BRICKS = 112;
const NETHER_BRICK_BLOCK = 112;
const NETHER_BRICK_FENCE = 113;
const NETHER_BRICKS_STAIRS = 114;
const ENCHANTING_TABLE = 116;
@ -413,7 +413,7 @@ class Block extends Position implements Metadatable{
self::$list[self::MYCELIUM] = Mycelium::class;
self::$list[self::WATER_LILY] = WaterLily::class;
self::$list[self::NETHER_BRICKS] = NetherBrick::class;
self::$list[self::NETHER_BRICK_FENCE] = NetherBrickFence::class;
self::$list[self::NETHER_BRICKS_STAIRS] = NetherBrickStairs::class;
self::$list[self::ENCHANTING_TABLE] = EnchantingTable::class;

View File

@ -49,7 +49,7 @@ class DoubleSlab extends Solid{
4 => "Brick",
5 => "Stone Brick",
6 => "Quartz",
7 => "",
7 => "Nether Brick",
];
return "Double " . $names[$this->meta & 0x07] . " Slab";
}

View File

@ -26,6 +26,12 @@ use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
class Fence extends Transparent{
const FENCE_OAK = 0;
const FENCE_SPRUCE = 1;
const FENCE_BIRCH = 2;
const FENCE_JUNGLE = 3;
const FENCE_ACACIA = 4;
const FENCE_DARKOAK = 5;
protected $id = self::FENCE;
@ -38,18 +44,18 @@ class Fence extends Transparent{
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
return Tool::TYPE_AXE;
}
public function getName(){
static $names = [
0 => "Oak Fence",
1 => "Spruce Fence",
2 => "Birch Fence",
3 => "Jungle Fence",
4 => "Acacia Fence",
5 => "Dark Oak Fence",
self::FENCE_OAK => "Oak Fence",
self::FENCE_SPRUCE => "Spruce Fence",
self::FENCE_BIRCH => "Birch Fence",
self::FENCE_JUNGLE => "Jungle Fence",
self::FENCE_ACACIA => "Acacia Fence",
self::FENCE_DARKOAK => "Dark Oak Fence",
"",
""
];

View File

@ -0,0 +1,72 @@
<?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\block\Block;
use pocketmine\block\Fence;
use pocketmine\item\Item;
//use pocketmine\item\Tool;
class NetherBrickFence extends Transparent {
public function __construct(){
parent::__construct(self::NETHER_BRICK_FENCE);
}
public function getBreakTime(Item $item){
if ($item instanceof Air){
//Breaking by hand
return 10;
}
else{
// Other breaktimes are equal to woodfences.
return parent::getBreakTime($item);
}
}
public function getHardness(){
return 2;
}
public function getToolType(){
//Different then the woodfences
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Nether Brick Fence";
}
public function canConnect(Block $block){
//TODO: activate comments when the NetherBrickFenceGate class has been created.
return ($block instanceof NetherBrickFence /* or $block instanceof NetherBrickFenceGate */) ? true : $block->isSolid() and !$block->isTransparent();
}
public function getDrops(Item $item){
if($item->isPickaxe()){
return [
[Item::FENCE, Fence::FENCE_NETHER_BRICK, 1],
];
}else{
return [];
}
}
}

View File

@ -26,6 +26,11 @@ use pocketmine\item\Tool;
class Quartz extends Solid{
const QUARTZ_NORMAL = 0;
const QUARTZ_CHISELED = 1;
const QUARTZ_PILLAR = 2;
const QUARTZ_PILLAR2 = 3;
protected $id = self::QUARTZ_BLOCK;
public function __construct($meta = 0){
@ -38,10 +43,10 @@ class Quartz extends Solid{
public function getName(){
static $names = [
0 => "Quartz Block",
1 => "Chiseled Quartz Block",
2 => "Quartz Pillar",
3 => "Quartz Pillar",
self::QUARTZ_NORMAL => "Quartz Block",
self::QUARTZ_CHISELED => "Chiseled Quartz Block",
self::QUARTZ_PILLAR => "Quartz Pillar",
self::QUARTZ_PILLAR2 => "Quartz Pillar",
];
return $names[$this->meta & 0x03];
}

View File

@ -26,6 +26,10 @@ use pocketmine\item\Tool;
class Sandstone extends Solid{
const NORMAL = 0;
const CHISELED = 1;
const SMOOTH = 2;
protected $id = self::SANDSTONE;
public function __construct($meta = 0){
@ -38,9 +42,9 @@ class Sandstone extends Solid{
public function getName(){
static $names = [
0 => "Sandstone",
1 => "Chiseled Sandstone",
2 => "Smooth Sandstone",
self::NORMAL => "Sandstone",
self::CHISELED => "Chiseled Sandstone",
self::SMOOTH => "Smooth Sandstone",
3 => "",
];
return $names[$this->meta & 0x03];

View File

@ -27,6 +27,14 @@ use pocketmine\math\AxisAlignedBB;
use pocketmine\Player;
class Slab extends Transparent{
const STONE = 0;
const SANDSTONE = 1;
const WOODEN = 2;
const COBBLESTONE = 3;
const BRICK = 4;
const STONE_BRICK = 5;
const QUARTZ = 6;
const NETHER_BRICK = 7;
protected $id = self::SLAB;
@ -40,14 +48,14 @@ class Slab extends Transparent{
public function getName(){
static $names = [
0 => "Stone",
1 => "Sandstone",
2 => "Wooden",
3 => "Cobblestone",
4 => "Brick",
5 => "Stone Brick",
6 => "Quartz",
7 => "",
self::STONE => "Stone",
self::SANDSTONE => "Sandstone",
self::WOODEN => "Wooden",
self::COBBLESTONE => "Cobblestone",
self::BRICK => "Brick",
self::STONE_BRICK => "Stone Brick",
self::QUARTZ => "Quartz",
self::NETHER_BRICK => "Nether Brick",
];
return (($this->meta & 0x08) > 0 ? "Upper " : "") . $names[$this->meta & 0x07] . " Slab";
}

View File

@ -25,6 +25,10 @@ use pocketmine\item\Item;
use pocketmine\item\Tool;
class StoneBricks extends Solid{
const NORMAL = 0;
const MOSSY = 1;
const CRACKED = 2;
const CHISELED = 3;
protected $id = self::STONE_BRICKS;
@ -42,10 +46,10 @@ class StoneBricks extends Solid{
public function getName(){
static $names = [
0 => "Stone Bricks",
1 => "Mossy Stone Bricks",
2 => "Cracked Stone Bricks",
3 => "Chiseled Stone Bricks",
self::NORMAL => "Stone Bricks",
self::MOSSY => "Mossy Stone Bricks",
self::CRACKED => "Cracked Stone Bricks",
self::CHISELED => "Chiseled Stone Bricks",
];
return $names[$this->meta & 0x03];
}

View File

@ -27,6 +27,8 @@ use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
class StoneWall extends Transparent{
const NONE_MOSSY_WALL = 0;
const MOSSY_WALL = 1;
protected $id = self::STONE_WALL;

View File

@ -25,6 +25,7 @@
namespace pocketmine\item;
use pocketmine\block\Block;
use pocketmine\block\Fence;
use pocketmine\block\Flower;
use pocketmine\entity\Entity;
use pocketmine\entity\Squid;
@ -209,7 +210,7 @@ class Item{
const LILY_PAD = 111;
const NETHER_BRICKS = 112;
const NETHER_BRICK_BLOCK = 112;
const NETHER_BRICK_FENCE = 113;
const NETHER_BRICKS_STAIRS = 114;
const ENCHANTING_TABLE = 116;
@ -484,6 +485,7 @@ class Item{
self::$list[self::BOWL] = Bowl::class;
self::$list[self::FEATHER] = Feather::class;
self::$list[self::BRICK] = Brick::class;
self::$list[self::QUARTZ] = NetherQuartz::class;
self::$list[self::LEATHER_CAP] = LeatherCap::class;
self::$list[self::LEATHER_TUNIC] = LeatherTunic::class;
self::$list[self::LEATHER_PANTS] = LeatherPants::class;
@ -649,6 +651,7 @@ class Item{
self::addCreativeItem(Item::get(Item::ICE, 0));
self::addCreativeItem(Item::get(Item::SNOW_BLOCK, 0));
self::addCreativeItem(Item::get(Item::END_STONE, 0));
self::addCreativeItem(Item::get(Item::QUARTZ, 0));
//Decoration
self::addCreativeItem(Item::get(Item::COBBLESTONE_WALL, 0));
@ -671,12 +674,13 @@ class Item{
self::addCreativeItem(Item::get(Item::GLASS_PANE, 0));
self::addCreativeItem(Item::get(Item::WOODEN_DOOR, 0));
self::addCreativeItem(Item::get(Item::TRAPDOOR, 0));
self::addCreativeItem(Item::get(Item::FENCE, 0));
self::addCreativeItem(Item::get(Item::FENCE, 1));
self::addCreativeItem(Item::get(Item::FENCE, 2));
self::addCreativeItem(Item::get(Item::FENCE, 3));
self::addCreativeItem(Item::get(Item::FENCE, 4));
self::addCreativeItem(Item::get(Item::FENCE, 5));
self::addCreativeItem(Item::get(Item::FENCE, Fence::FENCE_OAK));
self::addCreativeItem(Item::get(Item::FENCE, Fence::FENCE_SPRUCE));
self::addCreativeItem(Item::get(Item::FENCE, Fence::FENCE_BIRCH));
self::addCreativeItem(Item::get(Item::FENCE, Fence::FENCE_JUNGLE));
self::addCreativeItem(Item::get(Item::FENCE, Fence::FENCE_ACACIA));
self::addCreativeItem(Item::get(Item::FENCE, Fence::FENCE_DARKOAK));
self::addCreativeItem(Item::get(Item::NETHER_BRICK_FENCE, 0));
self::addCreativeItem(Item::get(Item::FENCE_GATE, 0));
self::addCreativeItem(Item::get(Item::FENCE_GATE_BIRCH, 0));
self::addCreativeItem(Item::get(Item::FENCE_GATE_SPRUCE, 0));

View File

@ -0,0 +1,29 @@
<?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\item;
class NetherQuartz extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::NETHER_QUARTZ, 0, $count, "Nether Quartz");
}
}