mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-30 19:40:37 +01:00
Add missing Piglin Dancing API (#8894)
This commit is contained in:
parent
abbdae4f53
commit
8eea7a4d45
2 changed files with 46 additions and 0 deletions
patches
|
@ -8,6 +8,7 @@ Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|||
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
|
||||
Co-authored-by: booky10 <boooky10@gmail.com>
|
||||
Co-authored-by: Amin <amin.haddou@frg.wwschool.de>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -762,6 +763,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @return is charging
|
||||
+ */
|
||||
+ boolean isChargingCrossbow();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the Piglin is dancing or not
|
||||
+ *
|
||||
+ * @param dancing is dancing
|
||||
+ */
|
||||
+ void setDancing(boolean dancing);
|
||||
+
|
||||
+ /**
|
||||
+ * Causes the piglin to dance for a
|
||||
+ * specified amount of time
|
||||
+ *
|
||||
+ * @param duration duration of the dance in ticks
|
||||
+ */
|
||||
+ void setDancing(long duration);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if the piglin is currently dancing
|
||||
+ *
|
||||
+ * @return is dancing
|
||||
+ */
|
||||
+ boolean isDancing();
|
||||
+ // Paper end
|
||||
+
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|||
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
|
||||
Co-authored-by: booky10 <boooky10@gmail.com>
|
||||
Co-authored-by: Amin <amin.haddou@frg.wwschool.de>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -941,6 +942,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ public boolean isChargingCrossbow() {
|
||||
+ return this.getHandle().isChargingCrossbow();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setDancing(boolean dancing) {
|
||||
+ if (dancing) {
|
||||
+ this.getHandle().getBrain().setMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.DANCING, true);
|
||||
+ this.getHandle().getBrain().setMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.CELEBRATE_LOCATION, this.getHandle().getOnPos());
|
||||
+ } else {
|
||||
+ this.getHandle().getBrain().eraseMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.DANCING);
|
||||
+ this.getHandle().getBrain().eraseMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.CELEBRATE_LOCATION);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setDancing(long duration) {
|
||||
+ this.getHandle().getBrain().setMemoryWithExpiry(net.minecraft.world.entity.ai.memory.MemoryModuleType.DANCING, true, duration);
|
||||
+ this.getHandle().getBrain().setMemoryWithExpiry(net.minecraft.world.entity.ai.memory.MemoryModuleType.CELEBRATE_LOCATION, this.getHandle().getOnPos(), duration);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isDancing() {
|
||||
+ return this.getHandle().isDancing();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java
|
||||
|
|
Loading…
Add table
Reference in a new issue