diff options
author | feildmaster <admin@feildmaster.com> | 2012-12-06 18:36:40 -0600 |
---|---|---|
committer | feildmaster <admin@feildmaster.com> | 2012-12-07 05:25:20 -0600 |
commit | c74fd4196f73382a9836850d1161a8ab5f958731 (patch) | |
tree | 438d6f9042760dab0b13b6b9c3244f0034280cd2 /src/main/java/org/bukkit | |
parent | 78bc0ad1d5cb1429a671a47139b7bb129e1f71b6 (diff) | |
download | craftbukkit-c74fd4196f73382a9836850d1161a8ab5f958731.tar craftbukkit-c74fd4196f73382a9836850d1161a8ab5f958731.tar.gz craftbukkit-c74fd4196f73382a9836850d1161a8ab5f958731.tar.lz craftbukkit-c74fd4196f73382a9836850d1161a8ab5f958731.tar.xz craftbukkit-c74fd4196f73382a9836850d1161a8ab5f958731.zip |
Use shooter constructor for Fireballs. Fixes BUKKIT-3121
Fixes fireballs exploding in the shooter's face and not having a shooter for the projectile. (Two birds with one stone!)
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 0dcadcad..c49f0aa4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -11,7 +11,6 @@ import net.minecraft.server.EntityArrow; import net.minecraft.server.EntityEgg; import net.minecraft.server.EntityEnderDragon; import net.minecraft.server.EntityEnderPearl; -import net.minecraft.server.EntityFireball; import net.minecraft.server.EntityLargeFireball; import net.minecraft.server.EntityLiving; import net.minecraft.server.EntitySmallFireball; @@ -278,19 +277,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } else if (Arrow.class.isAssignableFrom(projectile)) { launch = new EntityArrow(world, getHandle(), 1); } else if (Fireball.class.isAssignableFrom(projectile)) { + Location location = getEyeLocation(); + Vector direction = location.getDirection().multiply(10); + if (SmallFireball.class.isAssignableFrom(projectile)) { - launch = new EntitySmallFireball(world); + launch = new EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ()); } else if (WitherSkull.class.isAssignableFrom(projectile)) { - launch = new EntityWitherSkull(world); + launch = new EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ()); } else { - launch = new EntityLargeFireball(world); + launch = new EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ()); } - Location location = getEyeLocation(); - Vector direction = location.getDirection().multiply(10); - launch.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - ((EntityFireball) launch).setDirection(direction.getX(), direction.getY(), direction.getZ()); } Validate.notNull(launch, "Projectile not supported"); |