Skip to content

Defer BlockEntity attachment syncing to match the usual BE sync timing#2916

Merged
Technici4n merged 2 commits intoneoforged:port/26.1from
Technici4n:defer-be-attachment-sync
Jan 21, 2026
Merged

Defer BlockEntity attachment syncing to match the usual BE sync timing#2916
Technici4n merged 2 commits intoneoforged:port/26.1from
Technici4n:defer-be-attachment-sync

Conversation

@Technici4n
Copy link
Member

Instead of eagerly syncing block entity attachments, we store which attachment types need syncing, and we only send the update later, matching the timing of BlockEntity#getUpdatePacket. This fixes "unknown attachment" errors on the client when an attachment is updated on the server side on a block entity that was already deleted on the client, for example.

(I am planning on backporting this to 1.21.11 and 1.21.1 once it receives more testing in 26.1).

@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Jan 9, 2026

  • Publish PR to GitHub Packages

Last commit published: d8617999c40d2a8cba3171c8f9ce1ccf4c851d12 - version: 26.1.0.0-alpha.26.1-snapshot-4.20260121.224106

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name = "Maven for PR #2916" // https://github.com/neoforged/NeoForge/pull/2916
        url = uri("https://prmaven.neoforged.net/NeoForge/pr2916")
        content {
            includeModule("net.neoforged", "neoforge")
            includeModule("net.neoforged", "testframework")
        }
    }
}

MDK installation

In order to setup a MDK using the latest PR version, run the following commands in a terminal.
The script works on both *nix and Windows as long as you have the JDK bin folder on the path.
The script will clone the MDK in a folder named NeoForge-pr2916.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr2916
cd NeoForge-pr2916
curl -L https://prmaven.neoforged.net/NeoForge/pr2916/net/neoforged/neoforge/26.1.0.0-alpha.26.1-snapshot-4.20260121.224106/mdk-pr2916.zip -o mdk.zip
jar xf mdk.zip
rm mdk.zip || del mdk.zip

To test a production environment, you can download the installer from here.

return;
}
syncUpdate(blockEntity, type, serverLevel.getChunkSource().chunkMap.getPlayers(ChunkPos.containing(blockEntity.getBlockPos()), false));
// For now, we send one packet per attachment type. In the future, consider bundling all the updates in a single packet.
Copy link
Contributor

Choose a reason for hiding this comment

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

They should still be bundled through packet bundling, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

No that doesn't happen automatically.

Copy link
Contributor

@shartte shartte left a comment

Choose a reason for hiding this comment

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

Game tests are still failing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants