THIS IS SO FUNNY xD ! GO TRY IT xD!

This commit is contained in:
Ad5001 2016-12-24 11:42:02 +01:00
parent ca46db5931
commit 0f8638e629
2 changed files with 8 additions and 12 deletions

5
resources/config.yml Normal file
View File

@ -0,0 +1,5 @@
# Welcome to Elytras 2.x.x config !
# Here configure which block are considered "bouncable", enter their ids.
# Try going on those blocks by usini the elytra and the see the magic.
bouncable_blocks: [165, 88]

View File

@ -100,7 +100,7 @@ class Main extends PluginBase implements Listener {
$flyingup = false; $flyingup = false;
for($i = 4; $i > 0; $i--) { for($i = 4; $i > 0; $i--) {
$id = $player->getLevel()->getBlock(new \pocketmine\math\Vector3 (round($player->x), round($player->y) - $i, round($player->z)))->getId(); $id = $player->getLevel()->getBlock(new \pocketmine\math\Vector3 (round($player->x), round($player->y) - $i, round($player->z)))->getId();
if($id == 165 || $id == 88) { if(in_array($id, $this->getConfig()->get("bouncable_blocks"))) {
$flyingup = true; $flyingup = true;
} }
} }
@ -134,17 +134,8 @@ class Main extends PluginBase implements Listener {
break; break;
case "boost": case "boost":
if($sender instanceof Player && $sender->getInventory()->getChestplate()->getId() == 444) { if($sender instanceof Player && $sender->getInventory()->getChestplate()->getId() == 444) {
$itr = new BlockIterator($sender->getLevel(), $sender->getPosition(), $sender->getDirectionVector(), $sender->getEyeHeight(), 4); if(!isset($args[0])) $args[0] = 2;
$itr->next(); $sender->setMotion(new \pocketmine\math\Vector3($sender->getMotion()->x, $args[0], $sender->getMotion()->z));
$itr->next();
$itr->next();
$x = sqrt((new \pocketmine\math\Vector3($sender->x, 0, 0))->distanceSquared(new \pocketmine\math\Vector3($itr->current()->x, 0, 0)));
$y = sqrt((new \pocketmine\math\Vector3($sender->y, 0, 0))->distanceSquared(new \pocketmine\math\Vector3($itr->current()->y, 0, 0)));
$z = sqrt((new \pocketmine\math\Vector3($sender->z, 0, 0))->distanceSquared(new \pocketmine\math\Vector3($itr->current()->z, 0, 0)));
// $x -= $x * 2;
// $y -= $y * 2;
// $z -= $z * 2; // Inverting the number to go in the right direction.
$sender->setMotion(new \pocketmine\math\Vector3($x, $y, $z));
} }
break; break;
} }