From 7db4b74ecf94160724bb883dbcf70d8a1d0bab94 Mon Sep 17 00:00:00 2001 From: bconlon Date: Tue, 25 Aug 2020 14:49:54 -0700 Subject: [PATCH] backport. --- .../gildedgames/the_aether/AetherConfig.java | 9 +++++ .../bosses/sun_spirit/EntitySunSpirit.java | 9 +++-- .../the_aether/world/AetherWorldProvider.java | 39 ++++++++++--------- 3 files changed, 36 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/gildedgames/the_aether/AetherConfig.java b/src/main/java/com/gildedgames/the_aether/AetherConfig.java index d7f60f5..c17af8b 100644 --- a/src/main/java/com/gildedgames/the_aether/AetherConfig.java +++ b/src/main/java/com/gildedgames/the_aether/AetherConfig.java @@ -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; + } } \ No newline at end of file diff --git a/src/main/java/com/gildedgames/the_aether/entities/bosses/sun_spirit/EntitySunSpirit.java b/src/main/java/com/gildedgames/the_aether/entities/bosses/sun_spirit/EntitySunSpirit.java index e2192fc..24ba5e3 100644 --- a/src/main/java/com/gildedgames/the_aether/entities/bosses/sun_spirit/EntitySunSpirit.java +++ b/src/main/java/com/gildedgames/the_aether/entities/bosses/sun_spirit/EntitySunSpirit.java @@ -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); + } } } diff --git a/src/main/java/com/gildedgames/the_aether/world/AetherWorldProvider.java b/src/main/java/com/gildedgames/the_aether/world/AetherWorldProvider.java index 3567e47..a3b5ba4 100644 --- a/src/main/java/com/gildedgames/the_aether/world/AetherWorldProvider.java +++ b/src/main/java/com/gildedgames/the_aether/world/AetherWorldProvider.java @@ -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;