2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-02-11 05:28:39 +01:00
|
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
|
|
Date: Sat, 8 Feb 2020 23:26:11 -0600
|
|
|
|
Subject: [PATCH] Entity Jump API
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 38f666bb115d7d29da8eac1f4848ba23ef29ba43..253e35826f6f51145c278b083d195599affca2a7 100644
|
2020-02-11 05:28:39 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
2020-04-27 09:34:45 +02:00
|
|
|
@@ -2608,8 +2608,10 @@ public abstract class EntityLiving extends Entity {
|
2020-02-11 05:28:39 +01:00
|
|
|
} else if (this.aH()) {
|
|
|
|
this.c(TagsFluid.LAVA);
|
|
|
|
} else if ((this.onGround || this.N > 0.0D && this.N <= 0.4D) && this.jumpTicks == 0) {
|
|
|
|
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
|
|
|
|
this.jump();
|
|
|
|
this.jumpTicks = 10;
|
|
|
|
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.jumpTicks = 0;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPanda.java b/src/main/java/net/minecraft/server/EntityPanda.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index cd41c80f19105633305be933ac20fc5548b1c5f7..f50ed19080257b9199bf1b8b846877a2ba1cafbb 100644
|
2020-02-11 05:28:39 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityPanda.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityPanda.java
|
|
|
|
@@ -438,7 +438,9 @@ public class EntityPanda extends EntityAnimal {
|
|
|
|
EntityPanda entitypanda = (EntityPanda) iterator.next();
|
|
|
|
|
|
|
|
if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.eL()) {
|
|
|
|
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
|
|
|
|
entitypanda.jump();
|
|
|
|
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 7d101d9630848b68b15acc5efdc16ae51dc1f132..245bd116d143af120127a9d25dcb7a0c43ad47a0 100644
|
2020-02-11 05:28:39 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2020-02-25 19:57:15 +01:00
|
|
|
@@ -723,5 +723,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
2020-02-11 05:28:39 +01:00
|
|
|
public boolean isHandRaised() {
|
|
|
|
return getHandle().isHandRaised();
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isJumping() {
|
|
|
|
+ return getHandle().jumping;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setJumping(boolean jumping) {
|
|
|
|
+ getHandle().setJumping(jumping);
|
|
|
|
+ if (jumping && getHandle() instanceof EntityInsentient) {
|
|
|
|
+ // this is needed to actually make a mob jump
|
|
|
|
+ ((EntityInsentient) getHandle()).getControllerJump().jump();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
// Paper end
|
|
|
|
}
|