-
-
Notifications
You must be signed in to change notification settings - Fork 479
Expand file tree
/
Copy path0031-Rabbit-naturally-spawn-toast-and-killer.patch
More file actions
61 lines (55 loc) · 2.97 KB
/
Copy path0031-Rabbit-naturally-spawn-toast-and-killer.patch
File metadata and controls
61 lines (55 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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 eaf040f10e33fdfb57391b6e7bc6901c87270853..47dc84052f1fb0017ff2e608c3f6d8b92c960cc6 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
@@ -436,7 +436,11 @@ public class Rabbit extends Animal {
if (!this.hasCustomName()) {
this.setCustomName(Component.translatable(Util.makeDescriptionId("entity", Rabbit.KILLER_BUNNY)));
}
+ // Purpur start
+ } else if (rabbitType == 98) {
+ setCustomName(Component.translatable("Toast"));
}
+ // Purpur end
this.entityData.set(Rabbit.DATA_TYPE_ID, rabbitType);
}
@@ -457,6 +461,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
+
Holder<Biome> holder = world.getBiome(this.blockPosition());
int i = world.getRandom().nextInt(100);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index c452a21f82d0b873eea4ec9ce80040e0e5f77fd8..c092ef4a028d7dc335077b6b741bd1991cb3e7ba 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -969,6 +969,8 @@ public class PurpurWorldConfig {
public boolean rabbitRidableInWater = false;
public boolean rabbitControllable = true;
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);
@@ -979,6 +981,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;