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

Use BlockEntity.getType to check for valid block state #1442

Merged
merged 2 commits into from
Aug 11, 2024

Conversation

embeddedt
Copy link
Member

Changes the logic in BlockEntity.isValidBlockState to use getType, rather than the private type field, to allow subclasses that use a different block entity type to work properly, since it is not always possible to provide the new type to the superclass.

@embeddedt embeddedt added the 1.21 Targeted at Minecraft 1.21 label Aug 11, 2024
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Aug 11, 2024

  • Publish PR to GitHub Packages

Last commit published: 514b6861feb5d84e17f3c29f23f2149bf5f7c4a4.

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

mkdir NeoForge-pr1442
cd NeoForge-pr1442
curl -L https://prmaven.neoforged.net/NeoForge/pr1442/net/neoforged/neoforge/21.1.7-pr-1442-block-entity-type-fix/mdk-pr1442.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.

pupnewfster
pupnewfster previously approved these changes Aug 11, 2024
marchermans
marchermans previously approved these changes Aug 11, 2024
@embeddedt embeddedt dismissed stale reviews from marchermans and pupnewfster via 514b686 August 11, 2024 17:42
@shartte shartte enabled auto-merge (squash) August 11, 2024 17:43
@shartte shartte merged commit 797bcd6 into neoforged:1.21.x Aug 11, 2024
6 checks passed
@neoforged-releases
Copy link

🚀 This PR has been released as NeoForge version 21.1.5.

}

public boolean isValidBlockState(BlockState p_353131_) {
- return this.type.isValid(p_353131_);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a // TODO Remove in next breaking phase? It's just here to unbreak old mods that were made before the vanilla change and is not needed for new mods that can override this method themselves.

Copy link
Member Author

Choose a reason for hiding this comment

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

It shouldn't be a requirement for mods to override both this and getType, IMO.

@embeddedt embeddedt deleted the block-entity-type-fix branch August 11, 2024 18:16
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants