Hi i want to add Brewing stand to pocketmine. I created two classes but i can not place it. PHP: <?phpnamespace pocketmine\block;use pocketmine\item\Item;use pocketmine\item\Tool;use pocketmine\nbt\NBT;use pocketmine\nbt\tag\Compound;use pocketmine\nbt\tag\Enum;use pocketmine\nbt\tag\Int;use pocketmine\nbt\tag\String;use pocketmine\Player;use pocketmine\tile\Tile;class BrewingStand extends Solid{ protected $id = self::BREWING_BLOCK; public function __construct($meta = 0){ $this->meta = $meta; } public function getName(){ return "Brewing Stand"; } public function canBeActivated(){ return true; } public function getHardness(){ return 0.5; } public function getToolType(){ return Tool::TYPE_PICKAXE; } public function getLightLevel(){ return 1; } public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ $this->meta = 0; $this->getLevel()->setBlock($block, $this, true, true); $nbt = new Compound("", [ new Enum("Items", []), new String("id", Tile::BREWING_STAND), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z) ]); $nbt->Items->setTagType(NBT::TAG_Compound); if($item->hasCustomName()){ $nbt->CustomName = new String("CustomName", $item->getCustomName()); } if($item->hasCustomBlockData()){ foreach($item->getCustomBlockData() as $key => $v){ $nbt->{$key} = $v; } } Tile::createTile("BrewingStand", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt); return true; } public function onBreak(Item $item){ $this->getLevel()->setBlock($this, new Air(), true, true); return true; } public function onActivate(Item $item, Player $player = null){ if($player instanceof Player){ $t = $this->getLevel()->getTile($this); if($t instanceof \pocketmine\tile\BrewingStand){ $brewing = $t; }else{ $nbt = new Compound("", [ new Enum("Items", []), new String("id", Tile::BREWING_STAND), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z) ]); $nbt->Items->setTagType(NBT::TAG_Compound); $brewing = Tile::createTile("BrewingStand", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt); } if(isset($brewing->namedtag->Lock) and $brewing->namedtag->Lock instanceof String){ if($brewing->namedtag->Lock->getValue() !== $item->getCustomName()){ return true; } } if($player->isCreative()){ return true; } $player->addWindow($brewing->getInventory()); } return true; } public function getDrops(Item $item){ $drops = []; if($item->isPickaxe() >= 1){ $drops[] = [Item::BREWING_STAND, 0, 1]; } return $drops; }} PHP: <?php/** * Created by PhpStorm. * User: Honza * Date: 10. 10. 2015 * Time: 12:51 */namespace pocketmine\item;use pocketmine\block\Block;class BrewingStand extends Item{ public function __construct($meta = 0, $count = 1){ $this->block = Block::get(Item::BREWING_STAND_BLOCK); parent::__construct(self::BREWING_STAND, 0, $count, "Brewing Stand"); } public function getMaxStackSize(){ return 1; }}
brewing is already implemented, but it is brewing block and item and i need to make placing brewing block using brewing item
Um.... Standart PocketMine for 0.12 isn't have BrewingStand tile class, please send to me your core. I want to add Brwing Stand and working potions into my PocketMine-Mechanic
Why not contribute the code to PocketMine directly? PM me if you need help with Git (since it is offtopic) while trying to do so.