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

[WIP] Syncable Data Attachments #1823

Draft
wants to merge 15 commits into
base: 1.21.x
Choose a base branch
from

Conversation

Technici4n
Copy link
Member

@Technici4n Technici4n commented Jan 4, 2025

Allows data attachments to opt into syncing. Still a rough PR, many details need to be figured out. Closes #335.

TODO:

  • StreamCodec helper.
  • AttachmentSyncReason looks kinda pointless. Remove?
  • Related: too many parameters for IAttachmentSyncHandler maybe?
  • Method to force syncing of attachments.
  • Decide whether we sync immediately or at the end of the tick.
  • Support for block entities.
  • Support for chunks.
  • Entities: server player data does not seem to get synced on initial connection.
  • Entities: what about player respawns and entity copies?
  • Support for levels.
  • Entity syncing code already looks incredibly complicated.
  • When attachments are set through indirect means (getData, deserialization, copying), we should probably sync automatically.
  • deserializeAttachments: needs to attempt to sync?
  • Properly handle sending the removal of an attachment.
  • Maybe send a separate byte[] for each attachment type.
  • Is there a way to keep server-wide data in sync? (even if it is e.g. stored in the overworld) Is there a point to that?
  • What to do when force-syncing an attachment? Sending a removal to the client is probably good.
  • Remove client command hacks...
  • 1.21.1 backport?

@neoforged-automation neoforged-automation bot added enhancement New (or improvement to existing) feature or request 1.21.4 Targeted at Minecraft 1.21.4 labels Jan 4, 2025
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Jan 4, 2025

  • Publish PR to GitHub Packages

Last commit published: 8842c6223cb6226065c08dbd29acc7dbca016c8f.

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 #1823' // https://github.com/neoforged/NeoForge/pull/1823
        url 'https://prmaven.neoforged.net/NeoForge/pr1823'
        content {
            includeModule('net.neoforged', 'testframework')
            includeModule('net.neoforged', 'neoforge')
        }
    }
}

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-pr1823.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr1823
cd NeoForge-pr1823
curl -L https://prmaven.neoforged.net/NeoForge/pr1823/net/neoforged/neoforge/21.4.66-beta-pr-1823-attachment-sync/mdk-pr1823.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.

@neoforged-compatibility-checks

@Technici4n, this PR introduces breaking changes.
Fortunately, this project is currently accepting breaking changes, but if they are not intentional, please revert them.
Last checked commit: 8842c6223cb6226065c08dbd29acc7dbca016c8f.

neoforge (:neoforge)

  • net/minecraft/server/level/ServerEntity
    • sendPairingData(Lnet/minecraft/server/level/ServerPlayer;Lnet/neoforged/neoforge/network/bundle/PacketAndPayloadAcceptor;)V: ❗ API method was removed
  • net/neoforged/neoforge/network/bundle/PacketAndPayloadAcceptor
    • ⚠ API class no longer exists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.4 Targeted at Minecraft 1.21.4 enhancement New (or improvement to existing) feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Synced data attachments
2 participants