Jump to content

[1.8] Tile entity deletes itself on block state change [SOLVED, NEW PROBLEM]


Recommended Posts

Posted

I wish I didn't have to ask about block states and my mod again, but...oh well. I'm making a furnace-like block, which is functional except that whenever it has a fuel item in the fuel slot and a cookable item in the cooking slot, rather than starting to cook it closes the GUI and when I open it again the items have vanished. I assume this means that the tile entity is deleting itself, but it isn't producing any errors so I don't really know. Here's the code:

 

Block (ignore the commented-out parts)

 

  Reveal hidden contents

 

 

Tile entity

 

  Reveal hidden contents

 

Posted
  On 4/13/2015 at 3:25 PM, diesieben07 said:

Non-vanilla TEs are always replaced when their BlockState changes. Override shouldRefresh in your TE to correct that.

 

Makes me wonder why Forge doesn't patch that.  Unless this behavior is the patch, in which case, I question someone's sanity.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
  On 4/13/2015 at 3:25 PM, diesieben07 said:

Non-vanilla TEs are always replaced when their BlockState changes. Override shouldRefresh in your TE to correct that.

I added this to the tile entity:

 

public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate)

    {

        return false;

    }

 

And now it cooks things like a furnace, but the block model doesn't change with the state like it's supposed to. Here's the blockstates json in case you need that:

 

{

  "variants": {

    "active=false": { "model": "braziermod:raisedbrazier" },

    "active=true": { "model": "braziermod:bigbrazier" }

  }

}

 

Both models work just fine, as I have tested by switching the false and true above.

Posted

Oops.

 

public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate)

    {

        return (oldState.getBlock() != newSate.getBlock());

    }

 

Also, I noticed an error in the launcher output, although it could be caused by some other mod I have installed:

 

[08:48:04] [Thread-10/ERROR]: Error in class 'LibraryLWJGLOpenAL'

[08:48:04] [Thread-10/ERROR]: Source '60ea8f7f-d987-4d46-904b-2690630d242c' not found in method 'play'

[08:48:04] [Thread-10/ERROR]: Error in class 'LibraryLWJGLOpenAL'

[08:48:04] [Thread-10/ERROR]: Source '60ea8f7f-d987-4d46-904b-2690630d242c' not found in method 'play'

Posted
  On 4/13/2015 at 3:44 PM, diesieben07 said:

  Quote
Makes me wonder why Forge doesn't patch that.  Unless this behavior is the patch, in which case, I question someone's sanity.

The vanilla behavior is: Always replace on metadata / BlockState change. Forge gives you the possibility to change it.

 

Yes, fine, but why does forge supply the default that it does? e.g. inconsistent with prior behavior.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.