diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-11-26 08:32:16 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2014-11-28 17:16:30 +1100 |
commit | 24557bc2b37deb6a0edf497d547471832457b1dd (patch) | |
tree | c560572889a3b0b34964a0cddb35dc87fda3c914 /nms-patches/EntityFireball.patch | |
parent | a4805dbd77da057cc1ea0bf344379bc6e53ca1f6 (diff) | |
download | craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.gz craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.lz craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.xz craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.zip |
Update to Minecraft 1.8
For more information please see http://www.spigotmc.org/
Diffstat (limited to 'nms-patches/EntityFireball.patch')
-rw-r--r-- | nms-patches/EntityFireball.patch | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/nms-patches/EntityFireball.patch b/nms-patches/EntityFireball.patch new file mode 100644 index 00000000..67022e16 --- /dev/null +++ b/nms-patches/EntityFireball.patch @@ -0,0 +1,111 @@ +--- ../work/decompile-bb26c12b/net/minecraft/server/EntityFireball.java 2014-11-27 08:59:46.677421952 +1100 ++++ src/main/java/net/minecraft/server/EntityFireball.java 2014-11-27 08:42:10.144850927 +1100 +@@ -2,6 +2,8 @@ + + import java.util.List; + ++import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit ++ + public abstract class EntityFireball extends Entity { + + private int e = -1; +@@ -15,6 +17,8 @@ + public double dirX; + public double dirY; + public double dirZ; ++ public float bukkitYield = 1; // CraftBukkit ++ public boolean isIncendiary = true; // CraftBukkit + + public EntityFireball(World world) { + super(world); +@@ -38,10 +42,17 @@ + public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) { + super(world); + this.shooter = entityliving; ++ this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit + this.a(1.0F, 1.0F); + this.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); + this.setPosition(this.locX, this.locY, this.locZ); + this.motX = this.motY = this.motZ = 0.0D; ++ // CraftBukkit start - Added setDirection method ++ this.setDirection(d0, d1, d2); ++ } ++ ++ public void setDirection(double d0, double d1, double d2) { ++ // CraftBukkit end + d0 += this.random.nextGaussian() * 0.4D; + d1 += this.random.nextGaussian() * 0.4D; + d2 += this.random.nextGaussian() * 0.4D; +@@ -101,7 +112,7 @@ + MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); + + if (movingobjectposition1 != null) { +- double d1 = vec3d.f(movingobjectposition1.pos); ++ double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency + + if (d1 < d0 || d0 == 0.0D) { + entity = entity1; +@@ -117,6 +128,12 @@ + + if (movingobjectposition != null) { + this.a(movingobjectposition); ++ ++ // CraftBukkit start - Fire ProjectileHitEvent ++ if (this.dead) { ++ CraftEventFactory.callProjectileHitEvent(this); ++ } ++ // CraftBukkit end + } + + this.locX += this.motX; +@@ -181,7 +198,8 @@ + + nbttagcompound.setString("inTile", minecraftkey == null ? "" : minecraftkey.toString()); + nbttagcompound.setByte("inGround", (byte) (this.i ? 1 : 0)); +- nbttagcompound.set("direction", this.a(new double[] { this.motX, this.motY, this.motZ})); ++ // CraftBukkit - Fix direction being mismapped to invalid variables ++ nbttagcompound.set("power", this.a(new double[] { this.dirX, this.dirY, this.dirZ})); + } + + public void a(NBTTagCompound nbttagcompound) { +@@ -195,12 +213,14 @@ + } + + this.i = nbttagcompound.getByte("inGround") == 1; +- if (nbttagcompound.hasKeyOfType("direction", 9)) { +- NBTTagList nbttaglist = nbttagcompound.getList("direction", 6); +- +- this.motX = nbttaglist.d(0); +- this.motY = nbttaglist.d(1); +- this.motZ = nbttaglist.d(2); ++ // CraftBukkit start - direction -> power ++ if (nbttagcompound.hasKeyOfType("power", 9)) { ++ NBTTagList nbttaglist = nbttagcompound.getList("power", 6); ++ ++ this.dirX = nbttaglist.d(0); ++ this.dirY = nbttaglist.d(1); ++ this.dirZ = nbttaglist.d(2); ++ // CraftBukkit end + } else { + this.die(); + } +@@ -221,6 +241,11 @@ + } else { + this.ac(); + if (damagesource.getEntity() != null) { ++ // CraftBukkit start ++ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) { ++ return false; ++ } ++ // CraftBukkit end + Vec3D vec3d = damagesource.getEntity().ap(); + + if (vec3d != null) { +@@ -234,6 +259,7 @@ + + if (damagesource.getEntity() instanceof EntityLiving) { + this.shooter = (EntityLiving) damagesource.getEntity(); ++ this.projectileSource = (org.bukkit.projectiles.ProjectileSource) this.shooter.getBukkitEntity(); + } + + return true; |