2020-05-06 17:48:49 +08:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-02-23 05:19:19 +08: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 09:44:06 +08:00
|
|
|
index fe1c9dd8258ec8c3fdf343d4a44de2be2ae3d35f..525d702d78a609af987ebd2c32169b873e5c05ed 100644
|
2020-02-23 05:19:19 +08:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2021-01-11 09:44:06 +08:00
|
|
|
@@ -604,4 +604,9 @@ public class PaperWorldConfig {
|
2020-02-23 05:19:19 +08: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);
|
|
|
|
+ }
|
|
|
|
}
|
2021-03-16 15:19:45 +08:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java
|
|
|
|
index f406826945dd752e6528743a0c8cad3cfdfc4a95..3d8d4a43e6cd554b6f1eeafa1c8d43cef877139a 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java
|
|
|
|
@@ -450,10 +450,14 @@ public class EntityZombie extends EntityMonster {
|
2020-02-23 05:19:19 +08:00
|
|
|
@Override
|
2020-08-25 10:22:08 +08: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-23 05:19:19 +08:00
|
|
|
+ // Paper start
|
2020-08-25 10:22:08 +08: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-23 05:19:19 +08:00
|
|
|
return;
|
2020-06-26 07:38:24 +08:00
|
|
|
}
|
|
|
|
+ if (world.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > world.paperConfig.zombieVillagerInfectionChance) {
|
|
|
|
+ return;
|
2020-02-23 05:19:19 +08:00
|
|
|
+ } // Paper end
|
|
|
|
|
|
|
|
EntityVillager entityvillager = (EntityVillager) entityliving;
|
2020-08-25 10:22:08 +08:00
|
|
|
// CraftBukkit start
|