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

Add methods for CreakingHeart #12095

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Doc94
Copy link
Contributor

@Doc94 Doc94 commented Feb 10, 2025

Draft because need test if call the correct things...

@Doc94 Doc94 marked this pull request as ready for review February 10, 2025 13:05
@Doc94 Doc94 requested a review from a team as a code owner February 10, 2025 13:05
Copy link
Contributor

@notTamion notTamion left a comment

Choose a reason for hiding this comment

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

some grammar in the jd needs to be fixed

Copy link
Contributor

@Lulu13022002 Lulu13022002 left a comment

Choose a reason for hiding this comment

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

You should also handle unplaced block state properly

} else {
this.clearCreakingInfo();
}
+ this.distanceCreakingTooFar = tag.contains(PAPER_CREAKING_MAX_DISTANCE_TAG, 99) ? tag.getInt(PAPER_CREAKING_MAX_DISTANCE_TAG) : DISTANCE_CREAKING_TOO_FAR; // Paper - Custom max distance for Creaking
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the constants in Tag

/**
* Attempts to spawn a creaking for protect this creaking heart.
*
* @return the {@link Creaking} for protect the creaking heart or null if fails
Copy link
Contributor

Choose a reason for hiding this comment

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

I am a bit confused regarding the usage of this method.

Simulating the spawning behaviour of an entity type is something that might be useful API, but I don't think I'd want it to live in random block state types like this.
Developers can very well just spawn a creeking and set it via the setter.
The spawnProtector method really doesn't do more than spawning it + game events.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm yeah.. i fell useful just call the same NMS logic but maybe can just remove that and let users use the normal ways.

tag.putUUID("creaking", this.creakingInfo.map(Entity::getUUID, uuid -> (UUID)uuid));
}
- }
+ tag.putInt(PAPER_CREAKING_MAX_DISTANCE_TAG, this.distanceCreakingTooFar); // Paper - Custom max distance for Creaking
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit rough here if we wanna write.
We should keep the int but we'd ideal also want a way for the developer to fall back to vanillas value even if it changes across versions.

The current implementation would lock every creaking heart at the current vanilla value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe just a
if (this.distanceCreakingTooFar != DISTANCE_CREAKING_TOO_FAR) tag.putInt(PAPER_CREAKING_MAX_DISTANCE_TAG, this.distanceCreakingTooFar); // Paper - Custom max distance for Creaking ?

* @return the creaking or null if this creaking heart don't have protector.
*/
@Nullable
Creaking getCreaking();
Copy link
Contributor

Choose a reason for hiding this comment

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

Anything against sticking to the vanilla naming here? E.g. getProtector?
Other peoples input here before actually changing this tho.

*
* @return the max distance
*/
int getMaxDistanceForCreaking();
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not like this method name.
Especially when we also might add API for the creaking spawn distance.

getProtectorSurvivalRange
setProtectorSurvivalRange
getProtectorSpawnRange
setProtectorSpawnRange
might work, more peoples input tho pls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the lasts ones not like just becauuse that value its not for spawn.. its for limit the max distance where a creaking can "live"

maybe the first can work.. but not sure..

Copy link
Contributor

Choose a reason for hiding this comment

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

The last ones were for the new API regarding the replacement for scaling, sorry xD
But yea, more people time chime in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: PR Party candidate
Development

Successfully merging this pull request may close these issues.

5 participants