13
0
geforkt von Mirrors/Paper

SPIGOT-7887: Remove duplicate ProjectileHitEvent for fireballs

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2024-08-29 07:23:29 +10:00
Ursprung ab921984fc
Commit b2a28c54bb

Datei anzeigen

@ -1,11 +1,10 @@
--- a/net/minecraft/world/entity/projectile/EntityFireball.java --- a/net/minecraft/world/entity/projectile/EntityFireball.java
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java +++ b/net/minecraft/world/entity/projectile/EntityFireball.java
@@ -18,11 +18,18 @@ @@ -18,11 +18,17 @@
import net.minecraft.world.phys.MovingObjectPosition; import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start +// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityRemoveEvent; +import org.bukkit.event.entity.EntityRemoveEvent;
+// CraftBukkit end +// CraftBukkit end
+ +
@ -19,7 +18,7 @@
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) { protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
super(entitytypes, world); super(entitytypes, world);
@@ -71,7 +78,7 @@ @@ -71,7 +77,7 @@
Entity entity = this.getOwner(); Entity entity = this.getOwner();
if (!this.level().isClientSide && (entity != null && entity.isRemoved() || !this.level().hasChunkAt(this.blockPosition()))) { if (!this.level().isClientSide && (entity != null && entity.isRemoved() || !this.level().hasChunkAt(this.blockPosition()))) {
@ -28,18 +27,12 @@
} else { } else {
super.tick(); super.tick();
if (this.shouldBurn()) { if (this.shouldBurn()) {
@@ -81,7 +88,13 @@ @@ -81,7 +87,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType()); MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType());
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
- this.hitTargetOrDeflectSelf(movingobjectposition); - this.hitTargetOrDeflectSelf(movingobjectposition);
+ this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event + this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
+
+ // CraftBukkit start - Fire ProjectileHitEvent
+ if (this.isRemoved()) {
+ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
+ }
+ // CraftBukkit end
} }
this.checkInsideBlocks(); this.checkInsideBlocks();