1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-17 10:50:01 +00:00
CC-Tweaked/projects/common/src/main/java/dan200/computercraft/shared/util/Holiday.java
Jonathan Coates a74089d8ae
Bump dependency versions
Mostly in prep for 1.19.4.

 - Update to Loom 1.1.

   - Simplifies our handling of remapped configurations a little.
   - Removes the need for a fake fabric.mod.json in the API jar.

   For reasons I don't quite understand, this required us to bump the
   Fabric API version. Otherwise interfaces are not injected.

 - Update to Rollup 3.0.

 - Do NOT update NullAway: It now correctly checks @Nullable fields in
   inherited classes. This is good, but also a pain as Minecraft is a
   little over-eager in where it puts @Nullable.
2023-03-14 18:43:42 +00:00

36 lines
902 B
Java

/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.shared.util;
import java.time.LocalDateTime;
import java.time.Month;
import java.time.ZoneId;
public enum Holiday {
NONE,
/**
* 14th February.
*/
VALENTINES,
/**
* 24th-26th December.
*
* @see net.minecraft.client.renderer.blockentity.ChestRenderer
*/
CHRISTMAS;
public static Holiday getCurrent() {
var now = LocalDateTime.now(ZoneId.systemDefault());
var month = now.getMonth();
var day = now.getDayOfMonth();
if (month == Month.FEBRUARY && day == 14) return VALENTINES;
if (month == Month.DECEMBER && day >= 24 && day <= 26) return CHRISTMAS;
return NONE;
}
}