mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
Fix villager infection chance not being handled properly (#9897)
This commit is contained in:
parent
1865625d95
commit
0b218903a8
1 changed files with 3 additions and 3 deletions
|
@ -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.
|
* 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
|
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
|
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||||
+++ b/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 {
|
@@ -452,12 +452,8 @@ public class Zombie extends Monster {
|
||||||
|
@ -21,8 +21,8 @@ index 2be074ecbc131b68574cf77ba9cab96424715522..4215c45aa1073b3c70eb58a06eb3dce2
|
||||||
- if (world.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) {
|
- if (world.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) {
|
||||||
- return flag;
|
- return flag;
|
||||||
- }
|
- }
|
||||||
+ final double fallbackChance = world.getDifficulty() == Difficulty.HARD ? 1d : world.getDifficulty() == Difficulty.NORMAL ? 0.5d : 0d; // Paper
|
+ final double fallbackChance = world.getDifficulty() == Difficulty.HARD ? 100d : world.getDifficulty() == Difficulty.NORMAL ? 50d : 0d; // Paper
|
||||||
+ if (this.random.nextDouble() < world.paperConfig().entities.behavior.zombieVillagerInfectionChance.or(fallbackChance) && other instanceof Villager entityvillager) { // Paper
|
+ if (this.random.nextDouble() * 100 < world.paperConfig().entities.behavior.zombieVillagerInfectionChance.or(fallbackChance) && other instanceof Villager entityvillager) { // Paper
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
flag = Zombie.zombifyVillager(world, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION) == null;
|
flag = Zombie.zombifyVillager(world, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION) == null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue