mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 11:45:30 +00:00
Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP
This commit is contained in:
commit
249e83db91
@ -1778,6 +1778,7 @@ class Player{
|
||||
$items = array(
|
||||
APPLE => 2,
|
||||
MUSHROOM_STEW => 10,
|
||||
//BEETROOT_SOUP => ??,
|
||||
BREAD => 5,
|
||||
RAW_PORKCHOP => 3,
|
||||
COOKED_PORKCHOP => 8,
|
||||
|
@ -187,6 +187,7 @@ define("CARPET", 171);
|
||||
|
||||
define("COAL_BLOCK", 173);
|
||||
|
||||
define("BEETROOT_BLOCK", 244);
|
||||
define("STONECUTTER", 245);
|
||||
define("GLOWING_OBSIDIAN", 246);
|
||||
define("NETHER_REACTOR", 247);
|
||||
|
@ -25,7 +25,6 @@ define("IRON_AXE", 258);//Implemented
|
||||
define("FLINT_STEEL", 259);
|
||||
define("FLINT_AND_STEEL", 259);
|
||||
define("APPLE", 260);//Implemented
|
||||
define("BEETROOT_SOUP", 260);//TODO: Change Item ID
|
||||
define("BOW", 261);
|
||||
define("ARROW", 262);
|
||||
define("COAL", 263);//Implemented
|
||||
@ -159,3 +158,7 @@ define("QUARTZ", 406);
|
||||
define("NETHER_QUARTZ", 406);
|
||||
|
||||
define("CAMERA", 456);
|
||||
define("BEETROOT", 457);
|
||||
define("BEETROOT_SEEDS", 458);
|
||||
define("BEETROOT_SEED", 458);
|
||||
define("BEETROOT_SOUP", 459);
|
@ -140,7 +140,8 @@ abstract class Block extends Position{
|
||||
CARPET => "CarpetBlock",
|
||||
|
||||
COAL_BLOCK => "CoalBlock",
|
||||
|
||||
|
||||
BEETROOT_BLOCK => "BeetrootBlock",
|
||||
STONECUTTER => "StonecutterBlock",
|
||||
GLOWING_OBSIDIAN => "GlowingObsidianBlock",
|
||||
NETHER_REACTOR => "NetherReactorBlock",
|
||||
|
@ -26,8 +26,8 @@ class Item{
|
||||
PUMPKIN_SEEDS => "PumpkinSeedsItem",
|
||||
MELON_SEEDS => "MelonSeedsItem",
|
||||
CARROT => "CarrotItem",
|
||||
BEETROOT_SOUP => "BeetrootSoupItem",
|
||||
POTATO => "PotatoItem",
|
||||
BEETROOT_SEEDS => "BeetrootSeedsItem",
|
||||
SIGN => "SignItem",
|
||||
WOODEN_DOOR => "WoodenDoorItem",
|
||||
BUCKET => "BucketItem",
|
||||
|
82
src/material/block/plant/Beetroot.php
Normal file
82
src/material/block/plant/Beetroot.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?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 BeetrootBlock extends FlowableBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(BETROOT_BLOCK, $meta, "Beetroot Block");
|
||||
$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 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 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(BEETROOT_SEEDS, 0, 1));
|
||||
$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{
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array();
|
||||
if($this->meta >= 0x07){
|
||||
$drops[] = array(BEETROOT, 0, 1);
|
||||
$drops[] = array(BEETROOT_SEEDS, 0, mt_rand(0, 3));
|
||||
}else{
|
||||
$drops[] = array(BEETROOT_SEEDS, 0, 1);
|
||||
}
|
||||
return $drops;
|
||||
}
|
||||
}
|
@ -19,8 +19,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
class BeetrootSoupItem extends Item{
|
||||
class BeetrootSeedsItem extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(BEETROOT_SOUP, 0, $count, "Beetroot Soup");
|
||||
$this->block = BlockAPI::get(BEETROOT_BLOCK);
|
||||
parent::__construct(BEETROOT_SEEDS, 0, $count, "Beetroot Seeds");
|
||||
}
|
||||
}
|
@ -143,6 +143,8 @@ class CraftingRecipes{
|
||||
"WOODEN_PLANKS:?x2,STICK:?x1=>WOODEN_SWORD:0x1",
|
||||
|
||||
//Food & protection
|
||||
"BEETROOT:?x4,BOWL:?x1=>BEETROOT_SOUP:0x1",
|
||||
"WOODEN_PLANKS:?x3=>BOWL:0x1",
|
||||
"WHEAT:?x3=>BREAD:0x1",
|
||||
"WHEAT:?x3,BUCKET:1x3,EGG:?x1,SUGAR:?x2=>CAKE:0x1",
|
||||
"DIAMOND:?x4=>DIAMOND_BOOTS:0x1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user