From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath 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/EntityVindicator.java b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java index f0eda0b83bab8e3a8adbb569b5997402b0e08e9a..fe84d6d2b74b6ae00c4c66682107296a40b69adc 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java +++ b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java @@ -6,6 +6,7 @@ import java.util.Map; import java.util.function.Predicate; import javax.annotation.Nullable; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.chat.ChatMessage; import net.minecraft.network.chat.IChatBaseComponent; import net.minecraft.server.level.WorldServer; import net.minecraft.sounds.SoundEffect; @@ -122,6 +123,12 @@ public class EntityVindicator extends EntityIllagerAbstract { ((Navigation) this.getNavigation()).a(true); this.a(difficultydamagescaler); this.b(difficultydamagescaler); + // Purpur start + World world = worldaccess.getMinecraftWorld(); + if (world.purpurConfig.vindicatorJohnnySpawnChance > 0D && random.nextDouble() <= world.purpurConfig.vindicatorJohnnySpawnChance) { + setCustomName(new ChatMessage("Johnny")); + } + // Purpur end return groupdataentity1; } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java index 1ddd2ca349e303c75e0bb9b848c25f92383e84b5..55d7c48f0dd03c690b0d0b1fee4f3a5306de8d1d 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -40,6 +40,11 @@ public class PurpurWorldConfig { } } + public double vindicatorJohnnySpawnChance = 0D; + private void vindicatorSettings() { + vindicatorJohnnySpawnChance = getDouble("mobs.vindicator.johnny.spawn-chance", vindicatorJohnnySpawnChance); + } + private ConfigurationSection getConfigurationSection(String path) { ConfigurationSection section = PurpurConfig.config.getConfigurationSection("world-settings." + worldName + "." + path); return section != null ? section : PurpurConfig.config.getConfigurationSection("world-settings.default." + path);