Camel EntityToggleSitEvent (#8970)

This commit is contained in:
Owen 2023-03-15 10:37:41 -04:00 committed by GitHub
parent 73cf1257ca
commit eb0232ef09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,3 +68,33 @@ index 0a18108fda778af5b600f77533770bd98584d60e..9c1e02c3a990cd0f8bba1c84c170b438
this.setFlag(8, sitting);
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
index 37882a393d7c17a9437145ab5fe1f74370681146..05c7680569346bb863b896bcc9515f3e7cfb8114 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -586,7 +586,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider
}
public void sitDown() {
- if (!this.isCamelSitting()) {
+ if (!this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), true).callEvent()) { // Paper
this.playSound(SoundEvents.CAMEL_SIT, 1.0F, 1.0F);
this.setPose(Pose.SITTING);
this.resetLastPoseChangeTick(-this.level.getGameTime());
@@ -594,7 +594,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider
}
public void standUp() {
- if (this.isCamelSitting()) {
+ if (this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) { // Paper
this.playSound(SoundEvents.CAMEL_STAND, 1.0F, 1.0F);
this.setPose(Pose.STANDING);
this.resetLastPoseChangeTick(this.level.getGameTime());
@@ -602,6 +602,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider
}
public void standUpPanic() {
+ if (this.isCamelSitting() && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) return; // Paper
this.setPose(Pose.STANDING);
this.resetLastPoseChangeTickToFullStand(this.level.getGameTime());
}