geforkt von Mirrors/Paper
45 Zeilen
2.8 KiB
Diff
45 Zeilen
2.8 KiB
Diff
|
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
|
||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||
|
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||
|
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/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||
|
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||
|
@@ -0,0 +0,0 @@ public class Zombie extends Monster {
|
||
|
@Override
|
||
|
public void killed(ServerLevel worldserver, LivingEntity entityliving) {
|
||
|
super.killed(worldserver, entityliving);
|
||
|
- if ((worldserver.getDifficulty() == Difficulty.NORMAL || worldserver.getDifficulty() == Difficulty.HARD) && entityliving instanceof Villager) {
|
||
|
- if (worldserver.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) {
|
||
|
+ // Paper start
|
||
|
+ if (level.paperConfig.zombieVillagerInfectionChance != 0.0 && (level.paperConfig.zombieVillagerInfectionChance != -1.0 || worldserver.getDifficulty() == Difficulty.NORMAL || worldserver.getDifficulty() == Difficulty.HARD) && entityliving instanceof Villager) {
|
||
|
+ if (level.paperConfig.zombieVillagerInfectionChance == -1.0 && worldserver.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) {
|
||
|
return;
|
||
|
}
|
||
|
+ if (level.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > level.paperConfig.zombieVillagerInfectionChance) {
|
||
|
+ return;
|
||
|
+ } // Paper end
|
||
|
|
||
|
Villager entityvillager = (Villager) entityliving;
|
||
|
// CraftBukkit start
|