Jump to content

entity type


Ayylmao420

Recommended Posts

Link to comment
Share on other sites

22 minutes ago, Ayylmao420 said:

I need it for my custom interaction method to choose the correct menu option,

    public boolean interactWithEntity(Entity entity, String option) {

So for objects it's getUID(), npc getIndex() etc but entity doesn't even give me such methods to check

Thats the whole point of having super classes, that they have their own custom methods. What you can do is overload the methods to have diff params depending on the entities super class.

Edited by Vilius
Link to comment
Share on other sites

9 minutes ago, Vilius said:

Thats the whole point of having super classes, that they have their own custom methods. What you can do is overload the methods to have diff params depending on the entities super class.

Correct, however overloading his method won't work in this case since he'll first need to cast to whatever more specific object it is first, before calling the method, in order for that to work.

I think the easiest solution, especially as you only have like 3 or 4 instances to check, would be to use instanceof. I doubt you'd want something fancier in this case...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...