mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 10:49:10 +00:00
Merge branch 'Stonecutter-Recipes' of git://github.com/willowmaster66/PocketMine-MP into recipes-0.12-fix
Testing pull request.
This commit is contained in:
commit
72e9765ec8
@ -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;
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -26,7 +26,13 @@ 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;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
@ -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",
|
||||
"",
|
||||
""
|
||||
];
|
||||
|
72
src/pocketmine/block/NetherBrickFence.php
Normal file
72
src/pocketmine/block/NetherBrickFence.php
Normal 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 [];
|
||||
}
|
||||
}
|
||||
}
|
@ -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];
|
||||
}
|
||||
|
@ -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];
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -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];
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -21,8 +21,15 @@
|
||||
|
||||
namespace pocketmine\inventory;
|
||||
|
||||
|
||||
use pocketmine\block\Planks;
|
||||
use pocketmine\block\Quartz;
|
||||
use pocketmine\block\Sandstone;
|
||||
use pocketmine\block\Slab;
|
||||
use pocketmine\block\Fence;
|
||||
use pocketmine\block\Stone;
|
||||
use pocketmine\block\StoneBricks;
|
||||
use pocketmine\block\StoneWall;
|
||||
use pocketmine\block\Wood;
|
||||
use pocketmine\block\Wood2;
|
||||
use pocketmine\item\Item;
|
||||
@ -117,7 +124,7 @@ class CraftingManager{
|
||||
|
||||
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::BED, 0, 1)))->addIngredient(Item::get(Item::WOOL, null, 3))->addIngredient(Item::get(Item::WOODEN_PLANK, null, 3)));
|
||||
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::CHEST, 0, 1)))->addIngredient(Item::get(Item::WOODEN_PLANK, null, 8)));
|
||||
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, 0, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::OAK, 4)));
|
||||
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::OAK, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::OAK, 4)));
|
||||
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::SPRUCE, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::SPRUCE, 4)));
|
||||
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::BIRCH, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::BIRCH, 4)));
|
||||
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::JUNGLE, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::JUNGLE, 4)));
|
||||
@ -185,38 +192,142 @@ class CraftingManager{
|
||||
$this->registerRecipe(new FurnaceRecipe(Item::get(Item::HARDENED_CLAY, 0, 1), Item::get(Item::CLAY_BLOCK, 0, 1)));
|
||||
}
|
||||
|
||||
protected function registerStonecutter(){
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::QUARTZ_BLOCK, 0, 1)))->addIngredient(Item::get(Item::QUARTZ, 0, 4)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::BRICK_STAIRS, 0, 4)))->addIngredient(Item::get(Item::BRICKS_BLOCK, 0, 6)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::BRICKS_BLOCK, 0, 1)))->addIngredient(Item::get(Item::BRICK, 0, 4)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SLAB, 4, 6)))->addIngredient(Item::get(Item::BRICKS_BLOCK, 0, 3)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::QUARTZ_BLOCK, 1, 1)))->addIngredient(Item::get(Item::SLAB, 6, 2)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SLAB, 3, 6)))->addIngredient(Item::get(Item::COBBLESTONE, 0, 3)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::COBBLESTONE_WALL, 0, 6)))->addIngredient(Item::get(Item::COBBLESTONE, 0, 6)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::COBBLESTONE_WALL, 1, 6)))->addIngredient(Item::get(Item::MOSS_STONE, 0, 6)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::NETHER_BRICKS, 0, 1)))->addIngredient(Item::get(Item::NETHER_BRICK, 0, 4)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::NETHER_BRICKS_STAIRS, 0, 4)))->addIngredient(Item::get(Item::NETHER_BRICKS, 0, 6)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::QUARTZ_BLOCK, 2, 2)))->addIngredient(Item::get(Item::QUARTZ_BLOCK, 0, 2)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SLAB, 6, 6)))->addIngredient(Item::get(Item::QUARTZ_BLOCK, 0, 3)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SANDSTONE_STAIRS, 0, 4)))->addIngredient(Item::get(Item::SANDSTONE, 0, 6)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SANDSTONE, 0, 1)))->addIngredient(Item::get(Item::SAND, 0, 4)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SANDSTONE, 2, 4)))->addIngredient(Item::get(Item::SANDSTONE, 0, 4)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SANDSTONE, 1, 1)))->addIngredient(Item::get(Item::SLAB, 1, 2)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SLAB, 1, 6)))->addIngredient(Item::get(Item::SANDSTONE, 0, 3)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE_BRICK_STAIRS, 0, 4)))->addIngredient(Item::get(Item::STONE_BRICK, null, 6)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE_BRICK, 0, 4)))->addIngredient(Item::get(Item::STONE, null, 4)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE_BRICK, 3, 1)))->addIngredient(Item::get(Item::SLAB, 5, 2)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE_BRICK, 1, 1)))->addIngredient(Item::get(Item::STONE_BRICK, 0, 1))->addIngredient(Item::get(Item::VINES, 0, 1)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SLAB, 5, 6)))->addIngredient(Item::get(Item::STONE_BRICK, null, 3)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SLAB, 0, 6)))->addIngredient(Item::get(Item::STONE, null, 3)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::COBBLESTONE_STAIRS, 0, 4)))->addIngredient(Item::get(Item::COBBLESTONE, 0, 6)));
|
||||
protected function registerStonecutter(){
|
||||
$shapes = [
|
||||
"slab" => [
|
||||
" ",
|
||||
"XXX",
|
||||
" "
|
||||
],
|
||||
"stairs" => [
|
||||
"X ",
|
||||
"XX ",
|
||||
"XXX"
|
||||
],
|
||||
"wall/fence" => [
|
||||
"XXX",
|
||||
"XXX",
|
||||
" "
|
||||
],
|
||||
"blockrecipe1" => [
|
||||
"XX",
|
||||
"XX"
|
||||
],
|
||||
"blockrecipe2X1" => [
|
||||
" ",
|
||||
" X ",
|
||||
" X "
|
||||
],
|
||||
"blockrecipe2X2" => [
|
||||
"AB",
|
||||
"BA"
|
||||
],
|
||||
"blockrecipe1X2" => [
|
||||
" ",
|
||||
"AB"
|
||||
]
|
||||
];
|
||||
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE, Stone::POLISHED_GRANITE, 4)))->addIngredient(Item::get(Item::STONE, Stone::GRANITE, 4)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE, Stone::POLISHED_DIORITE, 4)))->addIngredient(Item::get(Item::STONE, Stone::DIORITE, 4)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE, Stone::POLISHED_ANDESITE, 4)))->addIngredient(Item::get(Item::STONE, Stone::ANDESITE, 4)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE, Stone::GRANITE, 1)))->addIngredient(Item::get(Item::STONE, Stone::DIORITE, 1))->addIngredient(Item::get(Item::QUARTZ, 0, 1)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE, Stone::DIORITE, 2)))->addIngredient(Item::get(Item::COBBLESTONE, 0, 2))->addIngredient(Item::get(Item::QUARTZ, 0, 2)));
|
||||
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE, Stone::ANDESITE, 2)))->addIngredient(Item::get(Item::COBBLESTONE, 0, 1))->addIngredient(Item::get(Item::STONE, Stone::DIORITE, 1)));
|
||||
$buildRecipes = [];
|
||||
|
||||
// Single ingedient stone cutter recipes:
|
||||
$RESULT_ITEMID = 0; $RESULT_META = 1; $INGREDIENT_ITEMID = 2; $INGREDIENT_META = 3; $RECIPE_SHAPE = 4;$RESULT_AMOUNT = 5;
|
||||
$recipes = [
|
||||
//RESULT_ITEM_ID RESULT_META INGREDIENT_ITEMID INGREDIENT_META RECIPE_SHAPE RESULT_AMOUNT
|
||||
[Item::SLAB, Slab::STONE, Item::STONE, Stone::NORMAL, "slab", 6],
|
||||
[Item::SLAB, Slab::COBBLESTONE, Item::COBBLESTONE, 0, "slab", 6],
|
||||
[Item::SLAB, Slab::SANDSTONE, Item::SANDSTONE, 0, "slab", 6],
|
||||
[Item::SLAB, Slab::BRICK, Item::BRICK, 0, "slab", 6],
|
||||
[Item::SLAB, Slab::STONE_BRICK, Item::STONE_BRICK, StoneBricks::NORMAL,"slab", 6],
|
||||
[Item::SLAB, Slab::NETHER_BRICK, Item::NETHER_BRICK_BLOCK, 0, "slab", 6],
|
||||
[Item::SLAB, Slab::QUARTZ, Item::QUARTZ_BLOCK, 0, "slab", 6],
|
||||
[Item::COBBLESTONE_STAIRS, 0, Item::COBBLESTONE, 0, "stairs", 4],
|
||||
[Item::SANDSTONE_STAIRS, 0, Item::SANDSTONE, 0, "stairs", 4],
|
||||
[Item::STONE_BRICK_STAIRS, 0, Item::STONE_BRICK, StoneBricks::NORMAL,"stairs", 4],
|
||||
[Item::BRICK_STAIRS, 0, Item::BRICKS_BLOCK, 0, "stairs", 4],
|
||||
[Item::NETHER_BRICKS_STAIRS,0, Item::NETHER_BRICK_BLOCK, 0, "stairs", 4],
|
||||
[Item::COBBLESTONE_WALL, StoneWall::NONE_MOSSY_WALL, Item::COBBLESTONE, 0, "wall/fence", 6],
|
||||
[Item::COBBLESTONE_WALL, StoneWall::MOSSY_WALL, Item::MOSSY_STONE, 0, "wall/fence", 6],
|
||||
[Item::NETHER_BRICK_FENCE, 0, Item::NETHER_BRICK_BLOCK, 0, "wall/fence", 6],
|
||||
[Item::NETHER_BRICKS, 0, Item::NETHER_BRICK, 0, "blockrecipe1", 1],
|
||||
[Item::SANDSTONE, SandStone::NORMAL, Item::SAND, 0, "blockrecipe1", 1],
|
||||
[Item::SANDSTONE, Sandstone::CHISELED, Item::SANDSTONE, SandStone::NORMAL, "blockrecipe1", 4],
|
||||
[Item::STONE_BRICK, StoneBricks::NORMAL, Item::STONE, Stone::NORMAL, "blockrecipe1", 4],
|
||||
[Item::STONE_BRICK, StoneBricks::NORMAL, Item::STONE, Stone::POLISHED_GRANITE,"blockrecipe1", 4],
|
||||
[Item::STONE_BRICK, StoneBricks::NORMAL, Item::STONE, Stone::POLISHED_DIORITE,"blockrecipe1", 4],
|
||||
[Item::STONE_BRICK, StoneBricks::NORMAL, Item::STONE, Stone::POLISHED_ANDESITE,"blockrecipe1",4],
|
||||
[Item::STONE, Stone::POLISHED_GRANITE, Item::STONE, Stone::GRANITE, "blockrecipe1", 4],
|
||||
[Item::STONE, Stone::POLISHED_DIORITE, Item::STONE, Stone::DIORITE, "blockrecipe1", 4],
|
||||
[Item::STONE, Stone::POLISHED_ANDESITE, Item::STONE, Stone::ANDESITE, "blockrecipe1", 4],
|
||||
[Item::QUARTZ_BLOCK, Quartz::QUARTZ_NORMAL, Item::QUARTZ, Stone::ANDESITE, "blockrecipe1", 4],
|
||||
[Item::QUARTZ_BLOCK, Quartz::QUARTZ_CHISELED, Item::SLAB, Slab::QUARTZ, "blockrecipe2X1", 1],
|
||||
[Item::SANDSTONE, SandStone::CHISELED, Item::SLAB, Slab::SANDSTONE, "blockrecipe2X1", 1],
|
||||
[Item::STONE_BRICK, StoneBricks::CHISELED, Item::SLAB, Slab::STONE_BRICK, "blockrecipe2X1", 1],
|
||||
];
|
||||
foreach ($recipes as $recipe){
|
||||
$buildRecipes[] = $this->createOneIngedientRecipe($shapes[$recipe[$RECIPE_SHAPE]], $recipe[$RESULT_ITEMID], $recipe[$RESULT_META], $recipe[$RESULT_AMOUNT], $recipe[$INGREDIENT_ITEMID], $recipe[$INGREDIENT_META], "X", "Stonecutter");
|
||||
}
|
||||
|
||||
// Multi-ingredient stone recipes:
|
||||
$buildRecipes[] = ((new StonecutterShapedRecipe(Item::get(Item::STONE, Stone::GRANITE, 1),
|
||||
...$shapes["blockrecipe1X2"]
|
||||
))->setIngredient("A", Item::get(Item::STONE, Stone::DIORITE, 1))->setIngredient("B", Item::get(Item::QUARTZ, Quartz::QUARTZ_NORMAL, 1)));
|
||||
$buildRecipes[] = ((new StonecutterShapedRecipe(Item::get(Item::STONE, Stone::DIORITE, 2),
|
||||
...$shapes["blockrecipe2X2"]
|
||||
))->setIngredient("A", Item::get(Item::COBBLESTONE, 0, 2))->setIngredient("B", Item::get(Item::QUARTZ, 0, 2)));
|
||||
$buildRecipes[] = ((new StonecutterShapedRecipe(Item::get(Item::STONE, Stone::ANDESITE, 2),
|
||||
...$shapes["blockrecipe1X2"]
|
||||
))->setIngredient("A", Item::get(Item::COBBLESTONE, 0, 1))->setIngredient("B", Item::get(Item::STONE, Stone::DIORITE, 1)));
|
||||
$buildRecipes[] = ((new StonecutterShapedRecipe(Item::get(Item::STONE_BRICK, StoneBricks::MOSSY, 1),
|
||||
...$shapes["blockrecipe1X2"]
|
||||
))->setIngredient("A", Item::get(Item::STONE_BRICK, StoneBricks::NORMAL, 1))->setIngredient("B", Item::get(Item::VINES, 0, 1)));
|
||||
|
||||
$this->sortAndAddRecipesArray($buildRecipes);
|
||||
}
|
||||
|
||||
private function sortAndAddRecipesArray(&$recipes){
|
||||
// Sort the recipes based on the result item name with the bubblesort algoritm.
|
||||
for ($i = 0; $i < count($recipes); ++$i){
|
||||
$current = $recipes[$i];
|
||||
$result = $current->getResult();
|
||||
for ($j = count($recipes)-1; $j > $i; --$j)
|
||||
{
|
||||
if ($this->sort($result, $recipes[$j]->getResult())>0){
|
||||
$swap = $current;
|
||||
$current = $recipes[$j];
|
||||
$recipes[$j] = $swap;
|
||||
$result = $current->getResult();
|
||||
}
|
||||
}
|
||||
$this->registerRecipe($current);
|
||||
}
|
||||
}
|
||||
|
||||
private function createOneIngedientRecipe($recipeshape, $resultitem, $resultitemmeta, $resultitemamound, $ingedienttype, $ingredientmeta, $ingredientname, $inventoryType = ""){
|
||||
$ingredientamount = 0;
|
||||
$height = 0;
|
||||
// count how many of the ingredient are in the recipe and check height for big or small recipe.
|
||||
foreach ($recipeshape as $line){
|
||||
$height += 1;
|
||||
$width = strlen($line);
|
||||
$ingredientamount += substr_count($line, $ingredientname);
|
||||
}
|
||||
$recipe = null;
|
||||
if ($height < 3){
|
||||
// Process small recipe
|
||||
$fullClassName = "pocketmine\\inventory\\".$inventoryType."ShapedRecipe";// $ShapeClass."ShapedRecipe";
|
||||
$recipe = ((new $fullClassName(Item::get($resultitem, $resultitemmeta, $resultitemamound),
|
||||
...$recipeshape
|
||||
))->setIngredient($ingredientname, Item::get($ingedienttype, $ingredientmeta, $ingredientamount)));
|
||||
}
|
||||
else{
|
||||
// Process big recipe
|
||||
$fullClassName = "pocketmine\\inventory\\".$inventoryType."BigShapedRecipe";
|
||||
$recipe = ((new $fullClassName(Item::get($resultitem, $resultitemmeta, $resultitemamound),
|
||||
...$recipeshape
|
||||
))->setIngredient($ingredientname, Item::get($ingedienttype, $ingredientmeta, $ingredientamount)));
|
||||
}
|
||||
return $recipe;
|
||||
}
|
||||
|
||||
protected function registerFood(){
|
||||
|
@ -21,6 +21,6 @@
|
||||
|
||||
namespace pocketmine\inventory;
|
||||
|
||||
class StonecutterShapelessRecipe extends ShapelessRecipe{
|
||||
class StonecutterBigShapedRecipe extends ShapedRecipe{
|
||||
|
||||
}
|
26
src/pocketmine/inventory/StonecutterShapedRecipe.php
Normal file
26
src/pocketmine/inventory/StonecutterShapedRecipe.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?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\inventory;
|
||||
|
||||
class StonecutterShapedRecipe extends ShapedRecipe{
|
||||
|
||||
}
|
@ -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));
|
||||
|
29
src/pocketmine/item/NetherQuartz.php
Normal file
29
src/pocketmine/item/NetherQuartz.php
Normal 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");
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user