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

[1.21.x] TODOs and NBT cleanup for entities #1166

Merged
merged 11 commits into from
Jul 10, 2024

Conversation

robotgryphon
Copy link
Contributor

@robotgryphon robotgryphon commented Jun 22, 2024

  • Deprecates persistent data (use data attachments)
  • Deprecates INBTSerializer for entities (data attachments/workarounds)
  • Method renames for the 1.19 world -> level change

@robotgryphon robotgryphon added 1.21 Targeted at Minecraft 1.21 cleanup Change that isn't an enhancement or a bug fix labels Jun 22, 2024
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Jun 22, 2024

  • Publish PR to GitHub Packages

Last commit published: b5395d2403737c40f13aedc73cba7c1f9944f58f.

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 #1166' // https://github.com/neoforged/NeoForge/pull/1166
        url 'https://prmaven.neoforged.net/NeoForge/pr1166'
        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-pr1166.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr1166
cd NeoForge-pr1166
curl -L https://prmaven.neoforged.net/NeoForge/pr1166/net/neoforged/neoforge/21.0.90-beta-pr-1166-feature-nbt-entity-cleanup/mdk-pr1166.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.

@Technici4n
Copy link
Member

I believe that there are some uses cases for entity persistent data, for example marking item entities that should not be picked up by magnets, and other similar cases of mod compat.

I agree with the other changes.

@robotgryphon
Copy link
Contributor Author

I believe that there are some uses cases for entity persistent data, for example marking item entities that should not be picked up by magnets, and other similar cases of mod compat.

I agree with the other changes.

You'd rather keep persistent data when attachments exist, for stuff like magnet control? That feels like a capability or attachment thing.. persistent data is like using a sword when you have a scalpel nearby.

@neoforged-compatibility-checks
Copy link

neoforged-compatibility-checks bot commented Jul 1, 2024

@robotgryphon, 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: b5395d2403737c40f13aedc73cba7c1f9944f58f.

neoforge (:neoforge)

  • net/minecraft/world/entity/Entity
    • onAddedToWorld()V: ❗ API method was removed
    • onRemovedFromWorld()V: ❗ API method was removed
    • isAddedToWorld()Z: ❗ API method was removed
  • net/neoforged/neoforge/common/extensions/IEntityExtension
    • onAddedToWorld()V: ❗ API method was removed
    • isAddedToLevel()Z: ❗ Method was made abstract
    • onRemovedFromWorld()V: ❗ API method was removed
    • isAddedToWorld()Z: ❗ API method was removed
    • onAddedToLevel()V: ❗ Method was made abstract
    • onRemovedFromLevel()V: ❗ Method was made abstract

@TelepathicGrunt
Copy link
Contributor

TelepathicGrunt commented Jul 6, 2024

Could we skip deprecating/removing persistentData? It is easier for mod compat without compile dependencies at the moment which Data Attachments doesn't fully replace very well at the moment

@HenryLoenwind
Copy link
Contributor

Could we skip deprecating/removing persistentData? It is easier for mod compat without compile dependencies at the moment which Data Attachments doesn't fully replace very well at the moment

Or could neo maybe provide a simple network-synced data attachment that's a Map<String, String> for mod interop? That way, the new system would be used, there'd be no compile-time dependency, and it'd be dead simple to use.

And as bonus, the javadoc could give two nice examples, key="doNotMagnet", value=anything non-empty (preferably modId of the mod to set this) to prevent an item from being attracted by magnets completely and "key="magnetReserved", value=any unique ID" to reserve an item for one specific magnet.

And no, we cannot prevent modders from stuffing their mod's whole save state into one of those Strings if they want.

@sciwhiz12 sciwhiz12 added the breaking change Breaks binary compatibility label Jul 9, 2024
sciwhiz12
sciwhiz12 previously approved these changes Jul 9, 2024
Copy link
Member

@sciwhiz12 sciwhiz12 left a comment

Choose a reason for hiding this comment

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

Merge when ready.

Copy link
Member

@sciwhiz12 sciwhiz12 left a comment

Choose a reason for hiding this comment

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

Merge when ready.

@Technici4n Technici4n merged commit 8de9b1e into neoforged:1.21.x Jul 10, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21 Targeted at Minecraft 1.21 breaking change Breaks binary compatibility cleanup Change that isn't an enhancement or a bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants