Conversation
I kind of forgot about it lol though what needs to be done on it just accepting the changes you suggested n updating the branch? |
|
|
||
| static { | ||
| if(Skript.methodExists(LivingEntity.class, "getMaxFuseTicks")) | ||
| register(ExprCreeperMaxFuseTicks.class, Long.class, "[creeper] max[imum] fuse tick[s]", "livingentities"); |
There was a problem hiding this comment.
This syntax doesn't conflict, so it may be worth it to deprecate it for a version instead of outright removing it. Thoughts from others?
There was a problem hiding this comment.
Deprecation is better
| @Description("The fuse duration of a creeper or primed TNT. For creepers, this is the total fuse duration before explosion. For primed TNT, this is the remaining time before explosion.") | ||
| @Example(""" |
There was a problem hiding this comment.
So creepers have max and elapsed fuse ticks, with which you can calculate remaining.
Tnt just has remaining fuse ticks.
I think you should change this to [:elapsed|:remaining|max] fuse duration and have creepers support all, tnt support remaining. Thoughts? I'm not a fan of fuse duration meaning two different things and also just not implementing creeper's getFuseTicks
| public static void register(SyntaxRegistry registry) { | ||
| registry.register( | ||
| SyntaxRegistry.EXPRESSION, | ||
| infoBuilder(ExprFuseDuration.class, Timespan.class, "fuse (duration|time)", "entities", false).build() |
| return "fuse duration"; | ||
| } | ||
|
|
||
| } No newline at end of file |
| assert fuse duration of entity is 0 seconds with "fuse duration of primed tnt should be capped at 0 minimum" | ||
| delete fuse duration of entity | ||
| assert fuse duration of entity is 0 seconds with "fuse duration of primed tnt should be 0 seconds after deletion" | ||
| delete entity No newline at end of file |
There was a problem hiding this comment.
| delete entity | |
| delete entity | |
Just gonna close it in favor of this one, this one has better code. Edit: Oh wait, sorry, I thought you (Owl) opened this one too! Are you ok with letting CJH take this PR or do you want to finish it out yourself? |
|
|
||
| static { | ||
| if(Skript.methodExists(LivingEntity.class, "getMaxFuseTicks")) | ||
| register(ExprCreeperMaxFuseTicks.class, Long.class, "[creeper] max[imum] fuse tick[s]", "livingentities"); |
There was a problem hiding this comment.
Deprecation is better
| if (entity instanceof Creeper creeper) | ||
| return new Timespan(Timespan.TimePeriod.TICK, creeper.getMaxFuseTicks()); | ||
| else if (entity instanceof TNTPrimed tnt) | ||
| return new Timespan(Timespan.TimePeriod.TICK, tnt.getFuseTicks()); |
There was a problem hiding this comment.
| if (entity instanceof Creeper creeper) | |
| return new Timespan(Timespan.TimePeriod.TICK, creeper.getMaxFuseTicks()); | |
| else if (entity instanceof TNTPrimed tnt) | |
| return new Timespan(Timespan.TimePeriod.TICK, tnt.getFuseTicks()); | |
| if (entity instanceof Creeper creeper) { | |
| return new Timespan(Timespan.TimePeriod.TICK, creeper.getMaxFuseTicks()); | |
| } else if (entity instanceof TNTPrimed tnt) { | |
| return new Timespan(Timespan.TimePeriod.TICK, tnt.getFuseTicks()); | |
| } |
Problem
#8489
Solution
Adds a new
fuse ticksexpression for creepers and primed tnts using Paper's getMaxFuseTicks()/setMaxFuseTicks() for creepers and getFuseTicks()/setFuseTicks() for tntsTesting Completed
src/test/skript/tests/syntaxes/expressions/ExprFuseTicks.sk

Also did a quick test with effect commands in skriptTestDev
Supporting Information
Completes: #8489
Related: none
AI assistance: none