mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 10:27:44 +01:00
56 lines
3.0 KiB
Diff
56 lines
3.0 KiB
Diff
From f01e8363f2e512bca49c05ba2472b72e729e7b46 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Thu, 19 Dec 2019 16:59:46 -0600
|
|
Subject: [PATCH] Add option for zombie villager transformation chance
|
|
|
|
---
|
|
src/main/java/net/minecraft/server/EntityZombie.java | 11 +++++++++--
|
|
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 2 ++
|
|
2 files changed, 11 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
|
index 1e60cc399b..8938dc50fe 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
|
@@ -474,10 +474,17 @@ public class EntityZombie extends EntityMonster {
|
|
@Override
|
|
public void b(EntityLiving entityliving) {
|
|
super.b(entityliving);
|
|
- if ((this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) {
|
|
- if (this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
|
|
+ // Purpur start
|
|
+ if (entityliving instanceof EntityVillager) {
|
|
+ double chance = world.purpurConfig.zombieVillagerTransformationChance;
|
|
+ if (chance < 0) {
|
|
+ if (world.getDifficulty() == EnumDifficulty.EASY || (world.getDifficulty() != EnumDifficulty.HARD && random.nextBoolean())) {
|
|
+ return;
|
|
+ }
|
|
+ } else if (chance == 0 || random.nextDouble() > chance) {
|
|
return;
|
|
}
|
|
+ // Purpur end
|
|
|
|
EntityVillager entityvillager = (EntityVillager) entityliving;
|
|
EntityZombieVillager entityzombievillager = (EntityZombieVillager) EntityTypes.ZOMBIE_VILLAGER.a(this.world);
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 4c4f404a30..e79b4df1a7 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -864,11 +864,13 @@ public class PurpurWorldConfig {
|
|
public boolean zombieRidableInWater = false;
|
|
public boolean zombieRequireShiftToMount = true;
|
|
public boolean zombieTargetTurtleEggs = true;
|
|
+ public double zombieVillagerTransformationChance = -0.1D;
|
|
private void zombieSettings() {
|
|
zombieRidable = getBoolean("mobs.zombie.ridable", zombieRidable);
|
|
zombieRidableInWater = getBoolean("mobs.zombie.ridable-in-water", zombieRidableInWater);
|
|
zombieRequireShiftToMount = getBoolean("mobs.zombie.require-shift-to-mount", zombieRequireShiftToMount);
|
|
zombieTargetTurtleEggs = getBoolean("mobs.zombie.target-turtle-eggs", zombieTargetTurtleEggs);
|
|
+ zombieVillagerTransformationChance = getDouble("mobs.zombie.transform-to-villager-chance", zombieVillagerTransformationChance);
|
|
}
|
|
|
|
public boolean zombieHorseCanSwim = false;
|
|
--
|
|
2.24.0
|
|
|