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
|
|
|
|
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
2021-05-30 03:51:13 +02:00
|
|
|
index ffb4072f46456b3a2b2daa55947787cee774d26d..571e6bced3cfaacbd40378e67b01cdfda550feb7 100644
|
2021-03-16 08:19:45 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
2021-03-16 14:04:28 +01:00
|
|
|
@@ -2876,8 +2876,10 @@ public abstract class EntityLiving extends Entity {
|
2020-11-03 03:22:15 +01:00
|
|
|
} else if (this.aQ() && (!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;
|
2021-03-16 08:19:45 +01: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 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
|
2021-05-30 03:51:13 +02:00
|
|
|
index db5d9a8107babd42200f911d2b8ebdc15b4d7c8b..468dca6d8c2ec77c3c77c93d04fb9dc329b1befa 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
|
2021-05-30 03:51:13 +02:00
|
|
|
@@ -804,5 +804,19 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
|
|
public org.bukkit.inventory.EquipmentSlot getHandRaised() {
|
|
|
|
return getHandle().getRaisedHand() == net.minecraft.world.EnumHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND;
|
2020-02-11 05:28:39 +01:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @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
|
|
|
|
}
|