diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch new file mode 100644 index 0000000000..0d280ee620 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch @@ -0,0 +1,84 @@ +--- a/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java ++++ b/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java +@@ -16,11 +16,14 @@ + 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); +@@ -37,11 +39,18 @@ + this(entityType, level); + this.moveTo(x, y, z, this.getYRot(), this.getXRot()); + this.reapplyPosition(); +- double squareRoot = Math.sqrt(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ); +- if (squareRoot != 0.0) { +- this.xPower = offsetX / squareRoot * 0.1; +- this.yPower = offsetY / squareRoot * 0.1; +- this.zPower = offsetZ / squareRoot * 0.1; ++ // 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) { ++ this.xPower = d3 / d6 * 0.1D; ++ this.yPower = d4 / d6 * 0.1D; ++ this.zPower = d5 / d6 * 0.1D; + } + } + +@@ -81,9 +92,16 @@ + this.setSecondsOnFire(1); + } + +- HitResult hitResultOnMoveVector = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType()); +- if (hitResultOnMoveVector.getType() != HitResult.Type.MISS) { +- this.onHit(hitResultOnMoveVector); ++ HitResult movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType()); ++ ++ 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(); +@@ -185,11 +199,17 @@ + Entity entity = source.getEntity(); + if (entity != null) { + if (!this.level().isClientSide) { +- Vec3 lookAngle = entity.getLookAngle(); +- this.setDeltaMovement(lookAngle); +- this.xPower = lookAngle.x * 0.1; +- this.yPower = lookAngle.y * 0.1; +- this.zPower = lookAngle.z * 0.1; ++ // CraftBukkit start ++ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, source, amount, false)) { ++ return false; ++ } ++ // CraftBukkit end ++ Vec3 vec3d = entity.getLookAngle(); ++ ++ this.setDeltaMovement(vec3d); ++ this.xPower = vec3d.x * 0.1D; ++ this.yPower = vec3d.y * 0.1D; ++ this.zPower = vec3d.z * 0.1D; + this.setOwner(entity); + } + |