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.2] Implement support for preventing effects from being removed by milk or totems #1603

Open
wants to merge 4 commits into
base: 1.21.x
Choose a base branch
from

Conversation

XFactHD
Copy link
Member

@XFactHD XFactHD commented Oct 18, 2024

This PR replaces the hard-coded consume effects on milk and totems such that mods can prevent their custom effects from being cured by milk and totems respectively. The honey bottle is left out intentionally as mods can use the ModifyDefaultComponentsEvent to add additional RemoveStatusEffectsConsumeEffects for their effects to the DataComponents.CONSUMABLE component specified on honey bottles.

To achieve this, the ClearAllStatusEffectsConsumeEffects are replaced with RemoveStatusEffectsConsumeEffects holding a NotHolderSet that wraps a blacklist tag.
Since these changes are applied to the item's "component prototype", the changes won't be synced to a non-NeoForge counterpart and should therefor not cause any issues or desyncs there.

This PR is the replacement for the defunct EffectCure system.

@XFactHD XFactHD added the 1.21.2 Targeted at Minecraft 1.21.2 label Oct 18, 2024
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Oct 18, 2024

  • Publish PR to GitHub Packages

Last commit published: 90b67b6fcf69baa8eee3c9a418c85e2ee0dad040.

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

mkdir NeoForge-pr1603
cd NeoForge-pr1603
curl -L https://prmaven.neoforged.net/NeoForge/pr1603/net/neoforged/neoforge/21.3.5-beta-pr-1603-effect_curing/mdk-pr1603.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-automation
Copy link

@XFactHD, this pull request has conflicts, please resolve them for this PR to move forward.

@KnightMiner
Copy link
Contributor

This PR is the replacement for the defunct EffectCure system.

This is an incomplete replacement. You handle the part of the effect cure system that allows making an general mob effect type not curable by milk, but don't handle the part of the system that allows making specific effect instances not curable.

For instance, I have a mod that adds effects in a mutually exclusive system that uses effect cures to ensure that adding one effect from the set removes the others. However, I also have some vanilla effects in this system, which is easy to accomplish by setting the effect cures on the effect instance before applying it to the player.

The only way to accomplish the same thing with this proposed system would require me registering additional copies of vanilla effects, which based on the effect may not scale properly (not to mention the UX mess if you have both the copy and the original at the same time)

@XFactHD
Copy link
Member Author

XFactHD commented Oct 21, 2024

It's the best we'll get, unfortunately. NeoForge must preserve network compatibility with vanilla and therefor can't register a custom consume effect, which means we're restricted to ClearAllStatusEffectsConsumeEffect and RemoveStatusEffectsConsumeEffect. The former just clears everything and the latter only supports a HolderSet<MobEffect>. There is no way to provide control per effect instance.
It's also worth noting that the effects now in general have very little control over whether they can be cured or not, this is basically entirely up to the consumable items now.

@Technici4n Technici4n deleted the branch neoforged:1.21.x October 22, 2024 16:31
@Technici4n Technici4n closed this Oct 22, 2024
@Technici4n Technici4n reopened this Oct 22, 2024
@Technici4n Technici4n changed the base branch from port/1.21.2 to 1.21.x October 22, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.2 Targeted at Minecraft 1.21.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants