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.
This commit is contained in:
DarkGuardsman 2013-11-04 03:40:11 -05:00
parent 8043e49528
commit df5cd16a8e

View file

@ -1,11 +1,16 @@
package dark.core.prefab; package dark.core.prefab;
import java.util.Calendar;
import java.util.Date;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import org.modstats.Modstats; import org.modstats.Modstats;
import com.builtbroken.common.Triple;
import universalelectricity.compatibility.Compatibility; import universalelectricity.compatibility.Compatibility;
import universalelectricity.core.UniversalElectricity; import universalelectricity.core.UniversalElectricity;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -40,6 +45,8 @@ public abstract class ModPrefab
public static int BLOCK_ID_PRE = 3100; public static int BLOCK_ID_PRE = 3100;
public static int ITEM_ID_PREFIX = 13200; public static int ITEM_ID_PREFIX = 13200;
private static Triple<Integer, Integer, Integer> date;
public abstract String getDomain(); public abstract String getDomain();
/** Gets the next unused ID in the block list. Does not prevent config file issues after the file /** 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); System.out.println(" " + data);
} }
@SuppressWarnings("deprecation")
public static Triple<Integer, Integer, Integer> getDate()
{
Calendar cal = Calendar.getInstance();
Date d = cal.getTime();
if (date == null || date.getB() != d.getDay())
{
date = new Triple<Integer, Integer, Integer>(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 */ /** Loads the settings that tell what this mod is named, about, and other info to the user */
public abstract void loadModMeta(); public abstract void loadModMeta();