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-09-11 01:47:58 +02:00
|
|
|
index 725c10f7bd8fab17044d3bbf4ac97d6a09a2dabe..65ca413d5887b63a5f563494113b487e0eca1dcc 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-09-11 01:47:58 +02:00
|
|
|
@@ -2764,8 +2764,10 @@ public abstract class EntityLiving extends Entity {
|
2020-08-25 04:22:08 +02:00
|
|
|
} else if (this.aP() && (!this.onGround || d7 > d8)) {
|
2020-06-26 01:38:24 +02:00
|
|
|
this.c((Tag) TagsFluid.LAVA);
|
|
|
|
} else if ((this.onGround || flag && d7 <= d8) && this.jumpTicks == 0) {
|
2020-02-11 05:28:39 +01:00
|
|
|
+ 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-08-25 04:22:08 +02:00
|
|
|
index ed8c0073f0c938c2ee8ed0dad2afda21a115b67d..01cc3d94d3fe1f82c94abdfcc92b0d3bc26f2fea 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
|
2020-06-26 01:38:24 +02:00
|
|
|
@@ -435,7 +435,9 @@ public class EntityPanda extends EntityAnimal {
|
2020-02-11 05:28:39 +01:00
|
|
|
EntityPanda entitypanda = (EntityPanda) iterator.next();
|
|
|
|
|
2020-08-25 04:22:08 +02:00
|
|
|
if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.fh()) {
|
2020-02-11 05:28:39 +01:00
|
|
|
+ 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-09-11 01:47:58 +02:00
|
|
|
index 2cbd983d517f8e7a8c4138859a4eba0d7e1685ee..e8f9d4845eadfa065981b9beb0165f431e89377d 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-09-02 11:12:25 +02:00
|
|
|
@@ -778,5 +778,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
|
|
|
|
}
|