mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
50 lines
2.5 KiB
Diff
50 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Encode42 <me@encode42.dev>
|
|
Date: Thu, 10 Dec 2020 13:43:28 -0500
|
|
Subject: [PATCH] Configurable default wolf collar color
|
|
|
|
This allows for the server to set a default collar color when a wolf is tamed.
|
|
Resets to RED when the value is invalid.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
|
index 3e7409ebf1f94b9cf55f2d0b0fe17ca8ec44659f..518dd0e6b4889c049e438b393baa795a5eac3e7d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
|
@@ -188,6 +188,12 @@ public class Wolf extends TamableAnimal implements NeutralMob {
|
|
this.updatePathfinders(false);
|
|
return super.finalizeSpawn(world, difficulty, type, data, nbt);
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public void tame(Player player) {
|
|
+ setCollarColor(level.purpurConfig.wolfDefaultCollarColor);
|
|
+ super.tame(player);
|
|
+ }
|
|
// Purpur end
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 3cdd0cb69b1299c0a94ee7117c5bf182cf717251..53b851ed720637b2556ff9de3131a38b21b9c21a 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -1766,6 +1766,7 @@ public class PurpurWorldConfig {
|
|
public boolean wolfRidable = false;
|
|
public boolean wolfRidableInWater = false;
|
|
public double wolfMaxHealth = 8.0D;
|
|
+ public DyeColor wolfDefaultCollarColor = DyeColor.RED;
|
|
public boolean wolfMilkCuresRabies = true;
|
|
public double wolfNaturalRabid = 0.0D;
|
|
public int wolfBreedingTicks = 6000;
|
|
@@ -1778,6 +1779,11 @@ public class PurpurWorldConfig {
|
|
set("mobs.wolf.attributes.max_health", oldValue);
|
|
}
|
|
wolfMaxHealth = getDouble("mobs.wolf.attributes.max_health", wolfMaxHealth);
|
|
+ try {
|
|
+ wolfDefaultCollarColor = DyeColor.valueOf(getString("mobs.wolf.default-collar-color", wolfDefaultCollarColor.name()));
|
|
+ } catch (IllegalArgumentException ignore) {
|
|
+ wolfDefaultCollarColor = DyeColor.RED;
|
|
+ }
|
|
wolfMilkCuresRabies = getBoolean("mobs.wolf.milk-cures-rabid-wolves", wolfMilkCuresRabies);
|
|
wolfNaturalRabid = getDouble("mobs.wolf.spawn-rabid-chance", wolfNaturalRabid);
|
|
wolfBreedingTicks = getInt("mobs.wolf.breeding-delay-ticks", wolfBreedingTicks);
|