Skip to content
Permalink
Browse files

Fixed sleeping in a bed waking the player up at midnight calendar tim…

…e and ruining everything. Added vanity.
  • Loading branch information...
alcatrazEscapee committed Jul 10, 2019
1 parent e011c3c commit 49e60036cd06cae7964e00446a89685bfe28413f
@@ -97,10 +97,10 @@ else if (!args[0].equals("set"))

if (updateDaylightCycle)
{
// Set world time (daylight cycle time)
for (int i = 0; i < server.worlds.length; ++i)
{
// Since world time 0 = 6 am in the morning
server.worlds[i].setWorldTime(time - 6 * CalendarTFC.TICKS_IN_HOUR);
server.worlds[i].setWorldTime(time - CalendarTFC.WORLD_TIME_OFFSET);
}
}
}
@@ -76,7 +76,7 @@ public static void onCommandFire(CommandEvent event)
public static void onPlayerWakeUp(PlayerWakeUpEvent event)
{
// Set the calendar time to time=0. This will implicitly call CalendarTFC#update
long newCalendarTime = (CalendarTFC.INSTANCE.getTotalDays() + 1) * CalendarTFC.TICKS_IN_DAY;
long newCalendarTime = (CalendarTFC.INSTANCE.getTotalDays() + 1) * CalendarTFC.TICKS_IN_DAY + CalendarTFC.WORLD_TIME_OFFSET;
CalendarTFC.INSTANCE.setCalendarTime(event.getEntityPlayer().getEntityWorld(), newCalendarTime);
}

@@ -43,6 +43,9 @@
public static final String[] DAY_NAMES = new String[] {"sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"};
public static final Map<String, String> BIRTHDAYS = new HashMap<>();

/* The offset in ticks between the world time (sun position) and the calendar (since world time 0 = 6 AM) */
public static final int WORLD_TIME_OFFSET = 6 * TICKS_IN_HOUR;

static final int DEFAULT_DAYS_IN_MONTH = 8;
static final int DEFAULT_CALENDAR_OFFSET = (6 * DEFAULT_DAYS_IN_MONTH * TICKS_IN_DAY) + (6 * TICKS_IN_HOUR);

@@ -29,7 +29,7 @@
@Nonnull
public static Month valueOf(int id)
{
return id >= 0 && id < VALUES.length ? VALUES[id] : MARCH;
return id >= 0 && id < VALUES.length ? VALUES[id] : JANUARY;
}

private final float temperatureModifier;
@@ -9,7 +9,10 @@
"url": "https://terrafirmacraft.github.io",
"updateJson": "https://mc.dries007.net/terrafirmacraft.json",
"authorList": [
"Dries007"
"Dries007",
"AlcatrazEscapee",
"Bunsan",
"et. al."
],
"credits": "Bioxx, Dunkleosteus, Kittychanley for the original TerraFirmaCraft for 1.7.10 and before."
}

0 comments on commit 49e6003

Please sign in to comment.
You can’t perform that action at this time.