mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-22 21:20:02 +00:00
*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.
43 lines
900 B
Java
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];
|
|
}
|
|
}
|