Entity Origin API

This commit is contained in:
Byteflux
2016-03-01 23:45:08 -06:00
parent 3e1c79c850
commit 6212f523fa
3 changed files with 163 additions and 91 deletions

View File

@@ -964,4 +964,21 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return this.spigot;
}
// Spigot end
// Paper start - entity origin API
@Override
public Location getOrigin() {
Vector originVector = this.getHandle().getOriginVector();
if (originVector == null) {
return null;
}
World world = this.getWorld();
if (this.getHandle().getOriginWorld() != null) {
world = org.bukkit.Bukkit.getWorld(this.getHandle().getOriginWorld());
}
//noinspection ConstantConditions
return originVector.toLocation(world);
}
// Paper end - entity origin API
}