From ec772bb8b8a185ffaea7db643f612211d43c9528 Mon Sep 17 00:00:00 2001 From: Owen <23108066+Owen1212055@users.noreply.github.com> Date: Fri, 9 Dec 2022 19:56:13 -0500 Subject: [PATCH] Rabbit API (#8627) --- .../0312-Missing-Entity-Behavior-API.patch | 28 +++++++++++++++++++ .../0651-Missing-Entity-Behavior-API.patch | 21 ++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/patches/api/0312-Missing-Entity-Behavior-API.patch b/patches/api/0312-Missing-Entity-Behavior-API.patch index 02b26f2ab3..f1d3912092 100644 --- a/patches/api/0312-Missing-Entity-Behavior-API.patch +++ b/patches/api/0312-Missing-Entity-Behavior-API.patch @@ -766,6 +766,34 @@ index 479f7a7c54c85cb685f56e60906650d1989c03ff..4e526ba6aa462a484984fb9f0512b8db + +} +// Paper end +diff --git a/src/main/java/org/bukkit/entity/Rabbit.java b/src/main/java/org/bukkit/entity/Rabbit.java +index e88154283a8ef594e160d25005870053de15568a..979062aa476e3bd75166458d8831894fba8778cd 100644 +--- a/src/main/java/org/bukkit/entity/Rabbit.java ++++ b/src/main/java/org/bukkit/entity/Rabbit.java +@@ -14,6 +14,23 @@ public interface Rabbit extends Animals { + * @param type Sets the type of rabbit for this entity. + */ + public void setRabbitType(@NotNull Type type); ++ // Paper start ++ /** ++ * Sets how many ticks this rabbit will wait ++ * until trying to find more carrots. ++ * ++ * @param ticks ticks ++ */ ++ void setMoreCarrotTicks(int ticks); ++ ++ /** ++ * Returns how many ticks this rabbit ++ * will wait until trying to find more carrots. ++ * ++ * @return ticks ++ */ ++ int getMoreCarrotTicks(); ++ // Paper end + + /** + * Represents the various types a Rabbit might be. diff --git a/src/main/java/org/bukkit/entity/Raider.java b/src/main/java/org/bukkit/entity/Raider.java index 987f9b0866b213450b4de1310600161c8587a545..144fdcfd1f35b6346b672006905aedb8a3773018 100644 --- a/src/main/java/org/bukkit/entity/Raider.java diff --git a/patches/server/0651-Missing-Entity-Behavior-API.patch b/patches/server/0651-Missing-Entity-Behavior-API.patch index 40674dc285..ca7f444c0e 100644 --- a/patches/server/0651-Missing-Entity-Behavior-API.patch +++ b/patches/server/0651-Missing-Entity-Behavior-API.patch @@ -28,6 +28,7 @@ public net.minecraft.world.entity.monster.Phantom anchorPoint public net.minecraft.world.entity.npc.WanderingTrader getWanderTarget()Lnet/minecraft/core/BlockPos; public net.minecraft.world.entity.animal.AbstractSchoolingFish leader public net.minecraft.world.entity.animal.AbstractSchoolingFish schoolSize +public net.minecraft.world.entity.animal.Rabbit moreCarrotTicks Co-authored-by: Nassim Jahnke Co-authored-by: Jake Potrebic @@ -908,6 +909,26 @@ index da1488c9cae53bd554727c850da2192adda2478a..30a0eac179c86b0fe94a2a40b5bfcd3e + public void setStanding(boolean standing) { + this.getHandle().setStanding(standing); + } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java +index 3bdcc754a5afb6506178bd5c0d4f9c6e02bc24da..3cb4860fea30bfaf2147b4f29a34336b6e417d6c 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java +@@ -48,4 +48,15 @@ public class CraftRabbit extends CraftAnimals implements Rabbit { + + entity.setVariant(net.minecraft.world.entity.animal.Rabbit.Variant.values()[type.ordinal()]); + } ++ // Paper start ++ @Override ++ public void setMoreCarrotTicks(int ticks) { ++ this.getHandle().moreCarrotTicks = ticks; ++ } ++ ++ @Override ++ public int getMoreCarrotTicks() { ++ return this.getHandle().moreCarrotTicks; ++ } + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java