Files
MagicBees/thaumicbees_src/thaumicbees/bees/MoonPhase.java
T
MysteriousAges eafc34cb54 Updating to Forestry 2.0 API & whatnot.
*Hive Frames
*Fixed problems with Ghastly bee
*Better Thaumcraft Integration & fix for NBT Bee recipes
2013-01-26 13:42:39 -08:00

43 lines
885 B
Java

package thaumicbees.bees;
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() / 24000L) % 8];
}
}