Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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.

  • 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) ?

Herm not sure whether this was a typing error in the post or your code, but

instaceof is not recognized

It's spelt instanceof :P

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.