From 137f84d3b648fd70d8a6deeca241d02821fa2cb0 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 6 Dec 2012 18:36:40 -0600 Subject: [PATCH] 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!) By: feildmaster --- .../craftbukkit/entity/CraftLivingEntity.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 0dcadcad09..c49f0aa464 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/paper-server/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)) { - if (SmallFireball.class.isAssignableFrom(projectile)) { - launch = new EntitySmallFireball(world); - } else if (WitherSkull.class.isAssignableFrom(projectile)) { - launch = new EntityWitherSkull(world); - } else { - launch = new EntityLargeFireball(world); - } - Location location = getEyeLocation(); Vector direction = location.getDirection().multiply(10); + if (SmallFireball.class.isAssignableFrom(projectile)) { + launch = new EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ()); + } else if (WitherSkull.class.isAssignableFrom(projectile)) { + launch = new EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ()); + } else { + launch = new EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ()); + } + 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");