Skip to content

Initialize client cubes before load events - #111

Merged
RecursivePineapple merged 3 commits into
GTNewHorizons:masterfrom
Jakfut:fix-client-tile-entity-reload
Aug 19, 2026
Merged

Initialize client cubes before load events#111
RecursivePineapple merged 3 commits into
GTNewHorizons:masterfrom
Jakfut:fix-client-tile-entity-reload

Conversation

@Jakfut

@Jakfut Jakfut commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Fixed issue where tile entities such as chests would be invisible after reloading the world with Angelica. CubicChunks posted CubeEvent.Load before decoding the cube, causing Angelica to load and cache it before tile entities were initialized

Tile entities are now initialized before posting the load event

@DarkShadow44 DarkShadow44 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, Angelica makes a snapshot on cube load, then continues to use that snapshot. Angelica seems to use the same loop in fillChunk but we need it for cubes as well. Correct?

  1. We might need to deal with stale tile entities. Vanilla Chunk.fillChunk ends with a stale-TE pass, shouldn't we also iterate with shouldRefresh and invalidate TEs?

  2. Not a new issue, but Angelica wraps chunkTileEntityMap in a ConcurrentTileEntityMap and has a CC-specific constructor for it, but that only locks the ColumnTileEntityMap. This unfortunately just forwards into Cube.cubeTileEntityMap which is a plain HashMap. Seems like ConcurrentModificationException waiting to happen.

  3. Can't we get rid of wasLoaded by skipping setCubeLoaded and world.getLightingManager().onCubeLoad(cube); client side and at the end of process doing

    if (!cube.isCubeLoaded()) {
      cube.onCubeLoad();
    }
    

    Seems like it should work

@RecursivePineapple

Copy link
Copy Markdown
Collaborator

I was investigating this and I noticed that the tile physically isn't created in the client world until the chest block receives a block update (typically from a player interacting with it somehow). Chests don't have description packets so the tiles aren't created when a cube first syncs.

@Jakfut
Jakfut force-pushed the fix-client-tile-entity-reload branch from a3fd1c1 to 5dd26c5 Compare August 14, 2026 20:38
@Jakfut

Jakfut commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

I changed it according to DarkShadow44's suggestions

@RecursivePineapple RecursivePineapple added the Merge Into Prerelease PR will be added to -pre releases (via the dev branch). label Aug 15, 2026
@DarkShadow44

Copy link
Copy Markdown
Collaborator

Seems like it should work just fine, although I only looked at the code and didn't test.

@RecursivePineapple
RecursivePineapple merged commit da6e6eb into GTNewHorizons:master Aug 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merge Into Prerelease PR will be added to -pre releases (via the dev branch).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants