グロウストーンって街灯とかを作るとき重宝するけど、すぐ壊せるからけっこう荒らされるんだよなぁ...
そんな悔しい思いをしている鯖主さん達に朗報です!簡単なコードを入れるだけで、サバイバルでは破壊できないグロウストーンができますよ!
まずはsrc→pocketmine→block→Glowstoneの順にフォルダやファイルを開いていきましょう。
するとこんな画面が出ます。
public function getHardness(){
return 1.5;
}
の下に↓のコードを入れるだけで完了となります。
変更後↓
これでサバイバルでは破壊ができなくなりました。この方法を使えば、ガラスや羊毛なども破壊不可にできます。
〜srcを駆使し、良い鯖主ライフを送ってくださいね。応援しています。〜
するとこんな画面が出ます。
<?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\item\Item; class Glowstone extends Transparent{ protected $id = self::GLOWSTONE_BLOCK; public function __construct(){ } public function getName(){ return "Glowstone"; } public function getHardness(){ return 1.5; } public function getLightLevel(){ return 15; } public function getDrops(Item $item){ return [ [Item::GLOWSTONE_DUST, 0, \mt_rand(2, 4)], ]; } }
public function getHardness(){
return 1.5;
}
の下に↓のコードを入れるだけで完了となります。
public function isBreakable(Item $item){ return false; }
変更後↓
* * ____ _ _ __ __ _ __ __ ____ * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * 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\item\Item; class Glowstone extends Transparent{ protected $id = self::GLOWSTONE_BLOCK; public function __construct(){ } public function getName(){ return "Glowstone"; } public function getHardness(){ return 1.5; } public function isBreakable(Item $item){ return false; } public function getLightLevel(){ return 15; } public function getDrops(Item $item){ return [ [Item::GLOWSTONE_DUST, 0, \mt_rand(2, 4)], ]; } }
これでサバイバルでは破壊ができなくなりました。この方法を使えば、ガラスや羊毛なども破壊不可にできます。
〜srcを駆使し、良い鯖主ライフを送ってくださいね。応援しています。〜
最新コメント