craftbukkit/nms-patches/net/minecraft/world/entity/projectile/EntityFireball.patch

59 lines
2.2 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/entity/projectile/EntityFireball.java
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
2022-12-08 03:00:00 +11:00
@@ -15,11 +15,15 @@
2021-03-16 09:00:00 +11:00
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.Vec3D;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
2020-06-25 10:00:00 +10:00
public abstract class EntityFireball extends IProjectile {
2021-06-11 15:00:00 +10:00
public double xPower;
public double yPower;
public double zPower;
+ public float bukkitYield = 1; // CraftBukkit
+ public boolean isIncendiary = true; // CraftBukkit
2019-04-23 12:00:00 +10:00
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
2018-07-15 10:00:00 +10:00
super(entitytypes, world);
2022-12-08 03:00:00 +11:00
@@ -29,6 +33,12 @@
2019-04-23 12:00:00 +10:00
this(entitytypes, world);
2021-11-22 09:00:00 +11:00
this.moveTo(d0, d1, d2, this.getYRot(), this.getXRot());
this.reapplyPosition();
+ // CraftBukkit start - Added setDirection method
2020-06-25 10:00:00 +10:00
+ this.setDirection(d3, d4, d5);
+ }
+
2020-06-25 10:00:00 +10:00
+ public void setDirection(double d3, double d4, double d5) {
+ // CraftBukkit end
2021-06-11 15:00:00 +10:00
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
2020-06-25 10:00:00 +10:00
if (d6 != 0.0D) {
2022-12-08 03:00:00 +11:00
@@ -75,7 +85,13 @@
2021-11-22 09:00:00 +11:00
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
2019-04-23 12:00:00 +10:00
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
2021-11-22 09:00:00 +11:00
- this.onHit(movingobjectposition);
+ this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event
+
+ // CraftBukkit start - Fire ProjectileHitEvent
2021-06-11 15:00:00 +10:00
+ if (this.isRemoved()) {
2016-11-28 12:47:01 +11:00
+ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
+ }
+ // CraftBukkit end
}
2021-11-22 09:00:00 +11:00
this.checkInsideBlocks();
2022-12-08 03:00:00 +11:00
@@ -161,6 +177,11 @@
2020-06-25 10:00:00 +10:00
if (entity != null) {
2022-03-01 02:00:00 +11:00
if (!this.level.isClientSide) {
+ // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
+ return false;
+ }
+ // CraftBukkit end
Vec3D vec3d = entity.getLookAngle();
this.setDeltaMovement(vec3d);