mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
b62dfa0bf9
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: 39ce5d3a SPIGOT-4399: ItemMeta.equals broken with AttributeModifiers CraftBukkit Changes:1cf8b5dc
SPIGOT-4400: Populators running on existing chunks116cb9a1
SPIGOT-4399: Add attribute modifier equality test5ee1c18a
SPIGOT-4398: Set ASM7_EXPERIMENTAL flag
47 lines
1.9 KiB
Diff
47 lines
1.9 KiB
Diff
From b6869d7ec0479144f05aaf16ffed7ce74ffbc2d4 Mon Sep 17 00:00:00 2001
|
|
From: Brokkonaut <hannos17@gmx.de>
|
|
Date: Mon, 18 Jun 2018 15:46:23 +0200
|
|
Subject: [PATCH] Implement EntityKnockbackByEntityEvent
|
|
|
|
This event is called when an entity receives knockback by another entity.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index 566f6e3a6a..a8f58a13fe 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -1251,6 +1251,12 @@ public abstract class EntityLiving extends Entity {
|
|
this.impulse = true;
|
|
float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1);
|
|
|
|
+ // Paper start - preserve old velocity
|
|
+ double oldMotX = this.motX;
|
|
+ double oldMotY = this.motY;
|
|
+ double oldMotZ = this.motZ;
|
|
+ // Paper end
|
|
+
|
|
this.motX /= 2.0D;
|
|
this.motZ /= 2.0D;
|
|
this.motX -= d0 / (double) f1 * (double) f;
|
|
@@ -1263,6 +1269,18 @@ public abstract class EntityLiving extends Entity {
|
|
}
|
|
}
|
|
|
|
+ // Paper start - call EntityKnockbackByEntityEvent
|
|
+ org.bukkit.util.Vector delta = new org.bukkit.util.Vector(this.motX - oldMotX, this.motY - oldMotY, this.motZ - oldMotZ);
|
|
+ // Restore old velocity to be able to access it in the event
|
|
+ this.motX = oldMotX;
|
|
+ this.motY = oldMotY;
|
|
+ this.motZ = oldMotZ;
|
|
+ if (entity == null || new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent((LivingEntity) getBukkitEntity(), entity.getBukkitEntity(), f, delta).callEvent()) {
|
|
+ this.motX += delta.getX();
|
|
+ this.motY += delta.getY();
|
|
+ this.motZ += delta.getZ();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
}
|
|
|
|
--
|
|
2.19.0
|
|
|