-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
Update ExprTime #7082
Update ExprTime #7082
Conversation
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.
since these are suggestions that arent really necessary ill just approve (even though my approval does nothing)
long ticks = 0; | ||
if (time instanceof Time) { | ||
if (mode != ChangeMode.SET) { | ||
ticks = ((Time) time).getTicks() - TIME_TO_TIMESPAN_OFFSET; // allows for using "add 2:00" without going to new day | ||
} else { | ||
ticks = ((Time) time).getTicks(); | ||
} | ||
} else if (time instanceof Timespan) { | ||
ticks = ((Timespan) time).getAs(Timespan.TimePeriod.TICK); | ||
} else if (time instanceof Timeperiod) { | ||
ticks = ((Timeperiod) time).start; | ||
} | ||
|
||
for (World world : worlds) { | ||
switch (mode) { | ||
case ADD: | ||
world.setTime(world.getTime() + ticks); | ||
break; | ||
case REMOVE: | ||
world.setTime(world.getTime() - ticks); | ||
break; | ||
case SET: | ||
world.setTime(ticks); | ||
break; | ||
} |
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 could add the for loop to a helper method, and call the method in each of the instanceof
checks, this avoids the need for the ticks variable (except for in time instanceof Time
)
of course you dont have to do this, i just think it'll look a little neater
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.
good idea but i think this is easier to understand. if the team thinks your approach is better, i'll change it
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.
Glad to see the speed in which this was fixed, I fully forgot mc time even existed, here's some task to show my appreciation
Description
Resolves #7081.
minecraft <timespan>
syntax, as not using this to update the world's time results in confusing behaviour. Also explains that removing time from a world will move the clock forward a day.Target Minecraft Versions: any
Requirements: none
Related Issues: #7081