3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-28 17:10:10 +01:00
Paper/nms-patches/EntityFireball.patch
2020-06-25 10:00:00 +10:00

56 Zeilen
1.9 KiB
Diff

--- a/net/minecraft/server/EntityFireball.java
+++ b/net/minecraft/server/EntityFireball.java
@@ -1,10 +1,14 @@
package net.minecraft.server;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
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
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
super(entitytypes, world);
@@ -14,6 +18,12 @@
this(entitytypes, world);
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
this.ac();
+ // CraftBukkit start - Added setDirection method
+ this.setDirection(d3, d4, d5);
+ }
+
+ public void setDirection(double d3, double d4, double d5) {
+ // CraftBukkit end
double d6 = (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
if (d6 != 0.0D) {
@@ -49,6 +59,12 @@
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
this.a(movingobjectposition);
+
+ // CraftBukkit start - Fire ProjectileHitEvent
+ if (this.dead) {
+ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
+ }
+ // CraftBukkit end
}
Vec3D vec3d = this.getMot();
@@ -132,6 +148,11 @@
Entity entity = damagesource.getEntity();
if (entity != null) {
+ // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
+ return false;
+ }
+ // CraftBukkit end
Vec3D vec3d = entity.getLookDirection();
this.setMot(vec3d);