Jump to content

[1.12.2] Feeling more stupid by the minute


American2050

Recommended Posts

So I remember I read somewhere last week that we shouldn't BlockContainer when out block has a TileEntity and that we should Overrider instead this 2 methods.

 

hasTileEntity and createTileEntity

 

Which worked perfectly.

 

But today I was doing the exact same I did on the other mod I was trying it, but it didn't worked.

 

After triple checking everything I was thinking... nothing changed, so why the hell this is not working...

 

All the sudden I thought to check the Super Implementation and I saw that in one of my environments it was Deprecated.

 

Reading one of the descriptions I see:

 

Quote

Called throughout the code as a replacement for ITileEntityProvider.createNewTileEntity
     * Return the same thing you would from that function.
     * This will fall back to ITileEntityProvider.createNewTileEntity(World) if this block is a ITileEntityProvider

 

(Not 100% sure what the last line means)
But yes, then I went and implement ITileEntityProvider and added only the method createNewTileEntity

 

And everything works.

 

Now sadly I don't remember where I read about not using extends BlockContainer, but I believe they also mentioned there to not implement ITileEntityProvider but just override the 2 methods I mention above.

 

So not my question is, why it changed back to the use of ITileEntityProvider. Are we ok implementing that? Why were the other 2 methods Deprecated?

 

PS: Finally I think I need to find the way to let my software warm me somehow when I'm overriding deprecated methods :P

Link to comment
Share on other sites

There are two overloads of Block#hasTileEntity: one with no parameters and one with an IBlockState parameter. Only the one with no parameters is deprecated, the one with the IBlockState parameter is the one to override. 

  • Like 2

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

22 hours ago, Choonster said:

There are two overloads of Block#hasTileEntity: one with no parameters and one with an IBlockState parameter. Only the one with no parameters is deprecated, the one with the IBlockState parameter is the one to override. 

Ohh thanks, gonna look into that. I can't believe I missed that detail after all the times I checked over and over :P

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.

Announcements



×
×
  • Create New...

Important Information

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