PaperMC/nms-patches/EntityFireball.patch

56 lines
1.9 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
2020-06-25 02:00:00 +02:00
@@ -1,10 +1,14 @@
2016-02-29 22:32:46 +01:00
package net.minecraft.server;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
2020-06-25 02:00:00 +02:00
public abstract class EntityFireball extends IProjectile {
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);
2020-06-25 02:00:00 +02:00
@@ -14,6 +18,12 @@
2019-04-23 04:00:00 +02:00
this(entitytypes, world);
2020-06-25 02:00:00 +02:00
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
this.ac();
+ // CraftBukkit start - Added setDirection method
2020-06-25 02:00:00 +02:00
+ this.setDirection(d3, d4, d5);
+ }
+
2020-06-25 02:00:00 +02:00
+ public void setDirection(double d3, double d4, double d5) {
+ // CraftBukkit end
2020-06-25 02:00:00 +02:00
double d6 = (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
if (d6 != 0.0D) {
@@ -49,6 +59,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();
2020-06-25 02:00:00 +02:00
@@ -132,6 +148,11 @@
Entity entity = damagesource.getEntity();
if (entity != null) {
+ // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
+ return false;
+ }
+ // CraftBukkit end
2020-06-25 02:00:00 +02:00
Vec3D vec3d = entity.getLookDirection();
2019-04-23 04:00:00 +02:00
this.setMot(vec3d);