mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@d129162 Properly handle BlockBreakEvent#isDropItems (#8936) PaperMC/Paper@67a1a8c Fix Inventory#getLocation not working for the composter (#9596) PaperMC/Paper@5b34a09 Add option to disable chorus plant and mushroom block updates (#9442) PaperMC/Paper@ed8401c Fix rotation for spawning display entities (#9552) PaperMC/Paper@bd67b83 Determine lava and water fluid explosion resistance by their block explosion resistance (#9482) PaperMC/Paper@d928dda Don't tab-complete namespaced commands if `send-namespaced` is false (#9366) PaperMC/Paper@f43a19c Fix CME in CraftPersistentDataTypeRegistry (#6701) PaperMC/Paper@45ba652 [ci skip] Rebuild patches PaperMC/Paper@990765b Fire entity death event for ender dragon (#9495) PaperMC/Paper@1259b93 Fixed CraftItemStack/CraftItemMeta enchantment level inconsistency (#8792) PaperMC/Paper@88891c3 Add Entity Coordinate and Rotation API (#9461) PaperMC/Paper@5bf82aa Add cancellability to PlayerTrackEntityEvent (#8605) PaperMC/Paper@1b96c64 Improve cancelling PreCreatureSpawnEvent with per player mob spawns (#9400) PaperMC/Paper@7232506 Add entity tracker min Y distance config option (#9406) PaperMC/Paper@00a68b1 Player listing API (#8782) PaperMC/Paper@af6142e [ci skip] Update Gradle wrapper PaperMC/Paper@281855c Remove unused lag-compensate-block-breaking option (#9635) PaperMC/Paper@35ef053 [ci skip] update editorconfig and gitattributes (#9608) PaperMC/Paper@97b9c4a Fix NPE on Boat#getStatus (#9115) PaperMC/Paper@2be57c6 Expand Pose API (#8781) PaperMC/Paper@b29ecd4 Expose clicked BlockFace during BlockDamageEvent (#9632) PaperMC/Paper@e3f29f4 MerchantRecipe: add copy constructor (#8703) PaperMC/Paper@fed9042 More DragonBattle API (#5655) PaperMC/Paper@27d39ca Properly clone custom nbt tags inside ItemMeta (#7849) PaperMC/Paper@0c7385b Add PlayerPickItemEvent (#5590) PaperMC/Paper@9395aa6 Improve performance of mass crafts (#9603) PaperMC/Paper@7386a13 Fix endgateway teleportation offset (#9517) PaperMC/Paper@a712766 Allow custom damage for trident (#8132) PaperMC/Paper@3716832 Prevent overfilled bundles from duplicating items (#9633) PaperMC/Paper@9cbad8e Expose Hand during BlockCanBuildEvent (#9636)
80 lines
5.1 KiB
Diff
80 lines
5.1 KiB
Diff
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 c3d1d77a5703db4e1e3eb38fdd0b8903f691bf25..c103c3da165ec4a9717400fdf278de2a667edd2a 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
|
@@ -300,7 +300,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;
|
|
@@ -314,6 +314,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 892ae3a9ac2395896ff7881c49eaece8d46e831e..41376b705748e14c1c4174e07732ce09ad8e581f 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
|
@@ -143,11 +143,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
|
this.reassessWeaponGoal();
|
|
this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || randomsource.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 && randomsource.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(randomsource.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 0bc90b6d5c5a3cb3477d41336a9bb1130ff32fa1..a8d2f8654ee370e98bb1c4e7e1111debd62a7429 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
|
@@ -593,11 +593,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 && randomsource.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(randomsource.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN));
|
|
this.armorDropChances[EquipmentSlot.HEAD.getIndex()] = 0.0F;
|
|
}
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index af78db690b3d3437aedcb72bca76b01a4689921d..af6de9d4d6dace3f26b7012606d399f5c398ef0a 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -1623,6 +1623,13 @@ public class PurpurWorldConfig {
|
|
guardianTakeDamageFromWater = getBoolean("mobs.guardian.takes-damage-from-water", guardianTakeDamageFromWater);
|
|
}
|
|
|
|
+ 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 = true;
|
|
public boolean hoglinControllable = true;
|