Treat ShulkerBullet as Projectile

This commit is contained in:
md_5 2016-03-03 17:30:03 +11:00
parent 9056e66554
commit 3e3516e3b2
2 changed files with 17 additions and 5 deletions

View File

@ -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) {

View File

@ -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());
}
}