mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-18 15:20:37 +01:00
Implemented the concept of a projectile.
By: sunkid <sunkid@iminurnetz.com>
This commit is contained in:
parent
e1f49291ce
commit
b20ba5be29
5 changed files with 98 additions and 9 deletions
|
@ -1,13 +1,14 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import org.bukkit.entity.Arrow;
|
||||
import net.minecraft.server.EntityArrow;
|
||||
import net.minecraft.server.EntityLiving;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* Represents an arrow.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftArrow extends CraftEntity implements Arrow {
|
||||
public CraftArrow(CraftServer server, EntityArrow entity) {
|
||||
|
@ -18,4 +19,19 @@ public class CraftArrow extends CraftEntity implements Arrow {
|
|||
public String toString() {
|
||||
return "CraftArrow";
|
||||
}
|
||||
|
||||
public LivingEntity getShooter() {
|
||||
if (((EntityArrow) getHandle()).shooter != null) {
|
||||
return (LivingEntity) ((EntityArrow) getHandle()).shooter.getBukkitEntity();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public void setShooter(LivingEntity shooter) {
|
||||
if (shooter instanceof CraftLivingEntity) {
|
||||
((EntityArrow) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityEgg;
|
||||
import net.minecraft.server.EntityLiving;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* An egg.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftEgg extends CraftEntity implements Egg {
|
||||
public CraftEgg(CraftServer server, EntityEgg entity) {
|
||||
|
@ -18,4 +19,19 @@ public class CraftEgg extends CraftEntity implements Egg {
|
|||
public String toString() {
|
||||
return "CraftEgg";
|
||||
}
|
||||
|
||||
public LivingEntity getShooter() {
|
||||
if (((EntityEgg) getHandle()).thrower != null) {
|
||||
return (LivingEntity) ((EntityEgg) getHandle()).thrower.getBukkitEntity();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public void setShooter(LivingEntity shooter) {
|
||||
if (shooter instanceof CraftLivingEntity) {
|
||||
((EntityEgg) getHandle()).thrower = (EntityLiving) ((CraftLivingEntity) shooter).entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityFireball;
|
||||
import net.minecraft.server.EntityLiving;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* A Fireball.
|
||||
|
@ -33,4 +36,27 @@ public class CraftFireball extends CraftEntity implements Fireball {
|
|||
public void setYield(float yield) {
|
||||
((EntityFireball) getHandle()).yield = yield;
|
||||
}
|
||||
|
||||
public LivingEntity getShooter() {
|
||||
if (((EntityFireball) getHandle()).shooter != null) {
|
||||
return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public void setShooter(LivingEntity shooter) {
|
||||
if (shooter instanceof CraftLivingEntity) {
|
||||
((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector getDirection() {
|
||||
return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
|
||||
}
|
||||
|
||||
public void setDirection(Vector direction) {
|
||||
((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityFish;
|
||||
import net.minecraft.server.EntityHuman;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Fish;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* A Fish.
|
||||
*
|
||||
* @author Cogito
|
||||
*/
|
||||
public class CraftFish extends CraftEntity implements Fish {
|
||||
public CraftFish(CraftServer server, EntityFish entity) {
|
||||
|
@ -19,4 +19,20 @@ public class CraftFish extends CraftEntity implements Fish {
|
|||
public String toString() {
|
||||
return "CraftFish";
|
||||
}
|
||||
|
||||
public LivingEntity getShooter() {
|
||||
if (((EntityFish) getHandle()).owner != null) {
|
||||
return (LivingEntity) ((EntityFish) getHandle()).owner.getBukkitEntity();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public void setShooter(LivingEntity shooter) {
|
||||
if (shooter instanceof CraftHumanEntity) {
|
||||
((EntityFish) getHandle()).owner = (EntityHuman) ((CraftHumanEntity) shooter).entity;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityLiving;
|
||||
import net.minecraft.server.EntitySnowball;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Snowball;
|
||||
|
||||
/**
|
||||
* A snowball.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftSnowball extends CraftEntity implements Snowball {
|
||||
public CraftSnowball(CraftServer server, EntitySnowball entity) {
|
||||
|
@ -18,4 +19,18 @@ public class CraftSnowball extends CraftEntity implements Snowball {
|
|||
public String toString() {
|
||||
return "CraftSnowball";
|
||||
}
|
||||
|
||||
public LivingEntity getShooter() {
|
||||
if (((EntitySnowball) getHandle()).shooter != null) {
|
||||
return (LivingEntity) ((EntitySnowball) getHandle()).shooter.getBukkitEntity();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setShooter(LivingEntity shooter) {
|
||||
if (shooter instanceof CraftLivingEntity) {
|
||||
((EntitySnowball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue