2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-02-22 22:19:19 +01: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
|
2020-10-16 23:08:33 +02:00
|
|
|
index 2700c626cdb612eec7f570c595b6f08365dd89c9..d8369d936bb7c060de1950878922998fd6804aa9 100644
|
2020-02-22 22:19:19 +01:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2020-10-16 23:08:33 +02:00
|
|
|
@@ -592,4 +592,9 @@ public class PaperWorldConfig {
|
2020-02-22 22:19:19 +01: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
|
2020-09-11 01:47:58 +02:00
|
|
|
index e2c3c7153ac20a07a9eb5d99078a3cc247b5d5c5..2ad7a9634a26c19c52b52d8da3eb5446ef113823 100644
|
2020-02-22 22:19:19 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
2020-08-25 04:22:08 +02:00
|
|
|
@@ -386,10 +386,14 @@ public class EntityZombie extends EntityMonster {
|
2020-02-22 22:19:19 +01:00
|
|
|
@Override
|
2020-08-25 04:22:08 +02: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 22:19:19 +01:00
|
|
|
+ // Paper start
|
2020-08-25 04:22:08 +02: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 22:19:19 +01:00
|
|
|
return;
|
2020-06-26 01:38:24 +02:00
|
|
|
}
|
|
|
|
+ if (world.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > world.paperConfig.zombieVillagerInfectionChance) {
|
|
|
|
+ return;
|
2020-02-22 22:19:19 +01:00
|
|
|
+ } // Paper end
|
|
|
|
|
|
|
|
EntityVillager entityvillager = (EntityVillager) entityliving;
|
2020-08-25 04:22:08 +02:00
|
|
|
// CraftBukkit start
|