mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: df0d7b0d Update upstream CB 6ea3c2cf [CI-SKIP] Rebuild patches d7bed4cb Heavily optimise random block ticking (#2914) b66d9ff8 Update upstream CB ba71c5d6 Stop stripping private use block Unicode from signs 28d9dcfc Entity Jump API (#1587) 9976a768 Fix PlayerNaturallySpawnCreaturesEvent boolean inversion 054e20da Clean up imports on ThrownEggHatchEvent a8984ccb Add ThrownEggHatchEvent (#1982) 9f24d495 Allow nerfed blazes, endermen to take water damage (#2847)
98 lines
2.8 KiB
Diff
98 lines
2.8 KiB
Diff
From 1a90d723b2773b3f90a56661c62366449bb90a41 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Fri, 18 Oct 2019 23:34:38 -0500
|
|
Subject: [PATCH] Add entity jump API
|
|
|
|
---
|
|
.../purpur/event/entity/EntityJumpEvent.java | 46 +++++++++++++++++++
|
|
.../java/org/bukkit/entity/LivingEntity.java | 21 +++++++++
|
|
2 files changed, 67 insertions(+)
|
|
create mode 100644 src/main/java/net/pl3x/purpur/event/entity/EntityJumpEvent.java
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/event/entity/EntityJumpEvent.java b/src/main/java/net/pl3x/purpur/event/entity/EntityJumpEvent.java
|
|
new file mode 100644
|
|
index 00000000..08546c01
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/pl3x/purpur/event/entity/EntityJumpEvent.java
|
|
@@ -0,0 +1,46 @@
|
|
+package net.pl3x.purpur.event.entity;
|
|
+
|
|
+import org.bukkit.entity.LivingEntity;
|
|
+import org.bukkit.event.Cancellable;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.entity.EntityEvent;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+/**
|
|
+ * Called when an entity jumps
|
|
+ * <p>
|
|
+ * Cancelling the event will stop the entity from jumping
|
|
+ */
|
|
+public class EntityJumpEvent extends EntityEvent implements Cancellable {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private boolean canceled;
|
|
+
|
|
+ public EntityJumpEvent(@NotNull LivingEntity entity) {
|
|
+ super(entity);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ @NotNull
|
|
+ public LivingEntity getEntity() {
|
|
+ return (LivingEntity) entity;
|
|
+ }
|
|
+
|
|
+ public boolean isCancelled() {
|
|
+ return canceled;
|
|
+ }
|
|
+
|
|
+ public void setCancelled(boolean cancel) {
|
|
+ canceled = cancel;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
index 2e1e27b0..cf9b6252 100644
|
|
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
@@ -716,5 +716,26 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
|
* @param safeFallDistance Safe fall distance
|
|
*/
|
|
void setSafeFallDistance(float safeFallDistance);
|
|
+
|
|
+ /**
|
|
+ * Get entity jump state
|
|
+ * <p>
|
|
+ * Jump state will be true when the entity has been marked to jump
|
|
+ *
|
|
+ * @return Jump state
|
|
+ */
|
|
+ boolean isJumping();
|
|
+
|
|
+ /**
|
|
+ * Set entity jump state
|
|
+ * <p>
|
|
+ * Setting to true will mark the entity to jump
|
|
+ * <p>
|
|
+ * Setting to false will unmark the entity from jumping, but
|
|
+ * will not stop a jump that has already started
|
|
+ *
|
|
+ * @param jumping Jump state
|
|
+ */
|
|
+ void setJumping(boolean jumping);
|
|
// Purpur end
|
|
}
|
|
--
|
|
2.24.0
|
|
|