mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-23 00:39:22 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@681c013 Bundle spark (#11093) PaperMC/Paper@5fee9c6 Move configuration option to a system property PaperMC/Paper@aa3b356 Improve server startup logging (#11110) PaperMC/Paper@9aea240 Properly lookup plugin classes when looked up by spark PaperMC/Paper@7e91a2c Update the bundled spark version
86 lines
3.6 KiB
Diff
86 lines
3.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Wed, 23 Nov 2022 16:29:01 +0100
|
|
Subject: [PATCH] Predict Halloween
|
|
|
|
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
|
index dc27ddf5131e7398a5390a5187261d4c7fb6ccaa..f223e369dd8d781e32e1f06572b2ae717afd6f32 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
|
@@ -1,6 +1,6 @@
|
|
package net.minecraft.world.entity.ambient;
|
|
|
|
-import java.time.LocalDate;
|
|
+import java.time.OffsetDateTime;
|
|
import java.time.temporal.ChronoField;
|
|
import javax.annotation.Nullable;
|
|
import net.minecraft.core.BlockPos;
|
|
@@ -239,12 +239,60 @@ public class Bat extends AmbientCreature {
|
|
}
|
|
}
|
|
|
|
+ // Gale start - predict Halloween
|
|
+ /**
|
|
+ * The 1-indexed month of the year that Halloween starts (inclusive).
|
|
+ */
|
|
+ private static final int halloweenStartMonthOfYear = 10;
|
|
+
|
|
+ /**
|
|
+ * The 1-indexed day of the month that Halloween starts (inclusive).
|
|
+ */
|
|
+ private static final int halloweenStartDayOfMonth = 20;
|
|
+
|
|
+ /**
|
|
+ * The 1-indexed month of the year that Halloween ends (exclusive).
|
|
+ */
|
|
+ private static final int halloweenEndMonthOfYear = 11;
|
|
+
|
|
+ /**
|
|
+ * The 1-indexed day of the month that Halloween ends (exclusive).
|
|
+ */
|
|
+ private static final int halloweenEndDayOfMonth = 4;
|
|
+
|
|
+ /**
|
|
+ * The next start of Halloween, given as milliseconds since the Unix epoch.
|
|
+ * Will be 0 while not computed yet.
|
|
+ */
|
|
+ private static long nextHalloweenStart = 0;
|
|
+
|
|
+ /**
|
|
+ * The next end of Halloween, given as milliseconds since the Unix epoch.
|
|
+ * Will be 0 while not computed yet.
|
|
+ */
|
|
+ private static long nextHalloweenEnd = 0;
|
|
+ // Gale end - predict Halloween
|
|
+
|
|
private static boolean isHalloween() {
|
|
- LocalDate localdate = LocalDate.now();
|
|
- int i = localdate.get(ChronoField.DAY_OF_MONTH);
|
|
- int j = localdate.get(ChronoField.MONTH_OF_YEAR);
|
|
+ // Gale start - predict Halloween
|
|
+ long currentEpochMillis = System.currentTimeMillis();
|
|
+ if (currentEpochMillis >= nextHalloweenEnd) {
|
|
+ // Update prediction
|
|
+
|
|
+ OffsetDateTime currentDate = OffsetDateTime.now();
|
|
+ int currentMonthOfYear = currentDate.get(ChronoField.MONTH_OF_YEAR);
|
|
+ int currentDayOfMonth = currentDate.get(ChronoField.DAY_OF_YEAR);
|
|
+
|
|
+ OffsetDateTime nextHalloweenStartDate = currentDate.with(ChronoField.MONTH_OF_YEAR, halloweenStartMonthOfYear).with(ChronoField.DAY_OF_MONTH, halloweenStartDayOfMonth);
|
|
+ if (currentMonthOfYear > halloweenStartMonthOfYear || (currentMonthOfYear == halloweenStartMonthOfYear && currentDayOfMonth >= halloweenStartDayOfMonth)) {
|
|
+ nextHalloweenStartDate = nextHalloweenStartDate.with(ChronoField.YEAR, nextHalloweenStartDate.get(ChronoField.YEAR) + 1);
|
|
+ }
|
|
|
|
- return j == 10 && i >= 20 || j == 11 && i <= 3;
|
|
+ nextHalloweenStart = nextHalloweenStartDate.toEpochSecond();
|
|
+ nextHalloweenEnd = nextHalloweenStartDate.with(ChronoField.MONTH_OF_YEAR, halloweenEndMonthOfYear).with(ChronoField.DAY_OF_MONTH, halloweenEndDayOfMonth).toEpochSecond();
|
|
+ }
|
|
+ return currentEpochMillis >= nextHalloweenStart;
|
|
+ // Gale end - predict Halloween
|
|
}
|
|
|
|
private void setupAnimationStates() {
|