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

I don't know if ITileEntityProvider is a Forge implementation or not but just in case it is....

 

Suggestion:

 

Implement createTileEntity() in ITileEntityProvider to use the metadata value as provided by the call to createTileEntity() in Block.java

 

Details:

 

In Block.java, under the heading "Forge Start" we find an implementation of createTileEntity:

 

    public TileEntity createTileEntity(World world, int metadata)
    {
        if (isTileProvider)
        {
            return ((ITileEntityProvider)this).createNewTileEntity(world);
        }
        return null;
    }

 

which in turn calls to ITileEntityProvider, the actual implementation that gets overridden by modders. Unfortunately it neglects to pass the metadata value through to ITileEntityProvider thereby making this value unavailable.

 

The usefulness in having it is that the value can be passed into the TileEntity through its constructor (none of the TileEntity inherited properties: worldObj, xCoord, blockMetadata, etc. are available for use in the constructor) which would in turn allow modders some flexibility to make rudamentary decisions on how the TileEntity would be initialized.

Why not write an init method that your constructor calls?

Read the EAQ before posting! OR ELSE!

 

This isn't building better software, its trying to grab a place in the commit list of a highly visible github project.

 

www.forgeessentials.com

 

Don't PM me, I don't check this account unless I have to.

  • Author

ITileEntityProvider is not a forge addition (which you could have know by just looking at the package).

 

Well to be fair the package doesn't necessarily mean it's not forge. Take a look at net.minecraft.block.block and you'll see a giant comment called "FORGE START".

 

 

To make TileEntities with forge don't implement or extend anything. Just override

hasTileEntity(int metadata)

and

createTileEntity(World world, int metadata)

in your block.

 

Thanks for this tip. I was implementing ITileEntityProvider based on some research on the wiki and other sources. I guess things are a bit outdated now.

They are correct, any class that we add will NOT be in net.minecraft, it'll be in net.minecraftforge.

So ITileEntityProvider is NOT something we can edit as it'd break interfaces. However, as they said, you'd just override Block.hasTileEntity and Block.createTileEntity to do everything you need.

Mainly because ITileEntityProvider will never be applicable to anything except blocks. It doesn't seem logicial to have it as a interface :P

 

As for 'not in net.minecraftforge' we have to touch base classes, that's kinda our job. If we touch thing in a large way {like we do with Block/Item} we try to keep all of our code seperate, hence the 'Forge Start' comment. If you'd notice the bulk of our Block.java.path is adding new code in 1 big hunk :P

 

Basically, to sum it up, With Forge, ITileEntityProvider is obsolete, don't use it.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

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.