Paper/nms-patches/EntityFireball.patch

70 lines
2.8 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/EntityFireball.java
+++ b/net/minecraft/server/EntityFireball.java
2016-02-29 22:32:46 +01:00
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public abstract class EntityFireball extends Entity {
2016-11-17 02:41:03 +01:00
public EntityLiving shooter;
@@ -8,6 +10,8 @@
public double dirX;
public double dirY;
public double dirZ;
+ public float bukkitYield = 1; // CraftBukkit
+ public boolean isIncendiary = true; // CraftBukkit
2019-04-23 04:00:00 +02:00
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
2018-07-15 02:00:00 +02:00
super(entitytypes, world);
2019-04-23 04:00:00 +02:00
@@ -27,9 +31,16 @@
public EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, EntityLiving entityliving, double d0, double d1, double d2, World world) {
this(entitytypes, world);
this.shooter = entityliving;
+ this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
this.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.setPosition(this.locX, this.locY, this.locZ);
2019-04-23 04:00:00 +02:00
this.setMot(Vec3D.a);
+ // CraftBukkit start - Added setDirection method
+ this.setDirection(d0, d1, d2);
+ }
+
+ public void setDirection(double d0, double d1, double d2) {
+ // CraftBukkit end
d0 += this.random.nextGaussian() * 0.4D;
d1 += this.random.nextGaussian() * 0.4D;
d2 += this.random.nextGaussian() * 0.4D;
2019-04-23 04:00:00 +02:00
@@ -58,6 +69,12 @@
2019-04-23 04:00:00 +02:00
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
this.a(movingobjectposition);
+
+ // CraftBukkit start - Fire ProjectileHitEvent
+ if (this.dead) {
2016-11-28 02:47:01 +01:00
+ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
+ }
+ // CraftBukkit end
}
2019-04-23 04:00:00 +02:00
Vec3D vec3d = this.getMot();
@@ -147,6 +164,11 @@
} else {
2019-04-23 04:00:00 +02:00
this.velocityChanged();
if (damagesource.getEntity() != null) {
+ // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
+ return false;
+ }
+ // CraftBukkit end
2019-04-23 04:00:00 +02:00
Vec3D vec3d = damagesource.getEntity().getLookDirection();
2019-04-23 04:00:00 +02:00
this.setMot(vec3d);
@@ -155,6 +177,7 @@
this.dirZ = vec3d.z * 0.1D;
if (damagesource.getEntity() instanceof EntityLiving) {
this.shooter = (EntityLiving) damagesource.getEntity();
+ this.projectileSource = (org.bukkit.projectiles.ProjectileSource) this.shooter.getBukkitEntity();
}
return true;