3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00

Fix villager infection chance not being handled properly (#9897)

Dieser Commit ist enthalten in:
Md5Lukas 2023-11-01 22:59:00 +01:00 committet von GitHub
Ursprung 1865625d95
Commit 0b218903a8
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -8,7 +8,7 @@ This allows you to solve an issue in vanilla behavior where:
* On normal difficulty they will have a 50% of getting infected or dying.
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 2be074ecbc131b68574cf77ba9cab96424715522..4215c45aa1073b3c70eb58a06eb3dce26f389c90 100644
index 39a508b2834e554e94d635abd0d4a549f317dee5..93ca1016806103fe688379c99afc57cb02635f65 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -452,12 +452,8 @@ public class Zombie extends Monster {
@ -21,8 +21,8 @@ index 2be074ecbc131b68574cf77ba9cab96424715522..4215c45aa1073b3c70eb58a06eb3dce2
- if (world.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) {
- return flag;
- }
+ final double fallbackChance = world.getDifficulty() == Difficulty.HARD ? 1d : world.getDifficulty() == Difficulty.NORMAL ? 0.5d : 0d; // Paper
+ if (this.random.nextDouble() < world.paperConfig().entities.behavior.zombieVillagerInfectionChance.or(fallbackChance) && other instanceof Villager entityvillager) { // Paper
+ final double fallbackChance = world.getDifficulty() == Difficulty.HARD ? 100d : world.getDifficulty() == Difficulty.NORMAL ? 50d : 0d; // Paper
+ if (this.random.nextDouble() * 100 < world.paperConfig().entities.behavior.zombieVillagerInfectionChance.or(fallbackChance) && other instanceof Villager entityvillager) { // Paper
// CraftBukkit start
flag = Zombie.zombifyVillager(world, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION) == null;
}