Files
Purpur/patches/server/0030-Rabbit-naturally-spawn-toast-and-killer.patch
BillyGalbreath 1d3f710297 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
840e72091 [CI-SKIP] [Auto] Rebuild Patches
a33232d4a Add beacon activation and deactivation events (#5121)
bc7ea673a Add internal channel initialization listeners (#5557)
b28ad17ac Check for world change in MoveEvent API methods
3095c7592 [Auto] Updated Upstream (CraftBukkit)
f56989c97 Add RespawnFlags to PlayerRespawnEvent (#5533)
7579c2667 Add more API to PlayerMoveEvent (#5553)
2021-04-30 16:18:11 -05:00

57 lines
2.6 KiB
Diff

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/EntityRabbit.java b/src/main/java/net/minecraft/world/entity/animal/EntityRabbit.java
index dcbb07fb6ab799d4526a2da0614c193c7abba715..180fc927074dc683ad4d482a00dd4e04ff7923d0 100644
--- a/src/main/java/net/minecraft/world/entity/animal/EntityRabbit.java
+++ b/src/main/java/net/minecraft/world/entity/animal/EntityRabbit.java
@@ -352,6 +352,10 @@ public class EntityRabbit extends EntityAnimal {
if (!this.hasCustomName()) {
this.setCustomName(new ChatMessage(SystemUtils.a("entity", EntityRabbit.bp)));
}
+ // Purpur start
+ } else if (i == 98) {
+ setCustomName(new ChatMessage("Toast"));
+ // Purpur end
}
this.datawatcher.set(EntityRabbit.bo, i);
@@ -373,6 +377,16 @@ public class EntityRabbit extends EntityAnimal {
}
private int a(GeneratorAccess generatoraccess) {
+ // Purpur start
+ World world = generatoraccess.getMinecraftWorld();
+ if (world.purpurConfig.rabbitNaturalKiller > 0D && random.nextDouble() <= world.purpurConfig.rabbitNaturalKiller) {
+ return 99;
+ }
+ if (world.purpurConfig.rabbitNaturalToast > 0D && random.nextDouble() <= world.purpurConfig.rabbitNaturalToast) {
+ return 98;
+ }
+ // Purpur end
+
BiomeBase biomebase = generatoraccess.getBiome(this.getChunkCoordinates());
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 638ee71a78d9e75de6ddd7f0aec67a023bb8c06a..6dcfbebd850d71587da5a78a3acf09d8ae413072 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -154,6 +154,13 @@ public class PurpurWorldConfig {
illusionerMaxHealth = getDouble("mobs.illusioner.attributes.max-health", illusionerMaxHealth);
}
+ public double rabbitNaturalToast = 0.0D;
+ public double rabbitNaturalKiller = 0.0D;
+ private void rabbitSettings() {
+ rabbitNaturalToast = getDouble("mobs.rabbit.spawn-toast-chance", rabbitNaturalToast);
+ rabbitNaturalKiller = getDouble("mobs.rabbit.spawn-killer-rabbit-chance", rabbitNaturalKiller);
+ }
+
public int villagerBrainTicks = 1;
public boolean villagerUseBrainTicksOnlyWhenLagging = true;
private void villagerSettings() {