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
|
|
|
|
|
2024-01-23 18:01:39 +01:00
|
|
|
== AT ==
|
|
|
|
public net.minecraft.world.entity.LivingEntity jumping
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2024-11-04 18:42:38 +01:00
|
|
|
index ba78e8b73793292830f3260f9a12c50c698bb881..a874913997c80c8f47f395e2ef4bb959aaa3e76d 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
|
2024-11-04 18:42:38 +01:00
|
|
|
@@ -3538,8 +3538,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
2023-09-22 04:31:59 +02:00
|
|
|
} else if (this.isInLava() && (!this.onGround() || d3 > d4)) {
|
2021-11-24 10:01:27 +01:00
|
|
|
this.jumpInLiquid(FluidTags.LAVA);
|
2023-09-22 04:31:59 +02:00
|
|
|
} else if ((this.onGround() || flag && d3 <= d4) && this.noJumpDelay == 0) {
|
2024-01-21 12:53:04 +01:00
|
|
|
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper - Entity Jump API
|
2021-06-11 14:02:28 +02:00
|
|
|
this.jumpFromGround();
|
|
|
|
this.noJumpDelay = 10;
|
2024-01-21 12:53:04 +01:00
|
|
|
+ } else { this.setJumping(false); } // Paper - Entity Jump API; setJumping(false) stops a potential loop
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
} 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
|
2024-10-23 15:54:09 +02:00
|
|
|
index 0b0887b7d2c69138617bee6ec3145f0a83b8734d..705c26ceff9371b09311bd7fa796c0efde7ebfee 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
|
2024-10-23 15:54:09 +02:00
|
|
|
@@ -530,7 +530,9 @@ public class Panda extends Animal {
|
2021-06-11 14:02:28 +02:00
|
|
|
Panda entitypanda = (Panda) iterator.next();
|
|
|
|
|
2023-06-08 00:12:41 +02:00
|
|
|
if (!entitypanda.isBaby() && entitypanda.onGround() && !entitypanda.isInWater() && entitypanda.canPerformAction()) {
|
2024-01-21 12:53:04 +01:00
|
|
|
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper - Entity Jump API
|
2021-06-11 14:02:28 +02:00
|
|
|
entitypanda.jumpFromGround();
|
2024-01-21 12:53:04 +01:00
|
|
|
+ } else { this.setJumping(false); } // Paper - Entity Jump API; setJumping(false) stops a potential loop
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
2024-10-23 15:54:09 +02:00
|
|
|
index 32973d9c7bf4c4105d7bd82d3723e0b70cd79644..c661ae4e5c07494c7de852cc8d01f0f9839c1590 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
|
2024-10-23 15:54:09 +02:00
|
|
|
@@ -174,7 +174,9 @@ public class Ravager extends Raider {
|
|
|
|
}
|
2022-07-20 18:17:42 +02:00
|
|
|
|
2024-10-23 15:54:09 +02:00
|
|
|
if (!flag && this.onGround()) {
|
|
|
|
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper - Entity Jump API
|
|
|
|
this.jumpFromGround();
|
|
|
|
+ } else { this.setJumping(false); } // Paper - Entity Jump API; setJumping(false) stops a potential loop
|
|
|
|
}
|
2022-07-20 18:17:42 +02:00
|
|
|
}
|
|
|
|
}
|
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
|
2024-10-23 15:54:09 +02:00
|
|
|
index c4c83b4e17aac23794fdb51acfba4e7ef8451e2c..81034513faa3bd4f306430bc48532ba671a7b94b 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
|
2024-10-23 15:54:09 +02:00
|
|
|
@@ -993,4 +993,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
2024-04-06 21:53:39 +02:00
|
|
|
return org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(this.getHandle().getUsedItemHand());
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
2024-04-06 21:53:39 +02:00
|
|
|
// Paper end - active item API
|
2021-06-11 14:02:28 +02:00
|
|
|
+
|
2024-04-06 21:53:39 +02:00
|
|
|
+ // Paper start - entity jump API
|
2021-06-11 14:02:28 +02:00
|
|
|
+ @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();
|
|
|
|
+ }
|
|
|
|
+ }
|
2024-04-06 21:53:39 +02:00
|
|
|
+ // Paper end - entity jump API
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|