Jump to content

Checking if a TileEnity is extending a base class of my mod


traxys

Recommended Posts

Hello,

 

I have a base class for TileEnties , and I would like to know if there is a simple and quick way to check if a TileEntity at the given x y z coordinates in a world extends that base class (else I thik I will make a list of all the Blocks class of the TileEnities which extends my base class and check if this is similar to the tileEnt.blockType).

 

If anyone has an idea , or thinks the one I have is the way to go , please answer me,

Thank you.

Link to comment
Share on other sites

Sounds like a simple java programming question, I say go learn java, but just google "instanceof" I think that will help you solve your question

 

but a snippet of code that does what you want (you want to see if a normal tileEntity is a type of your custom one?) just use "if(World.getTileEntity(x,y,z) instanceof myTileEntityClass)"

 

I really recommend learning more Java.

Link to comment
Share on other sites

I had thank a bit of instanceof but was not quite sure it was the way to go then forgot about it....

 

BUT I have a small (big) problem I think is due to my java setup : instanceof is not recognized (Unexpected token) , and I tried to find a answer and google , I found none , so anyone has got a clue , or should I go and ask on a java/programming thing (like stackoverflow) ?

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.