2021-06-11 12:02:28 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Zero <zero@cock.li>
|
|
|
|
Date: Sat, 22 Feb 2020 16:10:31 -0500
|
|
|
|
Subject: [PATCH] Configurable chance of villager zombie infection
|
|
|
|
|
|
|
|
This allows you to solve an issue in vanilla behavior where:
|
|
|
|
* On easy difficulty your villagers will NEVER get infected, meaning they will always die.
|
|
|
|
* On normal difficulty they will have a 50% of getting infected or dying.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2022-03-11 20:13:46 +00:00
|
|
|
index 8ff3719184484399ba1760b0f5e43e3ca961a028..3db1230c3abe8f4ba321146f8adbff7fadad9362 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2022-03-11 20:13:46 +00:00
|
|
|
@@ -531,6 +531,11 @@ public class PaperWorldConfig {
|
2021-06-11 12:02:28 +00:00
|
|
|
nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen);
|
|
|
|
}
|
2021-06-13 22:05:18 +00:00
|
|
|
|
2021-06-11 12:02:28 +00:00
|
|
|
+ public double zombieVillagerInfectionChance = -1.0;
|
|
|
|
+ private void zombieVillagerInfectionChance() {
|
|
|
|
+ zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance);
|
|
|
|
+ }
|
2021-06-13 22:05:18 +00:00
|
|
|
+
|
|
|
|
public int lightQueueSize = 20;
|
|
|
|
private void lightQueueSize() {
|
|
|
|
lightQueueSize = getInt("light-queue-size", lightQueueSize);
|
2021-06-11 12:02:28 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
2022-03-01 02:44:07 +00:00
|
|
|
index 996613d75f66d97c3bd5241ca1c1346b92ec06dd..0ca58915b6b2eaf6a9765ba75d3e0773690ea040 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
2021-11-24 09:01:27 +00:00
|
|
|
@@ -449,10 +449,13 @@ public class Zombie extends Monster {
|
2021-06-11 12:02:28 +00:00
|
|
|
@Override
|
2021-06-13 22:05:18 +00:00
|
|
|
public void killed(ServerLevel world, LivingEntity other) {
|
|
|
|
super.killed(world, other);
|
|
|
|
- if ((world.getDifficulty() == Difficulty.NORMAL || world.getDifficulty() == Difficulty.HARD) && other instanceof Villager) {
|
|
|
|
- if (world.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) {
|
|
|
|
+ if (level.paperConfig.zombieVillagerInfectionChance != 0.0 && (level.paperConfig.zombieVillagerInfectionChance != -1.0 || world.getDifficulty() == Difficulty.NORMAL || world.getDifficulty() == Difficulty.HARD) && other instanceof Villager) {
|
|
|
|
+ if (level.paperConfig.zombieVillagerInfectionChance == -1.0 && world.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) {
|
2021-06-11 12:02:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
+ if (level.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > level.paperConfig.zombieVillagerInfectionChance) {
|
|
|
|
+ return;
|
|
|
|
+ } // Paper end
|
|
|
|
|
2021-06-13 22:05:18 +00:00
|
|
|
Villager entityvillager = (Villager) other;
|
2021-06-11 12:02:28 +00:00
|
|
|
// CraftBukkit start
|