05466e3b47
Upstream has released updates that appear to apply compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing. Bukkit Changes: d2834556 SPIGOT-4219: Event for PigZombies angering. CraftBukkit Changes:a9c796f1
SPIGOT-4184: Fix furnaces not matching Vanilla smelt or animations195f071e
SPIGOT-4219: Event for PigZombies angering.5e3082c7
SPIGOT-4230: Improve legacy block types
47 Zeilen
1.9 KiB
Diff
47 Zeilen
1.9 KiB
Diff
From 87ab4349feac20b74c3fd1f299dc4e982ae4127d 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 f4a7db369f..faa90e9ee5 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -1248,6 +1248,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;
|
|
@@ -1260,6 +1266,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.18.0
|
|
|