2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/projectile/EntityFireball.java
|
|
|
|
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
|
2024-02-21 10:55:34 +01:00
|
|
|
@@ -17,11 +17,18 @@
|
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
|
|
|
|
2024-02-21 10:55:34 +01:00
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+import org.bukkit.event.entity.EntityRemoveEvent;
|
|
|
|
+// CraftBukkit end
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
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);
|
2024-02-21 10:55:34 +01:00
|
|
|
@@ -36,6 +43,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) {
|
2024-02-21 10:55:34 +01:00
|
|
|
@@ -76,7 +89,7 @@
|
|
|
|
Entity entity = this.getOwner();
|
|
|
|
|
|
|
|
if (!this.level().isClientSide && (entity != null && entity.isRemoved() || !this.level().hasChunkAt(this.blockPosition()))) {
|
|
|
|
- this.discard();
|
|
|
|
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
|
|
|
} else {
|
|
|
|
super.tick();
|
|
|
|
if (this.shouldBurn()) {
|
|
|
|
@@ -86,7 +99,13 @@
|
2023-12-05 17:40:00 +01:00
|
|
|
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType());
|
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();
|
2024-02-21 10:55:34 +01:00
|
|
|
@@ -184,6 +203,11 @@
|
2020-06-25 02:00:00 +02:00
|
|
|
|
|
|
|
if (entity != null) {
|
2023-06-07 17:30:00 +02:00
|
|
|
if (!this.level().isClientSide) {
|
2022-02-28 16:00:00 +01:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
Vec3D vec3d = entity.getLookAngle();
|
|
|
|
|
|
|
|
this.setDeltaMovement(vec3d);
|