Jump to content

entity type


Recommended Posts

Posted (edited)
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
Posted
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...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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