geforkt von Mirrors/Paper
f344e092cd
This is a frequently requested feature. The permission is 'paper.antixray.bypass'.
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 7ef3de74d52fc7c1499c1247a612cb6dddcbb587..71daef97e99642776a9507409f26eb035544fd81 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -598,4 +598,9 @@ 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/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
|
index 05d7b7a67bfc117a91903db5f303587a4f8f8624..f390abf65d648e1e0697e2d802f3195a0241116e 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
|
@@ -386,10 +386,14 @@ public class EntityZombie extends EntityMonster {
|
|
@Override
|
|
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()) {
|
|
+ // Paper start
|
|
+ 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()) {
|
|
return;
|
|
}
|
|
+ if (world.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > world.paperConfig.zombieVillagerInfectionChance) {
|
|
+ return;
|
|
+ } // Paper end
|
|
|
|
EntityVillager entityvillager = (EntityVillager) entityliving;
|
|
// CraftBukkit start
|