mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 00:29:54 +00:00
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.
This commit is contained in:
parent
1c2ed0836f
commit
0f545c410a
@ -63,10 +63,10 @@ class Bow extends Tool{
|
|||||||
|
|
||||||
$diff = $player->getItemUseDuration();
|
$diff = $player->getItemUseDuration();
|
||||||
$p = $diff / 20;
|
$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){
|
if($entity instanceof Projectile){
|
||||||
$infinity = $this->hasEnchantment(Enchantment::INFINITY);
|
$infinity = $this->hasEnchantment(Enchantment::INFINITY);
|
||||||
if($entity instanceof ArrowEntity){
|
if($entity instanceof ArrowEntity){
|
||||||
@ -83,9 +83,9 @@ class Bow extends Tool{
|
|||||||
if($this->hasEnchantment(Enchantment::FLAME)){
|
if($this->hasEnchantment(Enchantment::FLAME)){
|
||||||
$entity->setOnFire(intdiv($entity->getFireTicks(), 20) + 100);
|
$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();
|
$ev->setCancelled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user