Files
CatServer/patches/net/minecraft/entity/projectile/EntityFireball.java.patch
2018-07-20 01:14:44 +08:00

70 lines
2.7 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFireball.java
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFireball.java
@@ -1,5 +1,7 @@
package net.minecraft.entity.projectile;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -30,6 +32,8 @@
public double accelerationX;
public double accelerationY;
public double accelerationZ;
+ public float bukkitYield = 1; // CraftBukkit
+ public boolean isIncendiary = true; // CraftBukkit
public EntityFireball(World worldIn)
{
@@ -71,12 +75,17 @@
{
super(worldIn);
this.shootingEntity = shooter;
+ this.projectileSource = (org.bukkit.entity.LivingEntity) shooter.getBukkitEntity(); // CraftBukkit
this.setSize(1.0F, 1.0F);
this.setLocationAndAngles(shooter.posX, shooter.posY, shooter.posZ, shooter.rotationYaw, shooter.rotationPitch);
this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = 0.0D;
this.motionY = 0.0D;
this.motionZ = 0.0D;
+ // CraftBukkit start - Added setDirection method
+ this.setDirection(accelX, accelY, accelZ);
+ }
+ public void setDirection(double accelX, double accelY, double accelZ) {
accelX = accelX + this.rand.nextGaussian() * 0.4D;
accelY = accelY + this.rand.nextGaussian() * 0.4D;
accelZ = accelZ + this.rand.nextGaussian() * 0.4D;
@@ -128,6 +137,11 @@
if (raytraceresult != null)
{
this.onImpact(raytraceresult);
+ // CraftBukkit start - Fire ProjectileHitEvent
+ if (this.isDead) {
+ CraftEventFactory.callProjectileHitEvent(this);
+ }
+ // CraftBukkit end
}
this.posX += this.motionX;
@@ -262,6 +276,11 @@
if (source.getEntity() != null)
{
+ // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, source, amount)) {
+ return false;
+ }
+ // CraftBukkit end
Vec3d vec3d = source.getEntity().getLookVec();
if (vec3d != null)
@@ -277,6 +296,7 @@
if (source.getEntity() instanceof EntityLivingBase)
{
this.shootingEntity = (EntityLivingBase)source.getEntity();
+ this.projectileSource = (org.bukkit.projectiles.ProjectileSource) this.shootingEntity.getBukkitEntity();
}
return true;