Entity Origin API
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user