Solved Set Entity hooked by a fish hook

Discussion in 'Plugin Development' started by loman, Jul 7, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    loman

    Hello guys and I want to spawn an entity and hooked by the fish hook when PlayerFishEvent is triggered, as shown below:
    Code:java
    1. @EventHandler
    2. public void onfishbite(PlayerFishEvent e){
    3. if(e.getState().equals(PlayerFishEvent.State.BITE)){
    4. FishHook hook = e.getHook();
    5. hook.setHookedEntity(entity);
    6. }
    7. }


    However, hook.setHookedEntity(entity) cannot be resolved but it should according to Javadoc.
    Can anyone please give me a hand and tell me what's going on?
     
  2. Offline

    Shqep

    @loman
    If the "unresolved" is the IDE telling you, are you using the right version of API for development?
    If the "unresolved" is from runtime, are you running the server with the same version of the API?
     
  3. Offline

    loman

    @Shqep
    The "unresolved" is from the IDE, but I'm pretty sure that I am using the correct version of API, version 1-16-5.
     
  4. Offline

    Shqep

    @loman
    That method doesn't exist. "hookEntity" is a private and a final field, there's no setter. My bad, didn't check this.

    If there's something you can do with the FishHook instance, do it. I don't know a lot about this part. But pretty sure the setHookedEntity is from 1.17, the decompiled 1.16 versions didn't seem to have it.

    I guess, if you want custom hooked entity, you probably have to cancel the Bukkit event, and summon an entity at the hook yourself.
     
  5. Offline

    loman

  6. Offline

    Shqep

  7. Offline

    loman

    @Shqep
    Yes, but they just have the latest version, yikes. So I have to find from the third party's hosted API to ensure the method doesn't change in 1.16.5...
    However, sigh, seems the doc is wrong.
    Thanks for your help anyway. :)
     
    Shqep likes this.
Thread Status:
Not open for further replies.

Share This Page