2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
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/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2022-10-02 09:56:36 +02:00
|
|
|
index 345b2d91cd7ac1746fb70bf28b596cce6746a693..24a16dbfc0852a566dd527639974fcba44bd43fe 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2022-10-02 09:56:36 +02:00
|
|
|
@@ -3243,8 +3243,10 @@ public abstract class LivingEntity extends Entity {
|
2021-06-11 14:02:28 +02:00
|
|
|
} else if (this.isInLava() && (!this.onGround || d7 > d8)) {
|
2021-11-24 10:01:27 +01:00
|
|
|
this.jumpInLiquid(FluidTags.LAVA);
|
2021-06-11 14:02:28 +02:00
|
|
|
} else if ((this.onGround || flag && d7 <= d8) && this.noJumpDelay == 0) {
|
|
|
|
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
|
|
|
|
this.jumpFromGround();
|
|
|
|
this.noJumpDelay = 10;
|
|
|
|
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.noJumpDelay = 0;
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
2022-06-08 06:06:41 +02:00
|
|
|
index dbcf70dacf99b61c0147b43edd6a374b31809733..9c07e3f5554b3b9cf2a2c4d9239a72342567d7f1 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
2021-11-24 10:01:27 +01:00
|
|
|
@@ -515,7 +515,9 @@ public class Panda extends Animal {
|
2021-06-11 14:02:28 +02:00
|
|
|
Panda entitypanda = (Panda) iterator.next();
|
|
|
|
|
|
|
|
if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.canPerformAction()) {
|
|
|
|
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
|
|
|
|
entitypanda.jumpFromGround();
|
|
|
|
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 18:17:42 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
|
2022-11-03 22:03:31 +01:00
|
|
|
index 8517fd004727b083545082a5de26b11cb2a93623..23cd2e1faf0d7b59885e194fc0f0adc558e4921b 100644
|
2022-07-20 18:17:42 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
|
|
|
|
@@ -177,7 +177,9 @@ public class Ravager extends Raider {
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!flag && this.onGround) {
|
|
|
|
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
|
|
|
|
this.jumpFromGround();
|
|
|
|
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2022-11-03 22:03:31 +01:00
|
|
|
index bfa6b088f87117015791dc4ab25d8e8cf4c4cf28..efaf058e6d56f6aed29541e77da46fef058c496a 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2022-09-12 13:31:45 +02:00
|
|
|
@@ -870,5 +870,19 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
2021-06-11 14:02:28 +02:00
|
|
|
public org.bukkit.inventory.EquipmentSlot getHandRaised() {
|
|
|
|
return getHandle().getUsedItemHand() == net.minecraft.world.InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isJumping() {
|
|
|
|
+ return getHandle().jumping;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setJumping(boolean jumping) {
|
|
|
|
+ getHandle().setJumping(jumping);
|
|
|
|
+ if (jumping && getHandle() instanceof Mob) {
|
|
|
|
+ // this is needed to actually make a mob jump
|
|
|
|
+ ((Mob) getHandle()).getJumpControl().jump();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|