mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 01:17:42 +01:00
Extend Halloween Optimization (#321)
This commit is contained in:
83
patches/server/0211-Extend-Halloween-Optimization.patch
Normal file
83
patches/server/0211-Extend-Halloween-Optimization.patch
Normal file
@@ -0,0 +1,83 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Fri, 7 May 2021 03:35:42 +0200
|
||||
Subject: [PATCH] Extend Halloween Optimization
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ambient/EntityBat.java b/src/main/java/net/minecraft/world/entity/ambient/EntityBat.java
|
||||
index bd02320d450a7fd7254f01b1c44ef421c1810ea7..dcc1f203b9bc0510d4c7fedbb4db7a10855d630f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ambient/EntityBat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ambient/EntityBat.java
|
||||
@@ -311,17 +311,31 @@ public class EntityBat extends EntityAmbient {
|
||||
private static boolean isSpookySeason = false;
|
||||
private static final int ONE_HOUR = 20 * 60 * 60;
|
||||
private static int lastSpookyCheck = -ONE_HOUR;
|
||||
- private static boolean eJ() {
|
||||
+ // Purpur start
|
||||
+ private static boolean isHalloween = false;
|
||||
+ private static boolean eJ() { return isSpookySeason(); }
|
||||
+
|
||||
+ public static boolean isSpookySeason() {
|
||||
+ checkSeason();
|
||||
+ return isSpookySeason;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isHalloween() {
|
||||
+ checkSeason();
|
||||
+ return isHalloween;
|
||||
+ }
|
||||
+
|
||||
+ public static void checkSeason() {
|
||||
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;
|
||||
+ LocalDate localdate = LocalDate.now();
|
||||
+ int month = localdate.get(ChronoField.DAY_OF_MONTH);
|
||||
+ int day = localdate.get(ChronoField.MONTH_OF_YEAR);
|
||||
+ isHalloween = day == 10 && month == 31; // Purpur
|
||||
+ isSpookySeason = day == 10 && month >= 20 || day == 11 && month <= 3;
|
||||
lastSpookyCheck = MinecraftServer.currentTick;
|
||||
}
|
||||
-
|
||||
- return isSpookySeason;
|
||||
}
|
||||
+ // Purpur end
|
||||
// Airplane end
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
index 7ec60987229927e5fe7164f1d4eae8222832e920..bccbde579fcaa0c5f606dc3bb0cd1a32b9d7a1a6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
@@ -154,11 +154,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR
|
||||
this.eL();
|
||||
this.setCanPickupLoot(this.world.paperConfig.skeletonsAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * difficultydamagescaler.d()); // Paper
|
||||
if (this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
- LocalDate localdate = LocalDate.now();
|
||||
- int i = localdate.get(ChronoField.DAY_OF_MONTH);
|
||||
- int j = localdate.get(ChronoField.MONTH_OF_YEAR);
|
||||
-
|
||||
- if (j == 10 && i == 31 && this.random.nextFloat() < 0.25F) {
|
||||
+ if (net.minecraft.world.entity.ambient.EntityBat.isHalloween() && this.random.nextFloat() < 0.25F) { // Purpur
|
||||
this.setSlot(EnumItemSlot.HEAD, new ItemStack(this.random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN));
|
||||
this.dropChanceArmor[EnumItemSlot.HEAD.b()] = 0.0F;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
index 7112db516e62ca75a445482005c524129b84f54c..ef8f6b442304285e2b398c9143e9e98e29330220 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
@@ -585,11 +585,7 @@ public class EntityZombie extends EntityMonster {
|
||||
}
|
||||
|
||||
if (this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
- LocalDate localdate = LocalDate.now();
|
||||
- int i = localdate.get(ChronoField.DAY_OF_MONTH);
|
||||
- int j = localdate.get(ChronoField.MONTH_OF_YEAR);
|
||||
-
|
||||
- if (j == 10 && i == 31 && this.random.nextFloat() < 0.25F) {
|
||||
+ if (net.minecraft.world.entity.ambient.EntityBat.isHalloween() && this.random.nextFloat() < 0.25F) { // Purpur
|
||||
this.setSlot(EnumItemSlot.HEAD, new ItemStack(this.random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN));
|
||||
this.dropChanceArmor[EnumItemSlot.HEAD.b()] = 0.0F;
|
||||
}
|
||||
Reference in New Issue
Block a user