mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Added a way to get the spawn position of a world
This commit is contained in:
parent
c935e381b7
commit
9c3964d330
@ -435,6 +435,11 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 getSpawnPosition() {
|
||||||
|
return BukkitAdapter.asBlockVector(getWorld().getSpawnLocation());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void simulateBlockMine(BlockVector3 pt) {
|
public void simulateBlockMine(BlockVector3 pt) {
|
||||||
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
|
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
|
||||||
|
@ -125,6 +125,11 @@ public class NullWorld extends AbstractWorld {
|
|||||||
public void setWeather(WeatherType weatherType, long duration) {
|
public void setWeather(WeatherType weatherType, long duration) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 getSpawnPosition() {
|
||||||
|
return BlockVector3.ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlock(BlockVector3 position) {
|
public BlockState getBlock(BlockVector3 position) {
|
||||||
return BlockTypes.AIR.getDefaultState();
|
return BlockTypes.AIR.getDefaultState();
|
||||||
|
@ -246,6 +246,13 @@ public interface World extends Extent {
|
|||||||
*/
|
*/
|
||||||
void setWeather(WeatherType weatherType, long duration);
|
void setWeather(WeatherType weatherType, long duration);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the spawn position of this world.
|
||||||
|
*
|
||||||
|
* @return The spawn position
|
||||||
|
*/
|
||||||
|
BlockVector3 getSpawnPosition();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean equals(Object other);
|
boolean equals(Object other);
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ final class ForgeAdapter {
|
|||||||
return Vector3.at(vector.x, vector.y, vector.z);
|
return Vector3.at(vector.x, vector.y, vector.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3 adapt(BlockPos pos) {
|
public static BlockVector3 adapt(BlockPos pos) {
|
||||||
return Vector3.at(pos.getX(), pos.getY(), pos.getZ());
|
return BlockVector3.at(pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vec3d toVec3(BlockVector3 vector) {
|
public static Vec3d toVec3(BlockVector3 vector) {
|
||||||
|
@ -469,6 +469,11 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 getSpawnPosition() {
|
||||||
|
return ForgeAdapter.adapt(getWorld().getSpawnPoint());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlock(BlockVector3 position) {
|
public BlockState getBlock(BlockVector3 position) {
|
||||||
World world = getWorld();
|
World world = getWorld();
|
||||||
|
@ -321,6 +321,11 @@ public abstract class SpongeWorld extends AbstractWorld {
|
|||||||
getWorld().setWeather(Sponge.getRegistry().getType(Weather.class, weatherType.getId()).get(), duration);
|
getWorld().setWeather(Sponge.getRegistry().getType(Weather.class, weatherType.getId()).get(), duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 getSpawnPosition() {
|
||||||
|
return SpongeAdapter.asBlockVector(getWorld().getSpawnLocation());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when the reference to the world is lost.
|
* Thrown when the reference to the world is lost.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user