-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
base: main
Are you sure you want to change the base?
Conversation
- allow manage creaking attached - helper method for spawn creaking
There was a problem hiding this 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
...r/patches/sources/net/minecraft/world/level/block/entity/CreakingHeartBlockEntity.java.patch
Show resolved
Hide resolved
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
...r/patches/sources/net/minecraft/world/level/block/entity/CreakingHeartBlockEntity.java.patch
Show resolved
Hide resolved
...r/patches/sources/net/minecraft/world/level/block/entity/CreakingHeartBlockEntity.java.patch
Outdated
Show resolved
Hide resolved
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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..
There was a problem hiding this comment.
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.
Draft because need test if call the correct things...