Skip to content

Instantly share code, notes, and snippets.

@Grinch
Last active September 26, 2017 23:41
Show Gist options
  • Save Grinch/b093d21ceb4bab65b0884a0e6277d522 to your computer and use it in GitHub Desktop.
Save Grinch/b093d21ceb4bab65b0884a0e6277d522 to your computer and use it in GitHub Desktop.
public static void setHourForward(World world, int hour, boolean notify)
{
long day = getTime(world) / 24000L * 24000L;
long newTime = day + 24000L + hour * 1000;
setTime(newTime, world);
if (notify) {
ServerUtils.sendChatToAll(new TextComponentTranslation("nei.chat.time", new Object[] { Long.valueOf(getTime(world) / 24000L), Integer.valueOf(hour) }));
}
}
public static void advanceDisabledTimes(World world)
{
int dim = world.field_73011_w.getDimension();
int hour = (int)(getTime(world) % 24000L) / 1000;
int newhour = hour;
while (NEIServerConfig.isActionDisabled(dim, NEIActions.timeZones[(newhour / 6)])) {
newhour = (newhour / 6 + 1) % 4 * 6;
}
if (newhour != hour) {
setHourForward(world, newhour, false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment