mirror of
https://github.com/SparklyPower/SparklyPaper.git
synced 2025-12-28 19:39:06 +00:00
50 lines
2.1 KiB
Diff
50 lines
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Paul Sauve <paul@technove.co>
|
|
Date: Sun, 13 Dec 2020 17:53:08 -0600
|
|
Subject: [PATCH] Only check for spooky season once an hour
|
|
|
|
Airplane
|
|
Copyright (C) 2020 Technove LLC
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java
|
|
index 451ffcfd1fc9fa3091dc2bd697e5d829dcf6443f..f06ffdca027e5477332c6bc0c381264b47633f78 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityBat.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityBat.java
|
|
@@ -222,13 +222,22 @@ public class EntityBat extends EntityAmbient {
|
|
}
|
|
}
|
|
|
|
+ // Airplane start - only check for spooky season once an hour
|
|
+ private static boolean isSpookySeason = false;
|
|
+ private static final int ONE_HOUR = 20 * 60 * 60;
|
|
+ private static int lastSpookyCheck = -ONE_HOUR;
|
|
private static boolean eJ() {
|
|
+ if (MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) {
|
|
LocalDate localdate = LocalDate.now();
|
|
int i = localdate.get(ChronoField.DAY_OF_MONTH);
|
|
int j = localdate.get(ChronoField.MONTH_OF_YEAR);
|
|
+ isSpookySeason = j == 10 && i >= 20 || j == 11 && i <= 3;
|
|
+ lastSpookyCheck = MinecraftServer.currentTick;
|
|
+ }
|
|
|
|
- return j == 10 && i >= 20 || j == 11 && i <= 3;
|
|
+ return isSpookySeason;
|
|
}
|
|
+ // Airplane end
|
|
|
|
@Override
|
|
protected float b(EntityPose entitypose, EntitySize entitysize) {
|