Advertisement
Guest User

Untitled

a guest
Aug 8th, 2022
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. public function registerItems(): void{
  2. libItemRegistrar::getInstance()->registerItem(new class(new ItemIdentifier(ItemTypeIds::FISHING_ROD), "Fishing Rod") extends FishingRod {
  3. public function onClickAir(Player $player, Vector3 $directionVector) : ItemUseResult{
  4. if (!$player->hasItemCooldown($this)) {
  5. $player->resetItemCooldown($this);
  6.  
  7. if (Core::getFishingHook($player) === NULL) {
  8. $hook = new Hook($player->getLocation(), $player, new CompoundTag());
  9. $hook->spawnToAll();
  10. } else {
  11. if ($this != null && !$this->isNull()) {
  12. $hook = Core::getFishingHook($player);
  13. $hook->delete();
  14. }
  15. Core::setFishingHook(NULL, $player);
  16. }
  17. $player->broadcastAnimation(new ArmSwingAnimation($player));
  18. return ItemUseResult::SUCCESS();
  19. }
  20. return ItemUseResult::FAIL();
  21. }
  22. }, libItemRegistrar::getInstance()->getRuntimeIdByName(VanillaItems::FISHING_ROD()->getVanillaName()), true);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement