aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch
new file mode 100644
index 0000000000..837230eaf2
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch
@@ -0,0 +1,62 @@
+--- a/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
++++ b/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
+@@ -16,12 +16,15 @@
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.phys.HitResult;
+ import net.minecraft.world.phys.Vec3;
++import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
+ public abstract class AbstractHurtingProjectile extends Projectile {
+
+ public double xPower;
+ public double yPower;
+ public double zPower;
++ public float bukkitYield = 1; // CraftBukkit
++ public boolean isIncendiary = true; // CraftBukkit
+
+ protected AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> entitytype, Level level) {
+ super(entitytype, level);
+@@ -36,6 +39,12 @@
+ this(entitytype, level);
+ this.moveTo(d0, d1, d2, this.getYRot(), this.getXRot());
+ this.reapplyPosition();
++ // CraftBukkit start - Added setDirection method
++ this.setDirection(d3, z, d5);
++ }
++
++ public void setDirection(double d3, double d4, double d5) {
++ // CraftBukkit end
+ double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
+
+ if (d6 != 0.0D) {
+@@ -88,8 +94,14 @@
+
+ HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType());
+
+- if (hitresult.getType() != HitResult.Type.MISS) {
+- this.onHit(hitresult);
++ if (movingobjectposition.getType() != HitResult.EnumMovingObjectType.MISS) {
++ this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event
++
++ // CraftBukkit start - Fire ProjectileHitEvent
++ if (this.isRemoved()) {
++ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
++ }
++ // CraftBukkit end
+ }
+
+ this.checkInsideBlocks();
+@@ -193,7 +199,12 @@
+
+ if (entity != null) {
+ if (!this.level().isClientSide) {
+- Vec3 vec3 = entity.getLookAngle();
++ // CraftBukkit start
++ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, source, amount, false)) {
++ return false;
++ }
++ // CraftBukkit end
++ Vec3 vec3d = entity.getLookAngle();
+
+ this.setDeltaMovement(vec3);
+ this.xPower = vec3.x * 0.1D;