Entity Jump API

== AT ==
public net.minecraft.world.entity.LivingEntity jumping
This commit is contained in:
BillyGalbreath
2020-02-08 23:26:11 -06:00
parent 4e20691d59
commit 0dd8044178
4 changed files with 110 additions and 59 deletions

View File

@@ -12,7 +12,17 @@
public class Panda extends Animal {
@@ -541,14 +546,14 @@
@@ -525,7 +530,9 @@
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 - Entity Jump API
entitypanda.jumpFromGround();
+ } else { this.setJumping(false); } // Paper - Entity Jump API; setJumping(false) stops a potential loop
}
}
@@ -541,14 +548,14 @@
@Override
protected void pickUpItem(ServerLevel world, ItemEntity itemEntity) {
@@ -29,7 +39,7 @@
}
}
@@ -772,7 +777,7 @@
@@ -772,7 +779,7 @@
}
public static Panda.Gene byName(String name) {
@@ -38,7 +48,7 @@
}
public static Panda.Gene getRandom(RandomSource random) {
@@ -876,10 +881,10 @@
@@ -876,10 +883,10 @@
private final Panda panda;
public PandaAvoidGoal(Panda panda, Class<T> fleeFromType, float distance, double slowSpeed, double fastSpeed) {
@@ -52,7 +62,7 @@
this.panda = panda;
}
@@ -1116,7 +1121,7 @@
@@ -1116,7 +1123,7 @@
@Override
protected void alertOther(Mob mob, LivingEntity target) {
if (mob instanceof Panda && mob.isAggressive()) {