Hi everyone I am trying to make a plugin and in this plugin you can shoot arrows from a stick. Now I want the stick to shoot the arrow straight, but this does not happen. I tried increasing $baseforce but that doesn't change anything. This is my code: PHP: public function onInteract(PlayerInteractEvent $e){ $player = $e->getPlayer(); if($e->getItem()->getId() == ItemIds::STICK){ $nbt = Entity::CreateBaseNBT( $player->add(0, $player->getEyeHeight() + 1, 0), $player->getDirectionVector(), ($player->yaw > 180 ? 360 : 0) - $player->yaw, -$player->pitch ); $diff = $player->getItemUseDuration(); $p = $diff / 20; $baseForce = min((($p ** 2) + $p * 2) / 3, 1); $entity = Entity::createEntity("Arrow", $player->getLevel(), $nbt, $player, true); $ev = new EntityShootBowEvent($player, new Bow, $entity, 50); $ev->call(); } } I hope someone can help!
Remove gravity equation from Arrow class? Arrow::$gravity = 0.5; (Link) Extend current Arrow class and modify that value. Just first idea that popped into my mind. Haven't been active nor following along the code changes.
Like this? PHP: public function onInteract(PlayerInteractEvent $e){ $player = $e->getPlayer(); if($e->getItem()->getId() == ItemIds::STICK){ $nbt = Entity::CreateBaseNBT( $player->add(0, $player->getEyeHeight() + 1, 0), $player->getDirectionVector(), ($player->yaw > 180 ? 360 : 0) - $player->yaw, -$player->pitch ); $entity = Entity::createEntity("Arrow", $player->getLevel(), $nbt, $player, true); $ev = new EntityShootBowEvent($player, new Bow, $entity, 50); $ev->call(); } }