diff options
author | GJ <gjmcferrin@gmail.com> | 2013-12-16 22:40:00 -0500 |
---|---|---|
committer | Nate Mortensen <nate.richard.mortensen@gmail.com> | 2014-01-30 21:47:44 -0700 |
commit | e962b1bc095dda028182f59c6e9a2897ef2cd72f (patch) | |
tree | c424027a9db26880724e1e9868b5ba50c7caf5b6 | |
parent | 855b5f8ae37130895457a22041a30a537a1488b2 (diff) | |
download | craftbukkit-e962b1bc095dda028182f59c6e9a2897ef2cd72f.tar craftbukkit-e962b1bc095dda028182f59c6e9a2897ef2cd72f.tar.gz craftbukkit-e962b1bc095dda028182f59c6e9a2897ef2cd72f.tar.lz craftbukkit-e962b1bc095dda028182f59c6e9a2897ef2cd72f.tar.xz craftbukkit-e962b1bc095dda028182f59c6e9a2897ef2cd72f.zip |
[Bleeding] Add support for ThrownExpBottle and Fish to launchProjectile(...). Fixes BUKKIT-1536
Previously, trying to launch a ThrownExpBottle or Fish projectile would
result in an IllegalArgumentException. This commit adds support for both
ThrownExpBottle and Fish, which means that all current projectiles are
now properly supported by this method.
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index e90a91d4..3f45837c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -11,6 +11,8 @@ import net.minecraft.server.EntityArrow; import net.minecraft.server.EntityEgg; import net.minecraft.server.EntityEnderDragon; import net.minecraft.server.EntityEnderPearl; +import net.minecraft.server.EntityFishingHook; +import net.minecraft.server.EntityHuman; import net.minecraft.server.EntityInsentient; import net.minecraft.server.EntityLargeFireball; import net.minecraft.server.EntityLiving; @@ -18,6 +20,7 @@ import net.minecraft.server.EntityPlayer; import net.minecraft.server.EntityPotion; import net.minecraft.server.EntitySmallFireball; import net.minecraft.server.EntitySnowball; +import net.minecraft.server.EntityThrownExpBottle; import net.minecraft.server.EntityWither; import net.minecraft.server.EntityWitherSkull; import net.minecraft.server.GenericAttributes; @@ -38,12 +41,14 @@ import org.bukkit.entity.EnderPearl; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Fireball; +import org.bukkit.entity.Fish; import org.bukkit.entity.HumanEntity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.entity.SmallFireball; import org.bukkit.entity.Snowball; +import org.bukkit.entity.ThrownExpBottle; import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.WitherSkull; import org.bukkit.event.player.PlayerTeleportEvent; @@ -303,6 +308,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { launch = new EntityArrow(world, getHandle(), 1); } else if (ThrownPotion.class.isAssignableFrom(projectile)) { launch = new EntityPotion(world, getHandle(), CraftItemStack.asNMSCopy(new ItemStack(Material.POTION, 1))); + } else if (ThrownExpBottle.class.isAssignableFrom(projectile)) { + launch = new EntityThrownExpBottle(world, getHandle()); + } else if (Fish.class.isAssignableFrom(projectile) && getHandle() instanceof EntityHuman) { + launch = new EntityFishingHook(world, (EntityHuman) getHandle()); } else if (Fireball.class.isAssignableFrom(projectile)) { Location location = getEyeLocation(); Vector direction = location.getDirection().multiply(10); |