Files
MagicBees/thaumicbees_src/thaumicbees/main/utils/MoonPhase.java
T
MysteriousAges 6a26bec4e1 Fucktons of refactoring.
*Moving ItemManager & BlockManager functionality into Config object.
*New CraftingManager to hold all the crafting stuff
*Shuffling some classes around in packages and whatnot.
*Switching to use the ItemInterface provided by Thaumcraft's API rather than reading configs.
*New texture stuff for a magic apiary.
2013-02-05 01:16:01 -08:00

43 lines
900 B
Java

package thaumicbees.main.utils;
import net.minecraft.world.World;
/**
* Class to abstract the moon phase from the world time a bit.
*/
public enum MoonPhase
{
FULL,
WANING_GIBBOUS,
WANING_HALF,
WANING_CRESCENT,
NEW,
WAXING_CRESCENT,
WAXING_HALF,
WAXING_GIBBOUS;
public boolean isBetween(MoonPhase first, MoonPhase second)
{
boolean flag = false;
if (first.ordinal() <= second.ordinal())
{
// Straightforward.
flag = first.ordinal() <= this.ordinal() && this.ordinal() <= second.ordinal();
}
else
{
// Wraps around the boundary.
flag = (first.ordinal() <= this.ordinal() && this.ordinal() <= WAXING_GIBBOUS.ordinal()) ||
(FULL.ordinal() <= this.ordinal() && this.ordinal() <= second.ordinal());
}
return flag;
}
public static MoonPhase getMoonPhase(World w)
{
return MoonPhase.values()[(int)((w.getWorldTime() + 6000) / 24000L) % 8];
}
}