2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-02-22 21:19:19 +00:00
|
|
|
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
|
2021-01-11 01:44:06 +00:00
|
|
|
index fe1c9dd8258ec8c3fdf343d4a44de2be2ae3d35f..525d702d78a609af987ebd2c32169b873e5c05ed 100644
|
2020-02-22 21:19:19 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2021-01-11 01:44:06 +00:00
|
|
|
@@ -604,4 +604,9 @@ public class PaperWorldConfig {
|
2020-02-22 21:19:19 +00:00
|
|
|
private void nerfNetherPortalPigmen() {
|
|
|
|
nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public double zombieVillagerInfectionChance = -1.0;
|
|
|
|
+ private void zombieVillagerInfectionChance() {
|
|
|
|
+ zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
2021-03-08 23:12:31 +00:00
|
|
|
index ab678bfa024ac3e963d5ca85a01c6df91dd6bc42..555c74feb0d678d8f05d89e274f4736fc35ffebf 100644
|
2020-02-22 21:19:19 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
2021-03-08 23:12:31 +00:00
|
|
|
@@ -388,10 +388,14 @@ public class EntityZombie extends EntityMonster {
|
2020-02-22 21:19:19 +00:00
|
|
|
@Override
|
2020-08-25 02:22:08 +00:00
|
|
|
public void a(WorldServer worldserver, EntityLiving entityliving) {
|
|
|
|
super.a(worldserver, entityliving);
|
|
|
|
- if ((worldserver.getDifficulty() == EnumDifficulty.NORMAL || worldserver.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) {
|
|
|
|
- if (worldserver.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
|
2020-02-22 21:19:19 +00:00
|
|
|
+ // Paper start
|
2020-08-25 02:22:08 +00:00
|
|
|
+ if (world.paperConfig.zombieVillagerInfectionChance != 0.0 && (world.paperConfig.zombieVillagerInfectionChance != -1.0 || worldserver.getDifficulty() == EnumDifficulty.NORMAL || worldserver.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) {
|
|
|
|
+ if (world.paperConfig.zombieVillagerInfectionChance == -1.0 && worldserver.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
|
2020-02-22 21:19:19 +00:00
|
|
|
return;
|
2020-06-25 23:38:24 +00:00
|
|
|
}
|
|
|
|
+ if (world.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > world.paperConfig.zombieVillagerInfectionChance) {
|
|
|
|
+ return;
|
2020-02-22 21:19:19 +00:00
|
|
|
+ } // Paper end
|
|
|
|
|
|
|
|
EntityVillager entityvillager = (EntityVillager) entityliving;
|
2020-08-25 02:22:08 +00:00
|
|
|
// CraftBukkit start
|