From 3e3516e3b29763ccd3c20650a41d378857093280 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 3 Mar 2016 17:30:03 +1100 Subject: [PATCH] Treat ShulkerBullet as Projectile --- .../java/org/bukkit/craftbukkit/CraftWorld.java | 6 +++--- .../craftbukkit/entity/CraftShulkerBullet.java | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 51dada39e0..7023979afd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -926,6 +926,9 @@ public class CraftWorld implements World { entity.setPositionRotation(x, y, z, yaw, pitch); Vector direction = location.getDirection().multiply(10); ((EntityFireball) entity).setDirection(direction.getX(), direction.getY(), direction.getZ()); + } else if (ShulkerBullet.class.isAssignableFrom(clazz)) { + entity = new EntityShulkerBullet(world); + entity.setPositionRotation(x, y, z, yaw, pitch); } } else if (Minecart.class.isAssignableFrom(clazz)) { if (PoweredMinecart.class.isAssignableFrom(clazz)) { @@ -1101,9 +1104,6 @@ public class CraftWorld implements World { entity = new EntityFireworks(world, x, y, z, null); } else if (AreaEffectCloud.class.isAssignableFrom(clazz)) { entity = new EntityAreaEffectCloud(world, x, y, z); - } else if (ShulkerBullet.class.isAssignableFrom(clazz)) { - entity = new EntityShulkerBullet(world); - entity.setPositionRotation(x, y, z, yaw, pitch); } if (entity != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftShulkerBullet.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftShulkerBullet.java index 9147697080..6373f4216d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftShulkerBullet.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftShulkerBullet.java @@ -1,6 +1,5 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.Entity; import net.minecraft.server.EntityShulkerBullet; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; @@ -8,7 +7,7 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.ShulkerBullet; import org.bukkit.projectiles.ProjectileSource; -public class CraftShulkerBullet extends CraftEntity implements ShulkerBullet { +public class CraftShulkerBullet extends AbstractProjectile implements ShulkerBullet { public CraftShulkerBullet(CraftServer server, EntityShulkerBullet entity) { super(server, entity); @@ -48,4 +47,17 @@ public class CraftShulkerBullet extends CraftEntity implements ShulkerBullet { public EntityShulkerBullet getHandle() { return (EntityShulkerBullet) entity; } + + @Deprecated + public LivingEntity _INVALID_getShooter() { + if (getHandle().getShooter() == null) { + return null; + } + return (LivingEntity) getHandle().getShooter().getBukkitEntity(); + } + + @Deprecated + public void _INVALID_setShooter(LivingEntity shooter) { + getHandle().setShooter(((CraftLivingEntity) shooter).getHandle()); + } }