Expand Panda API (#7061)

This commit is contained in:
Owen1212055 2022-01-17 18:23:44 -05:00
parent 48f228173e
commit affb89f9a2
3 changed files with 201 additions and 0 deletions

View File

@ -221,6 +221,8 @@ public net.minecraft.world.entity.animal.Fox isDefending()Z
public net.minecraft.world.entity.animal.Fox setDefending(Z)V public net.minecraft.world.entity.animal.Fox setDefending(Z)V
public net.minecraft.world.entity.animal.Fox isFaceplanted()Z public net.minecraft.world.entity.animal.Fox isFaceplanted()Z
public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V
public net.minecraft.world.entity.animal.Panda getEatCounter()I
public net.minecraft.world.entity.animal.Panda setEatCounter(I)V
# Cook speed multipler API # Cook speed multipler API
public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity recipeType public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity recipeType

View File

@ -175,3 +175,120 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public boolean isFaceplanted(); + public boolean isFaceplanted();
+ // Paper end - Add more fox behavior API + // Paper end - Add more fox behavior API
} }
diff --git a/src/main/java/org/bukkit/entity/Panda.java b/src/main/java/org/bukkit/entity/Panda.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Panda.java
+++ b/src/main/java/org/bukkit/entity/Panda.java
@@ -0,0 +0,0 @@ public interface Panda extends Animals {
return recessive;
}
}
+
+ // Paper start - Panda API
+ /**
+ * Sets the sneeze progress in this animation.
+ * This value counts up only if {@link Panda#isSneezing()} is true
+ *
+ * @param ticks sneeze progress
+ */
+ void setSneezeTicks(int ticks);
+
+ /**
+ * Gets the current sneeze progress, or how many ticks this panda will sneeze for.
+ *
+ * @return sneeze progress
+ */
+ int getSneezeTicks();
+
+ /**
+ * Sets if the panda is sneezing, which causes the sneeze counter to count.
+ * <p>
+ * When false, this will automatically set the sneeze ticks to 0.
+ *
+ * @param sneeze if the panda is sneezing or not
+ */
+ void setSneezing(boolean sneeze);
+
+ /**
+ * Gets if the panda is sneezing
+ *
+ * @return is sneezing
+ */
+ boolean isSneezing();
+
+ /**
+ * Sets the eating ticks for this panda.
+ * <p>
+ *
+ * This starts counting up as long as it is greater than 0.
+ *
+ * @param ticks eating ticks
+ */
+ void setEatingTicks(int ticks);
+
+ /**
+ * Gets the current eating progress, or how many ticks this panda has been eating for.
+ *
+ * @return eating progress
+ */
+ int getEatingTicks();
+
+ /**
+ * Sets the number of ticks this panda will be unhappy for.
+ * <p>
+ * This value counts down.
+ *
+ * @param ticks unhappy ticks
+ */
+ void setUnhappyTicks(int ticks);
+
+ /**
+ * Gets how many ticks this panda will be unhappy for.
+ *
+ * @return unhappy ticks
+ */
+ int getUnhappyTicks();
+
+ /**
+ * Sets if this panda is currently rolling.
+ *
+ * @param rolling should roll
+ */
+ void setRolling(boolean rolling);
+
+ /**
+ * Gets if this panda is currently rolling on the ground.
+ *
+ * @return is rolling
+ */
+ boolean isRolling();
+
+ /**
+ * Sets if this panda is currently on its back.
+ *
+ * @param onBack is on its back
+ */
+ void setIsOnBack(boolean onBack);
+
+ /**
+ * Gets if this panda is currently on its back.
+ *
+ * @return is on back
+ */
+ boolean isOnBack();
+
+ /**
+ * Sets if this panda is currently sitting.
+ *
+ * @param sitting is currently sitting
+ */
+ void setIsSitting(boolean sitting);
+
+ /**
+ * Gets if this panda is sitting.
+ *
+ * @return is sitting
+ */
+ boolean isSitting();
+ // Paper end - Panda API
}

View File

@ -156,3 +156,85 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end - Add more fox behavior API + // Paper end - Add more fox behavior API
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
@@ -0,0 +0,0 @@ public class CraftPanda extends CraftAnimals implements Panda {
public void setHiddenGene(Gene gene) {
this.getHandle().setHiddenGene(CraftPanda.toNms(gene));
}
+ // Paper start - Panda API
+ @Override
+ public void setSneezeTicks(int ticks) {
+ this.getHandle().setSneezeCounter(ticks);
+ }
+
+ @Override
+ public int getSneezeTicks() {
+ return this.getHandle().getSneezeCounter();
+ }
+
+ @Override
+ public void setSneezing(boolean sneeze) {
+ this.getHandle().sneeze(sneeze);
+ }
+
+ @Override
+ public boolean isSneezing() {
+ return this.getHandle().isSneezing();
+ }
+
+ @Override
+ public void setEatingTicks(int ticks) {
+ this.getHandle().setEatCounter(ticks);
+ }
+
+ @Override
+ public int getEatingTicks() {
+ return this.getHandle().getEatCounter();
+ }
+
+ @Override
+ public void setUnhappyTicks(int ticks) {
+ this.getHandle().setUnhappyCounter(ticks);
+ }
+
+ @Override
+ public int getUnhappyTicks() {
+ return this.getHandle().getUnhappyCounter();
+ }
+
+ @Override
+ public boolean isRolling() {
+ return this.getHandle().isRolling();
+ }
+
+ @Override
+ public void setRolling(boolean rolling) {
+ this.getHandle().roll(rolling);
+ }
+
+ @Override
+ public boolean isOnBack() {
+ return this.getHandle().isOnBack();
+ }
+
+ @Override
+ public void setIsOnBack(boolean onBack) {
+ this.getHandle().setOnBack(onBack);
+ }
+
+ @Override
+ public boolean isSitting() {
+ return this.getHandle().isSitting();
+ }
+
+ @Override
+ public void setIsSitting(boolean sitting) {
+ this.getHandle().sit(sitting);
+ }
+ // Paper end - Panda API
public static Gene fromNms(net.minecraft.world.entity.animal.Panda.Gene gene) {
Preconditions.checkArgument(gene != null, "Gene may not be null");