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

Deprecate FabricEntityTypeBuilder & FabricBlockEntityTypeBuilder in favour of the vanilla classes #3677

Merged
merged 8 commits into from
Apr 10, 2024

Conversation

modmuss50
Copy link
Member

@modmuss50 modmuss50 commented Mar 28, 2024

Depends on #3666 due to generic interface injection

@modmuss50 modmuss50 added enhancement New feature or request cleanup labels Mar 28, 2024
@melontini
Copy link

Can this be done to FabricBlockEntityTypeBuilder too? Since there's already BlockEntityType.Builder.

@modmuss50
Copy link
Member Author

Can this be done to FabricBlockEntityTypeBuilder too? Since there's already BlockEntityType.Builder.

Good idea, I'll take a look. 👍

@modmuss50
Copy link
Member Author

Can this be done to FabricBlockEntityTypeBuilder too? Since there's already BlockEntityType.Builder.

Just had a look as as far as I can tell FabricBlockEntityTypeBuilder is useless? The only thing we add in FabricBlockEntityTypeBuilder is methods to add the supported blocks, but this can be set when creating the vanilla builder using BlockEntityType.Builder.create I think ill just deprecate it.

@modmuss50 modmuss50 changed the title Replace FabricEntityTypeBuilder with EntityTypeBuilder + iface injection Deprecate FabricEntityTypeBuilder & FabricBlockEntityTypeBuilder in favour of the vanilla classes Apr 2, 2024
@modmuss50 modmuss50 marked this pull request as ready for review April 2, 2024 18:33
@modmuss50
Copy link
Member Author

Deprecated FabricEntityTypeBuilder and interface injected a build() (without the datafix type) overload.

@modmuss50 modmuss50 requested a review from a team April 2, 2024 18:35
Comment on lines +49 to +58
default EntityType.Builder<T> alwaysUpdateVelocity(boolean alwaysUpdateVelocity) {
throw new AssertionError("Implemented in Mixin");
}

/**
* Build the entity type from the builder. Same as {@link EntityType.Builder#build(String)} but without an id.
*
* @return the entity type instance
*/
default EntityType<T> build() {

Choose a reason for hiding this comment

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

Both need fabric_ prefixing.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this is part of the API.

Choose a reason for hiding this comment

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

Oh is this an existing API?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this is new (based off the old one). The vanilla build() method takes a string that will almost always be null for mods, this is an overload of the vanilla build().

Choose a reason for hiding this comment

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

Is the consensus to not prefix user-facing things and just hope other mods do, then?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes exactly.

Choose a reason for hiding this comment

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

Fair enough, will bear in mind 👍

@modmuss50 modmuss50 added the last call If you care, make yourself heard right away! label Apr 3, 2024
}

/**
* Creates an entity type builder for a mob entity.
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do we set the constructor? PlayerEntity is the only one in vanilla where constructor is skipped. Otherwise client sync/biome spawn/etc wouldn't work.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I see good point. The previous API you would set the factory via the builder methods, of course this cannot happen now.

@modmuss50 modmuss50 added the merge me please Pull requests that are ready to merge label Apr 10, 2024
@modmuss50 modmuss50 merged commit dba1195 into FabricMC:1.20.4 Apr 10, 2024
5 checks passed
modmuss50 added a commit that referenced this pull request Apr 10, 2024
…avour of the vanilla classes (#3677)

* Replace FabricEntityTypeBuilder with EntityTypeBuilder + iface injection

* Finish and test entity type builder

* Deprecate FabricBlockEntityTypeBuilder

* Review fix

* Fixes based on review

* Some fixes

* Checkstyle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup enhancement New feature or request last call If you care, make yourself heard right away! merge me please Pull requests that are ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants