use of org.pepsoft.worldpainter.World2 in project WorldPainter by Captain-Chaos.
the class SetSpawnPoint method tick.
@Override
protected void tick(int centreX, int centreY, boolean inverse, boolean first, float dynamicLevel) {
if (first) {
Dimension dimension = getDimension();
if ((dimension.getDim() != Constants.DIM_NORMAL) && (dimension.getDim() != Constants.DIM_NORMAL_CEILING)) {
throw new IllegalArgumentException("Cannot set spawn point on dimensions other than 0");
}
World2 world = dimension.getWorld();
int spawnHeight = dimension.getIntHeightAt(centreX, centreY);
if (spawnHeight == -1) {
// No tile
if (JOptionPane.showConfirmDialog(getView(), "<html>Are you sure you want to set the spawn <em>outside</em> the boundary of the world?</html>") != JOptionPane.OK_OPTION) {
return;
}
}
world.setSpawnPoint(new Point(centreX, centreY));
}
}
Aggregations