Add ExplosiveMinecart ignite() and explode() overloads and add getIgniter() (#14097) - #14272
WouterGritter wants to merge 2 commits into
Conversation
| import org.bukkit.entity.Entity; | ||
| import org.bukkit.entity.Explosive; | ||
| import org.bukkit.entity.Minecart; | ||
| import org.jetbrains.annotations.Nullable; |
There was a problem hiding this comment.
Use JSpecify (and include the NullMarked)
There was a problem hiding this comment.
@NullMarked is only used in the package-info.java's, and CommandMinecart also exists in this package with @NotNull / @Nullable annotations (jetbrains). Should I add @NullMarked to the package-info in this PR, and update CommandMinecart also? Seems a bit out of scope, but otherwise a @NullMarked in package-info would be misleading
There was a problem hiding this comment.
The idea is avoid add the Jetbrains nullable annotation and move if is possible and not require big reworks (that is for another instance), you can by the moment just add to the Interface and later move to package when need.
There was a problem hiding this comment.
Will do this for now, but this will be the first and only interface (or class) that is annotated by @NullMarked, the rest of the codebase only uses this in package-info.java
9b9d8e0 to
44f5442
Compare
|
Force-pushed the requested changes ( |
aa6c2c5 to
5cdb6a5
Compare
|
This doesn't target the right branch should be on main (then depending when it's merged it can be moved to ver/26.2) |
…me parameters, explode() overloads with the causing entity, and getIgniter() to obtain the entity that caused ignition
5cdb6a5 to
0eeea53
Compare
|
Rebased to |
Adds:
ExplosiveMinecart#ignite(int fuseTime)ExplosiveMinecart#ignite(Entity igniter)ExplosiveMinecart#ignite(Entity igniter, int fuseTime)ExplosiveMinecart#explode(Entity entity)ExplosiveMinecart#explode(Entity entity, double power)ExplosiveMinecart#getIgniter()ignite(int fuseTime)was oddly missing - an earlier Paper patch added support for this through NMS but it wasn't exposed through the API before.ExplosiveMinecart#setFuseTicksexists "If the fuse ticks are set to a non-zero value, this will ignite the explosive." (from its javadocs), but this does not play theTNT_PRIMEDsound and also doesn't fireEntityIgniteEvent. Should we deprecate this method in this PR?This PR closes #14097 (Add .getIgniter() to ExplosiveMinecart).
At first it seemed better to expose MinecartTNT's
DamageSource ignitionSource, but this is always an explosion damage source, optionally with the igniter entity as its cause, that the minecart will use once exploding.MinecartTNT#primeFuseis a bit odd as it consumes aDamageSource source, which is the source that did damage to the minecart that caused it to prime, though the type is discarded. Right now I've got this wrapped in another explosion source, which gets stripped down to its causing entity, then re-wrapped in a new explosion source (by vanilla code).