Files
Purpur/patches/server/0091-Add-vindicator-johnny-spawn-chance.patch
Ben Kerllenevich 90faff263b 6
2021-06-17 10:18:32 -04:00

48 lines
2.5 KiB
Diff

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 51082fb81477b96c778796e8daf288b366cecf22..a55ff1e98914e16a82804e85deb873b4f32fdb26 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;
@@ -128,6 +129,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 1654f18aa3d24e4cf9d60ae5f6a7ae2e0fc98fcb..3235a7f593a602a0b2a75f98bd4cf2a0718ae297 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -928,9 +928,11 @@ public class PurpurWorldConfig {
public boolean vindicatorRidable = false;
public boolean vindicatorRidableInWater = false;
+ public double vindicatorJohnnySpawnChance = 0D;
private void vindicatorSettings() {
vindicatorRidable = getBoolean("mobs.vindicator.ridable", vindicatorRidable);
vindicatorRidableInWater = getBoolean("mobs.vindicator.ridable-in-water", vindicatorRidableInWater);
+ vindicatorJohnnySpawnChance = getDouble("mobs.vindicator.johnny.spawn-chance", vindicatorJohnnySpawnChance);
}
public boolean wanderingTraderRidable = false;