mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 20:21:51 +01:00
b077005910
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: fd28180e #479: Add LivingEntity#attack, LivingEntity#swingMainHand, LivingEntity#swingOffHand ae72ba3a SPIGOT-5591: Allow concurrent potion effects CraftBukkit Changes:3d61a853
Fix formatting in CraftLivingEntityf7ab3055
#633: Add LivingEntity#attack, LivingEntity#swingMainHand, LivingEntity#swingOffHandd5ef2eab
SPIGOT-5591: Allow concurrent potion effects25a9a9ff
SPIGOT-5592: Custom ChunkGenerator can cause bugged dirt3f6d0de9
Make it clear in error messages that api-version above 1.13 is also supported
72 lines
3.2 KiB
Diff
72 lines
3.2 KiB
Diff
From db100098e2af3e75dc11a4202f7f1c6d1313d780 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/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index 1b9551ae09..ad474500e2 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -91,7 +91,7 @@ public abstract class EntityLiving extends Entity {
|
|
protected float aV;
|
|
protected int aW; protected int getKillCount() { return this.aW; } // Paper - OBFHELPER
|
|
public float lastDamage;
|
|
- protected boolean jumping;
|
|
+ public boolean jumping; // Paper - protected -> public
|
|
public float aZ;
|
|
public float ba;
|
|
public float bb;
|
|
@@ -2605,8 +2605,10 @@ public abstract class EntityLiving extends Entity {
|
|
} else if (this.aH()) {
|
|
this.c(TagsFluid.LAVA);
|
|
} else if ((this.onGround || this.N > 0.0D && this.N <= 0.4D) && this.jumpTicks == 0) {
|
|
+ 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
|
|
index cd41c80f19..f50ed19080 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPanda.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPanda.java
|
|
@@ -438,7 +438,9 @@ public class EntityPanda extends EntityAnimal {
|
|
EntityPanda entitypanda = (EntityPanda) iterator.next();
|
|
|
|
if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.eL()) {
|
|
+ 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
|
|
index 6de01e4f0e..8ffa3cb059 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -723,5 +723,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
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
|
|
}
|
|
--
|
|
2.25.0
|
|
|