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
|
2020-06-25 23:38:24 +00:00
|
|
|
index 101a473ff8979b37098fde7ac6ac66c6ed1b0282..9e8485679bd36481c2bd2f0c7cfa49892f0e4baf 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
|
2020-06-25 23:38:24 +00:00
|
|
|
@@ -606,4 +606,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
|
2020-06-25 23:38:24 +00:00
|
|
|
index 9bb54d13a318199bbce3d5b32db3710f822daa40..ad8b1f0e419e6341eb46def2dc58423588a65882 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
|
2020-06-25 23:38:24 +00:00
|
|
|
@@ -390,10 +390,14 @@ public class EntityZombie extends EntityMonster {
|
2020-02-22 21:19:19 +00:00
|
|
|
@Override
|
2020-06-25 23:38:24 +00:00
|
|
|
public void a_(EntityLiving entityliving) {
|
|
|
|
super.a_(entityliving);
|
2020-02-22 21:19:19 +00:00
|
|
|
- if ((this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) {
|
|
|
|
- if (this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
|
|
|
|
+ // Paper start
|
|
|
|
+ if (world.paperConfig.zombieVillagerInfectionChance != 0.0 && (world.paperConfig.zombieVillagerInfectionChance != -1.0 || this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) {
|
|
|
|
+ if (world.paperConfig.zombieVillagerInfectionChance == -1.0 && this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
|
|
|
|
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;
|
|
|
|
EntityZombieVillager entityzombievillager = (EntityZombieVillager) EntityTypes.ZOMBIE_VILLAGER.a(this.world);
|