Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow the center of the map to be configured #25

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.List;
import java.util.Map;
import net.pl3x.map.core.Pl3xMap;
import net.pl3x.map.core.markers.Point;
import net.pl3x.map.core.markers.area.Area;
import net.pl3x.map.core.markers.area.Border;
import net.pl3x.map.core.util.Mathf;
Expand Down Expand Up @@ -151,6 +152,15 @@ Normal sized tiles (1 pixel = 1 block) are
Visible areas of the world.""")
public List<Area> VISIBLE_AREAS = new ArrayList<>(); // defaults added in ctor

@Key("render.center.x")
@Comment("""
Center of the world. Defaults to spawn if -0.0""")
public double CENTER_X = -0.0;

@Key("render.center.z")
public double CENTER_Z = -0.0;


private final World world;

public WorldConfig(@NotNull World world) {
Expand All @@ -165,6 +175,11 @@ public WorldConfig(@NotNull World world) {
public void reload() {
reload(Pl3xMap.api().getMainDir().resolve("config.yml"), WorldConfig.class);

if (CENTER_X == -0.0 && CENTER_Z == -0.0) {
CENTER_X = world.getSpawn().x();
CENTER_Z = world.getSpawn().z();
}

RENDER_BIOME_BLEND = Mathf.clamp(0, 7, RENDER_BIOME_BLEND);
RENDER_SKYLIGHT = Mathf.clamp(0, 15, RENDER_SKYLIGHT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private void process(@NotNull World world, @NotNull Collection<@NotNull Point> r
Logger.debug(world.getName() + " Region processor started processing at " + System.currentTimeMillis());

// create spiral iterator to order region scanning
Point spawn = world.getSpawn();
Point spawn = world.getCenter();
SpiralIterator spiralIterator = new SpiralIterator(spawn.x() >> 9, spawn.z() >> 9);

// order preserved map of regions with boolean to signify if it was already scanned
Expand Down
Loading
Loading