mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
91 lines
4.4 KiB
Diff
91 lines
4.4 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 collar color
|
|
|
|
This allows for the server to set a default collar color when a wolf or cat is tamed.
|
|
Resets to RED when the value is invalid.
|
|
|
|
test
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
|
index e9a165b7bb66dd4ae1c1befc67c671f45ec8271b..7d1e22f3c6eb5462d07027b3a2890b07667ddc46 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
|
@@ -367,6 +367,14 @@ public class Cat extends TamableAnimal {
|
|
return Mth.lerp(tickDelta, this.relaxStateOneAmountO, this.relaxStateOneAmount);
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public void tame(Player player) {
|
|
+ setCollarColor(level.purpurConfig.catDefaultCollarColor);
|
|
+ super.tame(player);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
@Override
|
|
public Cat getBreedOffspring(ServerLevel world, AgeableMob entity) {
|
|
Cat entitycat = (Cat) EntityType.CAT.create(world);
|
|
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 38c69ddde8a54482a1de60387bace297869c47f3..20e0e74d7e43f436172ca7b4cb8b613ba116f9ec 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
|
@@ -193,6 +193,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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 84be9a82ae1f63b0d9a91cf24e3bdcd05882360b..6be11c27772a1111a45096ca32cecc30e02e9431 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -562,6 +562,7 @@ public class PurpurWorldConfig {
|
|
|
|
public boolean catRidable = false;
|
|
public boolean catRidableInWater = false;
|
|
+ public DyeColor catDefaultCollarColor = DyeColor.RED;
|
|
public double catMaxHealth = 10.0D;
|
|
public int catSpawnDelay = 1200;
|
|
public int catSpawnSwampHutScanRange = 16;
|
|
@@ -575,6 +576,11 @@ public class PurpurWorldConfig {
|
|
set("mobs.cat.attributes.max-health", null);
|
|
set("mobs.cat.attributes.max_health", oldValue);
|
|
}
|
|
+ try {
|
|
+ catDefaultCollarColor = DyeColor.valueOf(getString("mobs.cat.default-collar-color", wolfDefaultCollarColor.name()));
|
|
+ } catch (IllegalArgumentException ignore) {
|
|
+ catDefaultCollarColor = DyeColor.RED;
|
|
+ }
|
|
catMaxHealth = getDouble("mobs.cat.attributes.max_health", catMaxHealth);
|
|
catSpawnDelay = getInt("mobs.cat.spawn-delay", catSpawnDelay);
|
|
catSpawnSwampHutScanRange = getInt("mobs.cat.scan-range-for-other-cats.swamp-hut", catSpawnSwampHutScanRange);
|
|
@@ -1727,6 +1733,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;
|
|
@@ -1739,6 +1746,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);
|