From 2cb25ce2865889c312b78b1e085042702735e7c1 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Sat, 31 Aug 2019 17:47:21 -0500 Subject: [PATCH] Add option to spawn Toast --- docs/source/configuration.rst | 3 ++ .../0063-Add-option-to-spawn-Toast.patch | 49 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 patches/server/0063-Add-option-to-spawn-Toast.patch diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 892723b24..cc9400eca 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -192,6 +192,9 @@ mobs * spawn-killer-rabbit-chance - **default**: 0.0 - **description**: Percent chance (0.0-1.0) the killer rabbit naturally spawns + * spawn-toast-chance + - **default**: 0.0 + - **description**: Percent chance (0.0-1.0) to naturally spawn a rabbit named Toast * snow_golem * drops-pumpkin-when-sheared diff --git a/patches/server/0063-Add-option-to-spawn-Toast.patch b/patches/server/0063-Add-option-to-spawn-Toast.patch new file mode 100644 index 000000000..d05428bf3 --- /dev/null +++ b/patches/server/0063-Add-option-to-spawn-Toast.patch @@ -0,0 +1,49 @@ +From 3d926e3819ad692f7dfebbcc0cfb9e1350ecc803 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sat, 31 Aug 2019 17:47:11 -0500 +Subject: [PATCH] Add option to spawn Toast + +--- + src/main/java/net/minecraft/server/EntityRabbit.java | 3 ++- + src/main/java/net/pl3x/purpur/PurpurConfig.java | 2 ++ + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/main/java/net/minecraft/server/EntityRabbit.java b/src/main/java/net/minecraft/server/EntityRabbit.java +index 498c453d7..41d8d1ccb 100644 +--- a/src/main/java/net/minecraft/server/EntityRabbit.java ++++ b/src/main/java/net/minecraft/server/EntityRabbit.java +@@ -300,7 +300,7 @@ public class EntityRabbit extends EntityAnimal { + if (!this.hasCustomName()) { + this.setCustomName(new ChatMessage(SystemUtils.a("entity", EntityRabbit.bA), new Object[0])); + } +- } ++ } else if (i == 98) setCustomName(new ChatMessage("Toast")); // Purpur + + this.datawatcher.set(EntityRabbit.bz, i); + } +@@ -329,6 +329,7 @@ public class EntityRabbit extends EntityAnimal { + + private int a(GeneratorAccess generatoraccess) { + if (net.pl3x.purpur.PurpurConfig.killerRabbitChance > 0D && net.pl3x.purpur.PurpurConfig.killerRabbitChance > random.nextDouble()) return 99; // Purpur ++ if (net.pl3x.purpur.PurpurConfig.toastRabbitChance > 0D && net.pl3x.purpur.PurpurConfig.toastRabbitChance > random.nextDouble()) return 98; // Purpur + + BiomeBase biomebase = generatoraccess.getBiome(new BlockPosition(this)); + int i = this.random.nextInt(100); +diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java +index 48a8907db..357de5178 100644 +--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java ++++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java +@@ -253,8 +253,10 @@ public class PurpurConfig { + } + + public static double killerRabbitChance = 0.0D; ++ public static double toastRabbitChance = 0.0D; + private static void rabbitSettings() { + killerRabbitChance = getDouble("settings.mobs.rabbit.spawn-killer-rabbit-chance", killerRabbitChance); ++ toastRabbitChance = getDouble("settings.mobs.rabbit.spawn-toast-chance", toastRabbitChance); + } + + public static boolean snowmanDropsPumpkin = false; +-- +2.23.0.rc1 +