From df5cd16a8e915ce2aa22bf1ba1e43340c4903fa5 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Mon, 4 Nov 2013 03:40:11 -0500 Subject: [PATCH] Added a date method to modprefab Added it since i'm going to be working on objects that only work during set times of the year. --- src/dark/core/prefab/ModPrefab.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/dark/core/prefab/ModPrefab.java b/src/dark/core/prefab/ModPrefab.java index c17578e27..6b5b65eee 100644 --- a/src/dark/core/prefab/ModPrefab.java +++ b/src/dark/core/prefab/ModPrefab.java @@ -1,11 +1,16 @@ package dark.core.prefab; +import java.util.Calendar; +import java.util.Date; + import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraftforge.common.MinecraftForge; import org.modstats.Modstats; +import com.builtbroken.common.Triple; + import universalelectricity.compatibility.Compatibility; import universalelectricity.core.UniversalElectricity; import cpw.mods.fml.common.FMLCommonHandler; @@ -40,6 +45,8 @@ public abstract class ModPrefab public static int BLOCK_ID_PRE = 3100; public static int ITEM_ID_PREFIX = 13200; + private static Triple date; + public abstract String getDomain(); /** Gets the next unused ID in the block list. Does not prevent config file issues after the file @@ -112,6 +119,19 @@ public abstract class ModPrefab System.out.println(" " + data); } + @SuppressWarnings("deprecation") + public static Triple getDate() + { + Calendar cal = Calendar.getInstance(); + Date d = cal.getTime(); + + if (date == null || date.getB() != d.getDay()) + { + date = new Triple(d.getMonth(), d.getDay(), d.getYear()); + } + return date; + } + /** Loads the settings that tell what this mod is named, about, and other info to the user */ public abstract void loadModMeta();