Hey, I Want a create a New Object not in Minecraft Can I do that? Or is it not with plugin can I do that I want example create a New block or a new arm Can I do that? Or is it in Addon or a Mod?
Quoting "Resource packs, which hasn't been implemented yet". Although, resource packs have not been implemented yet! You can somewhat create your own custom blocks and items and within a .php file. You can also add different features to these and completely separate them from actual vanilla items and blocks! CustomBlock.php PHP: <?phpnamespace CustomBlock;use pocketmine\block\Transparent;use pocketmine\item\Item;use pocketmine\item\Tool;use pocketmine\math\Vector3;use pocketmine\Player;use pocketmine\block\Block;class CustomBlock extends Transparent{protected $id = #number // block idprivate $temporalVector = null; public function __construct(){ if($this->temporalVector === null){ $this->temporalVector = new Vector3(0, 0, 0); } } public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ if($player instanceof Player){ $this->meta = $player->getDirection() & 0x01; } $this->getLevel()->setBlock($block, $this, true, true); return true; } public function getName() : string{ return "CustomBlock!"; } public function getHardness() { return -1; } public function getResistance(){ return 0; } public function getToolType(){ return Tool::TYPE_PICKAXE; // or TYPE_AXE and so on! } public function canPassThrough(){ return true; // or false } public function hasEntityCollision(){ return true; // or false }} Main.php (onEnable) PHP: public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this,$this); Block::$list[/* CUSTOM BLOCK ID FROM CUSTOMBLOCK.PHP*/] = CustomBlock::class;}
From Block.php, there must be a litter more of an extension.. PHP: /** @var Block::class $class*/ //Block::$list[$id] = $class; $block = new $class(); for($data = 0; $data < 16; ++$data){ Block::$fullList[($id << 4) | $data] = new $class($data); } /** @var Block $block */ Block::$solid[$id] = $block->isSolid(); Block::$transparent[$id] = $block->isTransparent(); Block::$hardness[$id] = $block->getHardness(); Block::$light[$id] = $block->getLightLevel(); Block::$lightFilter[$id] = 1;
i mean create a custom block problem, can we create custom block with custom id (1000,2000,etc...) , traits (solid, transparent,etc...) ,etc... ? and how can we do that in PM4?