mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 11:42:55 +01:00
30 lines
1.4 KiB
Diff
30 lines
1.4 KiB
Diff
|
@@ -25,6 +25,7 @@
|
||
|
public EntityProjectile(World world, EntityLiving entityliving) {
|
||
|
super(world);
|
||
|
this.shooter = entityliving;
|
||
|
+ this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
|
||
|
this.a(0.25F, 0.25F);
|
||
|
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||
|
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||
|
@@ -130,7 +131,7 @@
|
||
|
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||
|
|
||
|
if (movingobjectposition1 != null) {
|
||
|
- double d1 = vec3d.f(movingobjectposition1.pos);
|
||
|
+ double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency
|
||
|
|
||
|
if (d1 < d0 || d0 == 0.0D) {
|
||
|
entity = entity1;
|
||
|
@@ -150,6 +151,11 @@
|
||
|
this.aq();
|
||
|
} else {
|
||
|
this.a(movingobjectposition);
|
||
|
+ // CraftBukkit start
|
||
|
+ if (this.dead) {
|
||
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this);
|
||
|
+ }
|
||
|
+ // CraftBukkit end
|
||
|
}
|
||
|
}
|
||
|
|