2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/projectile/EntityFireball.java
|
|
|
|
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -14,11 +14,15 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.phys.MovingObjectPosition;
|
|
|
|
import net.minecraft.world.phys.Vec3D;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
+
|
2020-06-25 02:00:00 +02:00
|
|
|
public abstract class EntityFireball extends IProjectile {
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
public double xPower;
|
|
|
|
public double yPower;
|
|
|
|
public double zPower;
|
2014-11-25 22:32:16 +01:00
|
|
|
+ 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);
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -28,6 +32,12 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
this(entitytypes, world);
|
2021-11-21 23:00:00 +01:00
|
|
|
this.moveTo(d0, d1, d2, this.getYRot(), this.getXRot());
|
|
|
|
this.reapplyPosition();
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start - Added setDirection method
|
2020-06-25 02:00:00 +02:00
|
|
|
+ this.setDirection(d3, d4, d5);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+
|
2020-06-25 02:00:00 +02:00
|
|
|
+ public void setDirection(double d3, double d4, double d5) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit end
|
2021-06-11 07:00:00 +02:00
|
|
|
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
2020-06-25 02:00:00 +02:00
|
|
|
|
|
|
|
if (d6 != 0.0D) {
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -74,7 +84,13 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
2021-11-21 23:00:00 +01:00
|
|
|
- this.onHit(movingobjectposition);
|
2021-05-09 08:51:44 +02:00
|
|
|
+ this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
|
|
|
+ // CraftBukkit start - Fire ProjectileHitEvent
|
2021-06-11 07:00:00 +02:00
|
|
|
+ if (this.isRemoved()) {
|
2016-11-28 02:47:01 +01:00
|
|
|
+ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
this.checkInsideBlocks();
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -159,6 +175,11 @@
|
2020-06-25 02:00:00 +02:00
|
|
|
Entity entity = damagesource.getEntity();
|
|
|
|
|
|
|
|
if (entity != null) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start
|
2021-04-30 09:53:58 +02:00
|
|
|
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2021-11-21 23:00:00 +01:00
|
|
|
Vec3D vec3d = entity.getLookAngle();
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
this.setDeltaMovement(vec3d);
|