Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
turbodiesel4598 opened this issue Jul 30, 2019 · 7 comments

Comments

@turbodiesel4598
Copy link

commented Jul 30, 2019

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 :)

@AlexIIL

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

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?

@Dame-E-in

This comment has been minimized.

Copy link

commented Jul 30, 2019

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

@turbodiesel4598

This comment has been minimized.

Copy link
Author

commented Jul 30, 2019

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 :)

@AEnterprise

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

@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

@AlexIIL

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

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

@turbodiesel4598

This comment has been minimized.

Copy link
Author

commented Jul 30, 2019

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

@AlexIIL

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.