From 0f545c410a3d1d4e10cdfc48ff91ecd2cebd5950 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 15 Jan 2019 14:42:31 +0000 Subject: [PATCH] Bow: Improve consistency with vanilla (JE at least), closes #2660 This change causes the existing test I did to now report ~55-60 blocks, which is much closer to parity with vanilla. --- src/pocketmine/item/Bow.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pocketmine/item/Bow.php b/src/pocketmine/item/Bow.php index d6b3adf9b5f..48428b57652 100644 --- a/src/pocketmine/item/Bow.php +++ b/src/pocketmine/item/Bow.php @@ -63,10 +63,10 @@ public function onReleaseUsing(Player $player) : bool{ $diff = $player->getItemUseDuration(); $p = $diff / 20; - $force = min((($p ** 2) + $p * 2) / 3, 1) * 2; + $baseForce = min((($p ** 2) + $p * 2) / 3, 1); - $entity = Entity::createEntity("Arrow", $player->getLevel(), $nbt, $player, $force == 2); + $entity = Entity::createEntity("Arrow", $player->getLevel(), $nbt, $player, $baseForce >= 1); if($entity instanceof Projectile){ $infinity = $this->hasEnchantment(Enchantment::INFINITY); if($entity instanceof ArrowEntity){ @@ -83,9 +83,9 @@ public function onReleaseUsing(Player $player) : bool{ if($this->hasEnchantment(Enchantment::FLAME)){ $entity->setOnFire(intdiv($entity->getFireTicks(), 20) + 100); } - $ev = new EntityShootBowEvent($player, $this, $entity, $force); + $ev = new EntityShootBowEvent($player, $this, $entity, $baseForce * 3); - if($force < 0.1 or $diff < 5){ + if($baseForce < 0.1 or $diff < 5){ $ev->setCancelled(); }