PaperMC/paper-server/nms-patches/net/minecraft/world/entity/projectile/EntityFireball.patch
CraftBukkit/Spigot 65bc2541a3 Update to Minecraft 1.20.5
By: md_5 <git@md-5.net>
2024-04-24 01:15:00 +10:00

47 lines
2 KiB
Diff

--- a/net/minecraft/world/entity/projectile/EntityFireball.java
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
@@ -18,6 +18,11 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityRemoveEvent;
+// CraftBukkit end
+
public abstract class EntityFireball extends IProjectile {
public static final double ATTACK_DEFLECTION_SCALE = 0.1D;
@@ -25,6 +30,8 @@
public double xPower;
public double yPower;
public double zPower;
+ public float bukkitYield = 1; // CraftBukkit
+ public boolean isIncendiary = true; // CraftBukkit
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
super(entitytypes, world);
@@ -72,7 +79,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()) {
@@ -82,7 +89,13 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType());
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
- this.hitTargetOrDeflectSelf(movingobjectposition);
+ this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
+
+ // CraftBukkit start - Fire ProjectileHitEvent
+ if (this.isRemoved()) {
+ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
+ }
+ // CraftBukkit end
}
this.checkInsideBlocks();