Rabbit API (#8627)

This commit is contained in:
Owen 2022-12-09 19:56:13 -05:00 committed by GitHub
parent 5e6ac3c46e
commit ec772bb8b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 0 deletions

View file

@ -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

View file

@ -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 <nassim@njahnke.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
@ -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