2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-02-11 04:28:39 +00:00
|
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
|
|
Date: Sat, 8 Feb 2020 23:26:11 -0600
|
|
|
|
Subject: [PATCH] Entity Jump API
|
|
|
|
|
|
|
|
|
2021-03-16 07:19:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
|
|
index 61dc6cdd4e692319d2a82646b92bf625d1a3f87d..21952ce66729946fb306fd15e9da4a3311551bec 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
|
|
@@ -2875,8 +2875,10 @@ public abstract class EntityLiving extends Entity {
|
2020-11-03 02:22:15 +00:00
|
|
|
} else if (this.aQ() && (!this.onGround || d7 > d8)) {
|
2020-06-25 23:38:24 +00:00
|
|
|
this.c((Tag) TagsFluid.LAVA);
|
|
|
|
} else if ((this.onGround || flag && d7 <= d8) && this.jumpTicks == 0) {
|
2020-02-11 04:28:39 +00: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;
|
2021-03-16 07:19:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityPanda.java b/src/main/java/net/minecraft/world/entity/animal/EntityPanda.java
|
|
|
|
index f755607872920caae1410d38c431c16b5238c00f..711b322007a0973ff0aebf3c25efbae8fc7741d0 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/EntityPanda.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/EntityPanda.java
|
|
|
|
@@ -490,7 +490,9 @@ public class EntityPanda extends EntityAnimal {
|
2020-02-11 04:28:39 +00:00
|
|
|
EntityPanda entitypanda = (EntityPanda) iterator.next();
|
|
|
|
|
2020-08-25 02:22:08 +00:00
|
|
|
if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.fh()) {
|
2020-02-11 04:28:39 +00: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
|
2021-03-16 07:19:45 +00:00
|
|
|
index aa08ca83a105627b7e257ac664c29d899b557e9e..f0fb9954c9fc7ccf31e3c4bc633ce48c85ba49dd 100644
|
2020-02-11 04:28:39 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2020-09-19 11:29:53 +00:00
|
|
|
@@ -789,5 +789,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
2020-02-11 04:28:39 +00: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
|
|
|
|
}
|