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.4] Encourage more usage of IConditionBuider #1716

Merged
merged 21 commits into from
Dec 12, 2024

Conversation

ApexModder
Copy link
Contributor

@ApexModder ApexModder commented Nov 28, 2024

This PR aims to encourage modders to make more use of IConditionBuilder rather than constructing condition instances themselves

this is done by

  • patching DataProviders which support conditions to now implement IConditionBuilder making all of its helpers freely available to all inheritors.
  • adding a static of method allowing users to construct an instance in places where they do not have a DataProvider or can implement it themselves.
  • deprecating and moving all shortcut constructors into ICondtionBuilder
  • deprecating the old TRUE/FALSE conditions in favor of the new always/never conditions

@ApexModder ApexModder added the 1.21.3 Targeted at Minecraft 1.21.3 label Nov 28, 2024
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Nov 28, 2024

  • Publish PR to GitHub Packages

Last commit published: 8620fb6e6c04d1e9dad7481b591d2e95c28f02fe.

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

mkdir NeoForge-pr1716
cd NeoForge-pr1716
curl -L https://prmaven.neoforged.net/NeoForge/pr1716/net/neoforged/neoforge/21.4.41-beta-pr-1716-pr-condition-builder/mdk-pr1716.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.

@ApexModder ApexModder force-pushed the pr/condition-builder branch from e2da34f to 4a0cbc3 Compare December 3, 2024 13:13
@ApexModder ApexModder changed the base branch from 1.21.x to port/1.21.4 December 3, 2024 13:13
@ApexModder ApexModder added 1.21.4 Targeted at Minecraft 1.21.4 and removed 1.21.3 Targeted at Minecraft 1.21.3 labels Dec 3, 2024
@ApexModder ApexModder changed the title [1.21.3] Encourage more usage of IConditionBuider [1.21.4] Encourage more usage of IConditionBuider Dec 3, 2024
Copy link
Member

@Technici4n Technici4n left a comment

Choose a reason for hiding this comment

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

Also: did you check for true and false conditions in the non-generated resource files?

@ApexModder ApexModder force-pushed the pr/condition-builder branch from 1b4d449 to 25a288c Compare December 4, 2024 21:44
@ApexModder ApexModder changed the base branch from port/1.21.4 to 1.21.x December 4, 2024 21:44
@ApexModder ApexModder force-pushed the pr/condition-builder branch from 25a288c to 589f506 Compare December 4, 2024 21:49
@neoforged-compatibility-checks
Copy link

neoforged-compatibility-checks bot commented Dec 4, 2024

@ApexModder, 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: 8620fb6e6c04d1e9dad7481b591d2e95c28f02fe.

Compatibility checks

neoforge (:neoforge)

  • net/neoforged/neoforge/common/conditions/ItemExistsCondition
    • ❗ API class no longer exists
  • net/neoforged/neoforge/common/conditions/IConditionBuilder
    • ❗ API class no longer exists
  • net/neoforged/neoforge/common/conditions/ConditionContext
    • <init>(Ljava/util/List;Lnet/minecraft/world/flag/FeatureFlagSet;)V: ❗ API method was removed
    • <init>(Ljava/util/List;)V: ❗ API method was removed
  • net/neoforged/neoforge/common/conditions/FalseCondition
    • ❗ API class no longer exists
  • net/neoforged/neoforge/common/conditions/TagEmptyCondition
    • <init>(Lnet/minecraft/resources/ResourceLocation;)V: ❗ API method was removed
    • <init>(Ljava/lang/String;)V: ❗ API method was removed
    • <init>(Ljava/lang/String;Ljava/lang/String;)V: ❗ API method was removed
  • net/neoforged/neoforge/common/conditions/TrueCondition
    • ❗ API class no longer exists
  • net/neoforged/neoforge/common/NeoForgeMod
    • TRUE_CONDITION:Lnet/neoforged/neoforge/registries/DeferredHolder;: ❗ API field was removed
    • FALSE_CONDITION:Lnet/neoforged/neoforge/registries/DeferredHolder;: ❗ API field was removed
    • ITEM_EXISTS_CONDITION:Lnet/neoforged/neoforge/registries/DeferredHolder;: ❗ API field was removed

@ApexModder ApexModder requested a review from Technici4n December 4, 2024 22:49
Copy link
Member

@Technici4n Technici4n left a comment

Choose a reason for hiding this comment

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

I like this! I have a few minor comments.

Technici4n
Technici4n previously approved these changes Dec 11, 2024
…rgeMod`

left over from initial class rename
@ApexModder ApexModder merged commit 79d86eb into neoforged:1.21.x Dec 12, 2024
6 checks passed
@ApexModder ApexModder deleted the pr/condition-builder branch December 12, 2024 18:12
@neoforged-releases
Copy link

🚀 This PR has been released as NeoForge version 21.4.20-beta.

ApexModder added a commit to ApexModder/NeoForge that referenced this pull request Dec 12, 2024
ApexModder added a commit to ApexModder/NeoForge that referenced this pull request Dec 15, 2024
Soaryn pushed a commit to Soaryn/EnergyHandlerPR that referenced this pull request Jan 21, 2025
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants