mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 09:27:43 +01:00
Fix bug in zombie villager transformation chance
This commit is contained in:
@@ -1,30 +1,37 @@
|
||||
From 7317f20bd412f8e45c0d9f35fcba233256eb9f0f Mon Sep 17 00:00:00 2001
|
||||
From 297b5a86fd2d964a64433f78e7600443dd69f0a8 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 | 6 +-----
|
||||
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 2 ++
|
||||
2 files changed, 3 insertions(+), 5 deletions(-)
|
||||
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..fc4e51ef45 100644
|
||||
index 1e60cc399b..8938dc50fe 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
@@ -474,11 +474,7 @@ public class EntityZombie extends EntityMonster {
|
||||
@@ -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()) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
+ if (entityliving instanceof EntityVillager && world.purpurConfig.zombieVillagerTransformationChance < 0 ? (world.getDifficulty() == EnumDifficulty.NORMAL ? random.nextBoolean() : world.getDifficulty() == EnumDifficulty.HARD) : world.purpurConfig.zombieVillagerTransformationChance != 0 && !(random.nextDouble() > world.purpurConfig.zombieVillagerTransformationChance)) { // Purpur
|
||||
+ // 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
|
||||
|
||||
Reference in New Issue
Block a user