BuildCraft|Builders

BuildCraft|Builders

6M Downloads

Tile Entities attached to changing blocks are refreshed/deleted when first activated if adjacent to a BC Pipe

tomdodd4598 opened this issue · 7 comments

commented

BuildCraft version: buildcraft-all-7.99.24.1
Forge version: 1.12.2--14.23.5.2838
Link to crash report or log: ~~~
Singleplayer or multiplayer: Only multiplayer
Steps to reproduce: Place a vanilla furnace, NC machine or any other TE which has two or more separate blocks for different 'states' adjacent to a BC pipe, and restart the server. After rejoining, trigger a block update, e.g. by putting fuel in the furnace, or activating the NC machine with redstone, etc, and the tile entity will be completely refreshed, deleting all previous information.
Additional information: May be related to #4439, but can't be sure.

The cause of this seems to be this line here. When the block changes, the method assumes that the TE has changed too, and the call to create a new TE deletes the old one. I understand that it is now common practise to use the same block and switch between meta states, but some TEs still don't do this. A possible solution might be to check if TileEntity::shouldRefresh(...) is true before recreating the TE :)

commented

It looks like the issue is that I was assuming that the Chunk always had all of it's tile entities, but that turns out to not be the case if a tile entity is added to the world while it is processing loaded tiles.

So I guess the fix is to always go the slow route (asking the world instead of the chunk).

commented

A possible solution might be to check if TileEntity::shouldRefresh(...) is true before recreating the TE :)

What's difficult with this is that when it gets to L98 I don't have a tile entity to check, either because it's not cached or because the old tile entity has been marked as invalid.

You mentioned printing stack traces - can you upload some to gist?

commented

Thank goodness someone figured this out lol. AE was saying that this couldn't be a BC issue.

commented

Hmm, I see. I think the chunk TE map is exposed, so perhaps something can be done with that? The stack trace was generated when the NC processor block's createNewTileEntity(...) was called, here it is :)

commented

@Dame-E-in because all a few (i saw like 2-3 reports?) reported was "this slot of a block get cleared when something that doesn't fit gets inserted", very different from what is being reported here

sure turns out to be the same bug, but those reports never had anything that pointed at BC specifically

commented

@turbodiesel4598 Thanks! I've reproduced it so hopefully it won't take too long to find out what's causing this.

commented

Awesome! At least this will be put to bed :)