From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 24 Jul 2020 19:38:21 -0500
Subject: [PATCH] Add vindicator johnny spawn chance


diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
index 76e6ea34db3942e9dd7646ad7ca1259f4387a4d8..9096c40ad5784d9097e889f0f43b6cf1f60c0692 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
@@ -7,6 +7,7 @@ import java.util.function.Predicate;
 import javax.annotation.Nullable;
 import net.minecraft.nbt.CompoundTag;
 import net.minecraft.network.chat.Component;
+import net.minecraft.network.chat.TranslatableComponent;
 import net.minecraft.server.level.ServerLevel;
 import net.minecraft.sounds.SoundEvent;
 import net.minecraft.sounds.SoundEvents;
@@ -147,6 +148,12 @@ public class Vindicator extends AbstractIllager {
         ((GroundPathNavigation)this.getNavigation()).setCanOpenDoors(true);
         this.populateDefaultEquipmentSlots(difficulty);
         this.populateDefaultEquipmentEnchantments(difficulty);
+        // Purpur start
+        Level level = world.getMinecraftWorld();
+        if (level.purpurConfig.vindicatorJohnnySpawnChance > 0D && random.nextDouble() <= level.purpurConfig.vindicatorJohnnySpawnChance) {
+            setCustomName(new TranslatableComponent("Johnny"));
+        }
+        // Purpur end
         return spawnGroupData;
     }
 
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index e56f0fca2faec53cc52a07878d4fbe9cff79b7c9..ba43bed5bc2750f466243d2bf423d4caa053a85e 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -1446,6 +1446,7 @@ public class PurpurWorldConfig {
     public boolean vindicatorRidable = false;
     public boolean vindicatorRidableInWater = false;
     public double vindicatorMaxHealth = 24.0D;
+    public double vindicatorJohnnySpawnChance = 0D;
     private void vindicatorSettings() {
         vindicatorRidable = getBoolean("mobs.vindicator.ridable", vindicatorRidable);
         vindicatorRidableInWater = getBoolean("mobs.vindicator.ridable-in-water", vindicatorRidableInWater);
@@ -1455,6 +1456,7 @@ public class PurpurWorldConfig {
             set("mobs.vindicator.attributes.max_health", oldValue);
         }
         vindicatorMaxHealth = getDouble("mobs.vindicator.attributes.max_health", vindicatorMaxHealth);
+        vindicatorJohnnySpawnChance = getDouble("mobs.vindicator.johnny.spawn-chance", vindicatorJohnnySpawnChance);
     }
 
     public boolean wanderingTraderRidable = false;
