mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Halloween options and optimizations (#659)
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Mon, 13 Sep 2021 04:48:21 +0200
|
||||
Subject: [PATCH] Halloween options and optimizations
|
||||
|
||||
|
||||
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 e749f0f3a35783cada224e4b0c12f294c3245210..1e99282b2b1d433531cb2421ca69f3206f0aaf75 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
@@ -304,7 +304,7 @@ public class Bat extends AmbientCreature {
|
||||
int i = world.getMaxLocalRawBrightness(pos);
|
||||
byte b0 = 4;
|
||||
|
||||
- if (Bat.isHalloween()) {
|
||||
+ if (Bat.isHalloweenSeason(world.getMinecraftWorld())) { // Purpur
|
||||
b0 = 7;
|
||||
} else if (random.nextBoolean()) {
|
||||
return false;
|
||||
@@ -318,6 +318,7 @@ public class Bat extends AmbientCreature {
|
||||
private static boolean isSpookySeason = false;
|
||||
private static final int ONE_HOUR = 20 * 60 * 60;
|
||||
private static int lastSpookyCheck = -ONE_HOUR;
|
||||
+ public static boolean isHalloweenSeason(Level level) { return level.purpurConfig.forceHalloweenSeason || isHalloween(); } // Purpur
|
||||
private static boolean isHalloween() {
|
||||
if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) {
|
||||
LocalDate localdate = LocalDate.now();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
index 5b19d8db09867791782c899d41d314c511f6c8a2..3d8b1b8d49af74babf628231345ac1c1864a8efb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -138,11 +138,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
this.reassessWeaponGoal();
|
||||
this.setCanPickUpLoot(this.level.paperConfig.skeletonsAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper
|
||||
if (this.getItemBySlot(EquipmentSlot.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.Bat.isHalloweenSeason(world.getMinecraftWorld()) && this.random.nextFloat() < this.level.purpurConfig.chanceHeadHalloweenOnEntity) { // Purpur
|
||||
this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(this.random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN));
|
||||
this.armorDropChances[EquipmentSlot.HEAD.getIndex()] = 0.0F;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
index 39fa4a9a52c510e88036ab790a8739d20935188b..60080323686b7c76529fce4a8e95664e5c651ce9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -563,11 +563,7 @@ public class Zombie extends Monster {
|
||||
}
|
||||
|
||||
if (this.getItemBySlot(EquipmentSlot.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.Bat.isHalloweenSeason(world.getMinecraftWorld()) && this.random.nextFloat() < this.level.purpurConfig.chanceHeadHalloweenOnEntity) { // Purpur
|
||||
this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(this.random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN));
|
||||
this.armorDropChances[EquipmentSlot.HEAD.getIndex()] = 0.0F;
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index f2c1e1a97c4fe264df6ab36ffb1ceff77e54a936..146d2a1aee5f4f4dee103406ddcf132d1f97d4ce 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1479,6 +1479,13 @@ public class PurpurWorldConfig {
|
||||
guardianMaxHealth = getDouble("mobs.guardian.attributes.max_health", guardianMaxHealth);
|
||||
}
|
||||
|
||||
+ public boolean forceHalloweenSeason = false;
|
||||
+ public float chanceHeadHalloweenOnEntity = 0.25F;
|
||||
+ private void halloweenSetting() {
|
||||
+ forceHalloweenSeason = getBoolean("gameplay-mechanics.halloween.force", forceHalloweenSeason);
|
||||
+ chanceHeadHalloweenOnEntity = (float) getDouble("gameplay-mechanics.halloween.head-chance", chanceHeadHalloweenOnEntity);
|
||||
+ }
|
||||
+
|
||||
public boolean hoglinRidable = false;
|
||||
public boolean hoglinRidableInWater = false;
|
||||
public double hoglinMaxHealth = 40.0D;
|
||||
Reference in New Issue
Block a user