mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-01 23:59:53 +00:00
Added Iron bars, Pumpkins, lit pumpkins and pumpkin grow, pumpkin growth, pumpkin seeds, pumpkin pie...
This commit is contained in:
parent
5fa6c5962e
commit
1ad00a453b
@ -1721,6 +1721,7 @@ class Player{
|
||||
RAW_CHICKEN => 2,
|
||||
MELON_SLICE => 2,
|
||||
GOLDEN_APPLE => 10,
|
||||
PUMPKIN_PIE => 8,
|
||||
//COOKIE => 2,
|
||||
//COOKED_FISH => 5,
|
||||
//RAW_FISH => 2,
|
||||
|
@ -120,12 +120,15 @@ define("REEDS", 83);
|
||||
define("SUGARCANE_BLOCK", 83);
|
||||
|
||||
define("FENCE", 85);
|
||||
|
||||
define("PUMPKIN", 86);
|
||||
define("NETHERRACK", 87);
|
||||
define("SOUL_SAND", 88);
|
||||
define("GLOWSTONE", 89);
|
||||
define("GLOWSTONE_BLOCK", 89);
|
||||
|
||||
|
||||
define("LIT_PUMPKIN", 91);
|
||||
define("JACK_O_LANTERN", 91);
|
||||
define("CAKE_BLOCK", 92);
|
||||
|
||||
define("TRAPDOOR", 96);
|
||||
@ -133,10 +136,12 @@ define("TRAPDOOR", 96);
|
||||
define("STONE_BRICKS", 98);
|
||||
define("STONE_BRICK", 98);
|
||||
|
||||
define("IRON_BAR", 101);
|
||||
define("IRON_BARS", 101);
|
||||
define("GLASS_PANE", 102);
|
||||
define("GLASS_PANEL", 102);
|
||||
define("MELON_BLOCK", 103);
|
||||
|
||||
define("PUMPKIN_STEM", 104);
|
||||
define("MELON_STEM", 105);
|
||||
|
||||
define("FENCE_GATE", 107);
|
||||
|
@ -132,7 +132,7 @@ define("BED", 355);
|
||||
define("SHEARS", 359);
|
||||
define("MELON", 360);
|
||||
define("MELON_SLICE", 360);
|
||||
|
||||
define("PUMPKIN_SEEDS", 361);
|
||||
define("MELON_SEEDS", 362);
|
||||
define("RAW_BEEF", 363);
|
||||
define("STEAK", 364);
|
||||
@ -143,6 +143,8 @@ define("COOKED_CHICKEN", 366);
|
||||
|
||||
define("SPAWN_EGG", 383);
|
||||
|
||||
define("PUMPKIN_PIE", 400);
|
||||
|
||||
define("NETHER_BRICK", 405);
|
||||
define("QUARTZ", 406);
|
||||
define("NETHER_QUARTZ", 406);
|
||||
|
@ -95,20 +95,22 @@ abstract class Block extends Position{
|
||||
SUGARCANE_BLOCK => "SugarcaneBlock",
|
||||
|
||||
FENCE => "FenceBlock",
|
||||
|
||||
PUMPKIN => "PumpkinBlock",
|
||||
NETHERRACK => "NetherrackBlock",
|
||||
SOUL_SAND => "SoulSandBlock",
|
||||
GLOWSTONE_BLOCK => "GlowstoneBlock",
|
||||
|
||||
LIT_PUMPKIN => "LitPumpkinBlock",
|
||||
CAKE_BLOCK => "CakeBlock",
|
||||
|
||||
TRAPDOOR => "TrapdoorBlock",
|
||||
|
||||
STONE_BRICKS => "StoneBricksBlock",
|
||||
|
||||
IRON_BARS => "IronBarsBlock",
|
||||
GLASS_PANE => "GlassPaneBlock",
|
||||
MELON_BLOCK => "MelonBlock",
|
||||
|
||||
PUMPKIN_STEM => "PumpkinStemBlock",
|
||||
MELON_STEM => "MelonStemBlock",
|
||||
|
||||
FENCE_GATE => "FenceGateBlock",
|
||||
|
@ -23,6 +23,7 @@ class Item{
|
||||
public static $class = array(
|
||||
SUGARCANE => "SugarcaneItem",
|
||||
WHEAT_SEEDS => "WheatSeedsItem",
|
||||
PUMPKIN_SEEDS => "PumpkinSeedsItem",
|
||||
MELON_SEEDS => "MelonSeedsItem",
|
||||
SIGN => "SignItem",
|
||||
WOODEN_DOOR => "WoodenDoorItem",
|
||||
|
27
src/material/block/nonfull/IronBars.php
Normal file
27
src/material/block/nonfull/IronBars.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class IronBarsBlock extends TransparentBlock{
|
||||
public function __construct(){
|
||||
parent::__construct(IRON_BARS, 0, "Iron Bars");
|
||||
}
|
||||
|
||||
}
|
87
src/material/block/plant/PumpkinStem.php
Normal file
87
src/material/block/plant/PumpkinStem.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class PumpkinStemBlock extends FlowableBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(PUMPKIN_STEM, $meta, "Pumpkin Stem");
|
||||
$this->isActivable = true;
|
||||
$this->hardness = 0;
|
||||
}
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(PUMPKIN_SEEDS, 0, mt_rand(0, 2)));
|
||||
$this->level->setBlock($this, new AirBlock(), false, false, true);
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
}elseif($type === BLOCK_UPDATE_RANDOM){
|
||||
if(mt_rand(0, 2) == 1){
|
||||
if($this->meta < 0x07){
|
||||
++$this->meta;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}else{
|
||||
for($side = 2; $side <= 5; ++$side){
|
||||
$b = $this->getSide($side);
|
||||
if($b->getID() === PUMPKIN){
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
}
|
||||
$side = $this->getSide(mt_rand(2,5));
|
||||
$d = $side->getSide(0);
|
||||
if($side->getID() === AIR and ($d->getID() === FARMLAND or $d->getID() === GRASS or $d->getID() === DIRT)){
|
||||
$this->level->setBlock($side, new PumpkinBlock(), true, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->count--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(PUMPKIN_SEEDS, 0, mt_rand(0, 2)),
|
||||
);
|
||||
}
|
||||
}
|
28
src/material/block/solid/LitPumpkin.php
Normal file
28
src/material/block/solid/LitPumpkin.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class LitPumpkinBlock extends SolidBlock{
|
||||
public function __construct(){
|
||||
parent::__construct(LIT_PUMPKIN, "Jack o'Lantern");
|
||||
$this->hardness = 5;
|
||||
}
|
||||
|
||||
}
|
28
src/material/block/solid/Pumpkin.php
Normal file
28
src/material/block/solid/Pumpkin.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class PumpkinBlock extends SolidBlock{
|
||||
public function __construct(){
|
||||
parent::__construct(PUMPKIN, "Pumpkin");
|
||||
$this->hardness = 5;
|
||||
}
|
||||
|
||||
}
|
@ -21,7 +21,7 @@
|
||||
|
||||
class SpongeBlock extends SolidBlock{
|
||||
public function __construct(){
|
||||
parent::__construct(SPONGE, $meta, "Sponge");
|
||||
parent::__construct(SPONGE, "Sponge");
|
||||
$this->hardness = 3;
|
||||
}
|
||||
|
||||
|
27
src/material/item/generic/PumpkinSeeds.php
Normal file
27
src/material/item/generic/PumpkinSeeds.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?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/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class PumpkinSeedsItem extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
$this->block = BlockAPI::get(PUMPKIN_STEM);
|
||||
parent::__construct(PUMPKIN_SEEDS, 0, $count, "Pumpkin Seeds");
|
||||
}
|
||||
}
|
@ -25,6 +25,7 @@ class CraftingRecipes{
|
||||
"CLAY:?x4=>CLAY_BLOCK:0x1",
|
||||
"WOODEN_PLANKS:?x4=>WORKBENCH:0x1",
|
||||
"GLOWSTONE_DUST:?x4=>GLOWSTONE_BLOCK:0x1",
|
||||
"PUMPKIN:?x1,TORCH:?x1=>LIT_PUMPKIN:0x1",
|
||||
"SNOWBALL:?x4=>SNOW_BLOCK:0x1",
|
||||
"WOODEN_PLANKS:?x2=>STICK:0x4",
|
||||
"COBBLESTONE:?x4=>STONECUTTER:0x1",
|
||||
@ -55,7 +56,10 @@ class CraftingRecipes{
|
||||
"COAL:0x1,STICK:?x1=>TORCH:0x4",
|
||||
"COAL:1x1,STICK:?x1=>TORCH:0x4",
|
||||
|
||||
//Food & protection
|
||||
//Food & protection
|
||||
"MELON_SLICE:?x1=>MELON_SEEDS:0x1",
|
||||
"PUMPKIN:?x1=>PUMPKIN_SEEDS:0x4",
|
||||
"PUMPKIN:?x1,EGG:?x1,SUGAR:?x1=>PUMPKIN_PIE:0x1",
|
||||
"BROWN_MUSHROOM:?x1,RED_MUSHROOM:?x1,BOWL:?x1=>MUSHROOM_STEW:0x1",
|
||||
"SUGARCANE:?x1=>SUGAR:0x1",
|
||||
"MELON_SLICE:?x1=>MELON_SEEDS:0x1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user