Rabbit API (#8627)

This commit is contained in:
Owen1212055 2022-12-09 19:56:13 -05:00
parent ad6b5121b7
commit e383b8e15d
2 changed files with 49 additions and 0 deletions

View file

@ -766,6 +766,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+}
+// Paper end
diff --git a/src/main/java/org/bukkit/entity/Rabbit.java b/src/main/java/org/bukkit/entity/Rabbit.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Rabbit.java
+++ b/src/main/java/org/bukkit/entity/Rabbit.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
@@ -0,0 +0,0 @@ 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