From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 31 Aug 2019 17:47:11 -0500
Subject: [PATCH] Rabbit naturally spawn toast and killer


diff --git a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
index 587feda351efae19407cb9f23c6c1d42d5ed0cc9..e0ba1ef404c9f8ba1eae563b733d10d94b1442e4 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
@@ -426,7 +426,11 @@ public class Rabbit extends Animal {
             if (!this.hasCustomName()) {
                 this.setCustomName(new TranslatableComponent(Util.makeDescriptionId("entity", Rabbit.KILLER_BUNNY)));
             }
+        // Purpur start
+        } else if (rabbitType == 98) {
+            setCustomName(new TranslatableComponent("Toast"));
         }
+        // Purpur end
 
         this.entityData.set(Rabbit.DATA_TYPE_ID, rabbitType);
     }
@@ -447,6 +451,16 @@ public class Rabbit extends Animal {
     }
 
     private int getRandomRabbitType(LevelAccessor world) {
+        // Purpur start
+        Level level = world.getMinecraftWorld();
+        if (level.purpurConfig.rabbitNaturalKiller > 0D && random.nextDouble() <= level.purpurConfig.rabbitNaturalKiller) {
+            return 99;
+        }
+        if (level.purpurConfig.rabbitNaturalToast > 0D && random.nextDouble() <= level.purpurConfig.rabbitNaturalToast) {
+            return 98;
+        }
+        // Purpur end
+
         Biome biomebase = world.getBiome(this.blockPosition());
         int i = this.random.nextInt(100);
 
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 9010b44f1625ad6dd2a26aec8690297d97e86535..6d5857703c17d3ce0ab068ac68ece962ed832d48 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -831,6 +831,8 @@ public class PurpurWorldConfig {
     public boolean rabbitRidable = false;
     public boolean rabbitRidableInWater = false;
     public double rabbitMaxHealth = 3.0D;
+    public double rabbitNaturalToast = 0.0D;
+    public double rabbitNaturalKiller = 0.0D;
     private void rabbitSettings() {
         rabbitRidable = getBoolean("mobs.rabbit.ridable", rabbitRidable);
         rabbitRidableInWater = getBoolean("mobs.rabbit.ridable-in-water", rabbitRidableInWater);
@@ -840,6 +842,8 @@ public class PurpurWorldConfig {
             set("mobs.rabbit.attributes.max_health", oldValue);
         }
         rabbitMaxHealth = getDouble("mobs.rabbit.attributes.max_health", rabbitMaxHealth);
+        rabbitNaturalToast = getDouble("mobs.rabbit.spawn-toast-chance", rabbitNaturalToast);
+        rabbitNaturalKiller = getDouble("mobs.rabbit.spawn-killer-rabbit-chance", rabbitNaturalKiller);
     }
 
     public boolean ravagerRidable = false;
