Adding alternate localization scheme for moon phase sensitive mutations. Closes #54.

This commit is contained in:
MysteriousAges committed 2015-05-19 23:09:10 -07:00
1 parent 7e930f44be
commit 4f41f39f92
3 files changed
+29 -18

No files matched your search

@@ -493,7 +493,7 @@ public class BeeMutation implements IBeeMutation
if (moonPhaseStart != moonPhaseEnd)
{
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresPhase"),
moonPhaseStart.getLocalizedName(), moonPhaseEnd.getLocalizedName()));
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt()));
}
else
{
@@ -5,8 +5,7 @@ import net.minecraft.world.World;
/**
* Class to abstract the moon phase from the world time a bit.
*/
public enum MoonPhase
{
public enum MoonPhase {
FULL("full"),
WANING_GIBBOUS("gibbousWaning"),
WANING_HALF("halfWaning"),
@@ -18,22 +17,18 @@ public enum MoonPhase
private String phaseName;
private MoonPhase(String name)
{
private MoonPhase(String name) {
this.phaseName = name;
}
public boolean isBetween(MoonPhase first, MoonPhase second)
{
public boolean isBetween(MoonPhase first, MoonPhase second) {
boolean flag = false;
if (first.ordinal() <= second.ordinal())
{
if (first.ordinal() <= second.ordinal()) {
// Straightforward.
flag = first.ordinal() <= this.ordinal() && this.ordinal() <= second.ordinal();
}
else
{
else {
// Wraps around the boundary.
flag = (first.ordinal() <= this.ordinal() && this.ordinal() <= WAXING_GIBBOUS.ordinal()) ||
(FULL.ordinal() <= this.ordinal() && this.ordinal() <= second.ordinal());
@@ -42,18 +37,23 @@ public enum MoonPhase
return flag;
}
public String getLocalizedName()
{
public String getLocalizedName() {
return LocalizationManager.getLocalizedString("moon." + this.phaseName);
}
public String getLocalizedNameAlt() {
String response = LocalizationManager.getLocalizedString("moon." + this.phaseName + ".alt");
if (response.isEmpty()) {
return getLocalizedName();
}
return response;
}
public static MoonPhase getMoonPhase(World w)
{
public static MoonPhase getMoonPhase(World w) {
return getMoonPhaseFromTime(w.getWorldTime());
}
public static MoonPhase getMoonPhaseFromTime(long time)
{
public static MoonPhase getMoonPhaseFromTime(long time) {
return MoonPhase.values()[(int)((time - 6000) / 24000L) % 8];
}
}
@@ -172,7 +172,7 @@ liquid.cryotheum=Gelid Cryotheum
liquid.mana=Primal Mana
liquid.coal=Liquifacted Coal
#Moondial
#Moondial & Mutation moon phase conditions
moon.full=Full Moon
moon.gibbousWaning=Waning Gibbous
moon.gibbousWaxing=Waxing Gibbous
@@ -182,6 +182,17 @@ moon.crescentWaning=Waning Crescent
moon.crescentWaxing=Waxing Crescent
moon.new=New Moon
# Alternate moon names for languages that require a different kind of localization. Remove # to activate.
# If missing, will fall back on the non-alternate versions.
#moon.alt.full=
#moon.alt.gibbousWaning=
#moon.alt.gibbousWaxing=
#moon.alt.halfWaning=
#moon.alt.halfWaxing=
#moon.alt.crescentWaning=
#moon.alt.crescentWaxing=
#moon.alt.new=
#Backpack
backpack.thaumaturge=Thaumaturge's Backpack