Skip to content

Commit

Permalink
Merge pull request #70 from TownyAdvanced/configurable_biome_lookup_s…
Browse files Browse the repository at this point in the history
…leep

Added conigurable sleep for looking up the biome in the lv job
  • Loading branch information
Goosius1 committed Jul 7, 2023
2 parents 444f3b6 + b18f86a commit c7e3e0c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.townyadvanced</groupId>
<artifactId>TownyProvinces</artifactId>
<version>1.11.0</version>
<version>1.11.1</version>
<name>townyprovinces</name> <!-- Leave lower-cased -->

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ public enum ConfigNodes {
"",
"# The name of the world where TownyProvinces appplies.",
"# TownyProvinces does not yet support multiple worlds"),
PAUSE_MILLISECONDS_BETWEEN_BIOME_LOOKUPS(
"pause_milliseconds_between_biome_lookups",
"500",
"",
"# Governs the pause between biome lookups.",
"# A high value will make the landvalidation job run slow",
"# A low value will make the landvalidation job take up lots of CPU"),
BIOME_COST_ADJUSTMENTS(
"biome_cost_adjustments",
"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ public static double getLandProvinceBorderOpacity() {
return Settings.getDouble(ConfigNodes.LAND_PROVINCE_BORDER_OPACITY);
}

public static int getPauseMillisecondsBetweenBiomeLookups() {
return Settings.getInt(ConfigNodes.PAUSE_MILLISECONDS_BETWEEN_BIOME_LOOKUPS);
}

public static int getLandProvinceBorderColour() {
return Integer.parseInt(Settings.getString(ConfigNodes.LAND_PROVINCE_BORDER_COLOUR),16);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static BiomeType getBiomeType(World world, TPCoord coordToTest) {
int z = (coordToTest.getZ() * TownyProvincesSettings.getChunkSideLength()) + 8;
Material material = world.getHighestBlockAt(x,z).getType();
try {
Thread.sleep(100); //Sleep because the biome lookup can be hard on processor
Thread.sleep(TownyProvincesSettings.getPauseMillisecondsBetweenBiomeLookups()); //Sleep because the biome lookup can be hard on processor
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit c7e3e0c

Please sign in to comment.