Posted August 21, 201411 yr 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.
August 21, 201411 yr 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. Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
August 22, 201411 yr Author 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) ?
August 22, 201411 yr Herm not sure whether this was a typing error in the post or your code, but instaceof is not recognized It's spelt instanceof
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.