diff options
author | Carlos Cobo <toqueteos@gmail.com> | 2013-03-23 15:28:23 +0100 |
---|---|---|
committer | riking <rikingcoding@gmail.com> | 2013-03-23 19:05:14 -0700 |
commit | 62c6d223e4d8197eb578c4969d4dba5b30661cfd (patch) | |
tree | 372bcc1ecf4e2376abd19735d27cada0eda1bdb4 /src | |
parent | e1b50b011041be08038dabd44ac3b6afc9d45f19 (diff) | |
download | craftbukkit-62c6d223e4d8197eb578c4969d4dba5b30661cfd.tar craftbukkit-62c6d223e4d8197eb578c4969d4dba5b30661cfd.tar.gz craftbukkit-62c6d223e4d8197eb578c4969d4dba5b30661cfd.tar.lz craftbukkit-62c6d223e4d8197eb578c4969d4dba5b30661cfd.tar.xz craftbukkit-62c6d223e4d8197eb578c4969d4dba5b30661cfd.zip |
Include ThrownPotion in spawn methods. Adds BUKKIT-2542
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 2 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index adb2bba3..41cb825e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -848,6 +848,8 @@ public class CraftWorld implements World { } else if (ThrownExpBottle.class.isAssignableFrom(clazz)) { entity = new EntityThrownExpBottle(world); entity.setPositionRotation(x, y, z, 0, 0); + } else if (ThrownPotion.class.isAssignableFrom(clazz)) { + entity = new EntityPotion(world, x, y, z, CraftItemStack.asNMSCopy(new ItemStack(org.bukkit.Material.POTION, 1))); } else if (Fireball.class.isAssignableFrom(clazz)) { if (SmallFireball.class.isAssignableFrom(clazz)) { entity = new EntitySmallFireball(world); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 7a7fd391..58c7db09 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -16,6 +16,7 @@ import net.minecraft.server.EntityLiving; import net.minecraft.server.EntitySmallFireball; import net.minecraft.server.EntitySnowball; import net.minecraft.server.EntityPlayer; +import net.minecraft.server.EntityPotion; import net.minecraft.server.EntityWitherSkull; import net.minecraft.server.MobEffect; import net.minecraft.server.MobEffectList; @@ -24,10 +25,12 @@ import net.minecraft.server.Packet42RemoveMobEffect; import org.apache.commons.lang.Validate; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.inventory.CraftEntityEquipment; +import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.entity.Arrow; import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; @@ -40,9 +43,11 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.entity.SmallFireball; import org.bukkit.entity.Snowball; +import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.WitherSkull; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.inventory.EntityEquipment; +import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.BlockIterator; @@ -299,6 +304,8 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { launch = new EntityEnderPearl(world, getHandle()); } else if (Arrow.class.isAssignableFrom(projectile)) { 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 (Fireball.class.isAssignableFrom(projectile)) { Location location = getEyeLocation(); Vector direction = location.getDirection().multiply(10); |