backport.

This commit is contained in:
bconlon 2020-08-25 14:49:54 -07:00
parent 1370e77b91
commit 7db4b74ecf
3 changed files with 36 additions and 21 deletions

View file

@ -33,6 +33,8 @@ public class AetherConfig {
private static boolean aether_start;
private static boolean disable_eternal_day;
public static void init(File location) {
File newFile = new File(location + "/aether" + "/AetherI.cfg");
@ -79,6 +81,8 @@ public class AetherConfig {
repeat_sun_spirit_dialog = config.get("Misc", "If disabed, the Sun Spirit's dialog will only show once per world.", true).getBoolean(true);
disable_eternal_day = config.get("Misc", "Disables eternal day making time cycle in the Aether without having to kill the Sun Spirit. This is mainly intended for use in modpacks.", false).getBoolean(false);
config.save();
}
@ -168,4 +172,9 @@ public class AetherConfig {
{
return aether_start;
}
public static boolean eternalDayDisabled()
{
return disable_eternal_day;
}
}

View file

@ -207,11 +207,14 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss {
dungeonTarget.triggerAchievement(AchievementsAether.defeat_gold);
if (!this.worldObj.isRemote)
if (!AetherConfig.eternalDayDisabled())
{
if (!AetherData.getInstance(this.worldObj).isEternalDay())
if (!this.worldObj.isRemote)
{
AetherData.getInstance(this.worldObj).setEternalDay(true);
if (!AetherData.getInstance(this.worldObj).isEternalDay())
{
AetherData.getInstance(this.worldObj).setEternalDay(true);
}
}
}

View file

@ -35,39 +35,42 @@ public class AetherWorldProvider extends WorldProvider {
@Override
public float calculateCelestialAngle(long worldTime, float partialTicks)
{
if (!this.worldObj.isRemote)
if (!AetherConfig.eternalDayDisabled())
{
AetherData data = AetherData.getInstance(this.worldObj);
if (data.isEternalDay())
if (!this.worldObj.isRemote)
{
if (!data.isShouldCycleCatchup())
AetherData data = AetherData.getInstance(this.worldObj);
if (data.isEternalDay())
{
if (data.getAetherTime() != (worldTime % 24000L) && data.getAetherTime() != (worldTime + 1 % 24000L) && data.getAetherTime() != (worldTime - 1 % 24000L))
if (!data.isShouldCycleCatchup())
{
data.setAetherTime(Math.floorMod(data.getAetherTime() - 1, 24000L));
if (data.getAetherTime() != (worldTime % 24000L) && data.getAetherTime() != (worldTime + 1 % 24000L) && data.getAetherTime() != (worldTime - 1 % 24000L))
{
data.setAetherTime(Math.floorMod(data.getAetherTime() - 1, 24000L));
}
else
{
data.setShouldCycleCatchup(true);
}
}
else
{
data.setShouldCycleCatchup(true);
data.setAetherTime(worldTime);
}
this.aetherTime = data.getAetherTime();
AetherNetwork.sendToAll(new PacketSendTime(this.aetherTime));
data.setAetherTime(this.aetherTime);
}
else
{
data.setAetherTime(worldTime);
data.setAetherTime(6000);
}
this.aetherTime = data.getAetherTime();
AetherNetwork.sendToAll(new PacketSendTime(this.aetherTime));
data.setAetherTime(this.aetherTime);
}
else
{
data.setAetherTime(6000);
}
}
int i = (int)(this.aetherTime % 24000L);
int i = (int)(AetherConfig.eternalDayDisabled() ? worldTime : this.aetherTime % 24000L);
float f = ((float)i + partialTicks) / 24000.0F - 0.25F;