From 0b218903a88f87738a4e6487a4cb87c8ea4ba211 Mon Sep 17 00:00:00 2001 From: Md5Lukas Date: Wed, 1 Nov 2023 22:59:00 +0100 Subject: [PATCH] Fix villager infection chance not being handled properly (#9897) --- ...5-Configurable-chance-of-villager-zombie-infection.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/server/0355-Configurable-chance-of-villager-zombie-infection.patch b/patches/server/0355-Configurable-chance-of-villager-zombie-infection.patch index fa42ff9be2..1da6163a58 100644 --- a/patches/server/0355-Configurable-chance-of-villager-zombie-infection.patch +++ b/patches/server/0355-Configurable-chance-of-villager-zombie-infection.patch @@ -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; }