2020-04-10 20:19:18 -04:00
|
|
|
package com.plotsquared.bukkit.entity;
|
2015-02-10 03:21:59 +11:00
|
|
|
|
2018-08-19 22:18:58 +02:00
|
|
|
import lombok.Getter;
|
|
|
|
import lombok.NonNull;
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.World;
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
import org.bukkit.entity.EntityType;
|
2015-02-10 03:21:59 +11:00
|
|
|
|
2018-11-14 14:44:07 +00:00
|
|
|
@Getter public abstract class EntityWrapper {
|
2016-02-13 20:01:18 -05:00
|
|
|
|
2018-11-14 14:44:07 +00:00
|
|
|
protected final float yaw;
|
|
|
|
protected final float pitch;
|
2018-08-19 22:18:58 +02:00
|
|
|
private final Entity entity;
|
2016-04-26 10:14:22 -04:00
|
|
|
private final EntityType type;
|
2015-02-10 03:21:59 +11:00
|
|
|
public double x;
|
|
|
|
public double y;
|
|
|
|
public double z;
|
2016-04-05 23:50:04 -04:00
|
|
|
|
2018-08-19 22:18:58 +02:00
|
|
|
EntityWrapper(@NonNull final Entity entity) {
|
|
|
|
this.entity = entity;
|
|
|
|
this.type = entity.getType();
|
|
|
|
|
|
|
|
final Location location = entity.getLocation();
|
2016-06-02 11:38:47 -04:00
|
|
|
this.x = location.getX();
|
|
|
|
this.y = location.getY();
|
|
|
|
this.z = location.getZ();
|
2018-08-19 22:18:58 +02:00
|
|
|
this.yaw = location.getYaw();
|
|
|
|
this.pitch = location.getPitch();
|
2016-02-13 20:01:18 -05:00
|
|
|
}
|
|
|
|
|
2018-08-19 22:18:58 +02:00
|
|
|
@SuppressWarnings("deprecation") @Override public String toString() {
|
|
|
|
return String.format("[%s, x=%s, y=%s, z=%s]", type.getName(), x, y, z);
|
2016-02-13 20:01:18 -05:00
|
|
|
}
|
|
|
|
|
2018-08-19 22:18:58 +02:00
|
|
|
public abstract Entity spawn(World world, int xOffset, int zOffset);
|
2016-04-26 10:14:22 -04:00
|
|
|
|
2018-08-19 22:18:58 +02:00
|
|
|
public abstract void saveEntity();
|
2016-03-22 21:41:37 -04:00
|
|
|
|
2015-02-10 03:21:59 +11:00
|
|
|
}
|