Skip to content

Commit

Permalink
Fixed issue with chunks not generating
Browse files Browse the repository at this point in the history
  • Loading branch information
DavixDevelop committed Mar 5, 2022
1 parent d4a181a commit 7a25b1b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 22 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
- [0.2.5](https://github.com/DavixDevelop/terracustomtreerepo/releases/tag/0.2.5)
- Compatibility bump to TerraPlusPlus 1.1.0.627+ (Because of update to PorkLib)
- Changed versioning to `0.2.5.[GitHub commit count]`
- Fixed issue with the addon making the server unresponsive, blocking terrain generation or both. The issue lied within the `SegmentsBaker:requestData` method, which is a non-blocking method. <br>To be more precise the `requestData` method was first making a request to get the tree cover data. After requesting the data, it tried to read the data withing the same method (via `CompletableFuture<T>:join`), therefore blocking the thread, and sequentially blocking new chunks from generating.

`Release note:`
> Use this version for post TerraPlusPlus 1.1.0.627 releases
- [0.2.4](https://github.com/DavixDevelop/terracustomtreerepo/releases/tag/0.2.4)
- Removed builtin datasets and switched to a [common library mod](https://github.com/DavixDevelop/terracommondatasets)
- Fixed issue with a dependency of ForgeGradle being compiled against JDK 11 (and not JDK 8), by switching to the https://maven.daporkchop.net repository
- Fixed wrong index (227-> 127) to tree in tree_meta csv file
- Version number now includes commit count for easier management
- Removed jcenter

`Release note:`
> Use this version for pre TerraPlusPlus 1.1.0.627 releases
- [0.2.3](https://github.com/DavixDevelop/terracustomtreerepo/releases/tag/0.2.3)
- Fixed an error in the Custom Tree Repository that caused crashes
- Removed old precompiled low-resolution CSV based treemap
- Implemented higher resolution Koppen climate dataset
Implemented moderate resolution continents dataset
- Implemented an on-the-fly treemap with a custom tree baker, based on the two aforementioned dataset

`Release note:`
> It's not recommended using this version combined with the new Terra++ Improved Biomes addon as of right now, due to the new biomes (ex. Dark Forest).
- [0.2.2](https://github.com/DavixDevelop/terracustomtreerepo/releases/tag/0.2.2)
- Compatibility patch for TerraPlusPlus 0.1.522+
- [0.2](https://github.com/DavixDevelop/terracustomtreerepo/releases/tag/0.2)
- Beta release
- Updated to reflect recent merge from fast-osm branch
- Increased tree density and further fixes
- Further, increased density, further randomized trees and changed limit for small and large trees
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'


version = "0.2.4-" + ('git rev-list --count HEAD'.execute().text.trim())
version = "0.2.5." + ('git rev-list --count HEAD'.execute().text.trim())
group = "com.davixdevelop.terracustomtreerepo"
archivesBaseName = "terracustomtreerepo"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.apache.logging.log4j.Logger;

@Mod(modid = TerraTreeRepoMod.MODID,
dependencies = "after:terracommondatasets@[0.2,);required-after:terraplusplus@[0.1.627,)",
dependencies = "required-after:terracommondatasets@[0.3,);required-after:terraplusplus@[0.1.627,)",
acceptableRemoteVersions = "*",
useMetadata = true)
public class TerraTreeRepoMod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.buildtheearth.terraplusplus.dataset.IScalarDataset;
import net.buildtheearth.terraplusplus.dataset.geojson.GeoJsonObject;
import net.buildtheearth.terraplusplus.dataset.geojson.Geometry;
import net.buildtheearth.terraplusplus.dataset.geojson.dataset.TiledGeoJsonDataset;
import net.buildtheearth.terraplusplus.dataset.geojson.geometry.*;
import net.buildtheearth.terraplusplus.dataset.geojson.object.Feature;
import net.buildtheearth.terraplusplus.dataset.geojson.object.FeatureCollection;
Expand Down Expand Up @@ -44,8 +45,8 @@ public class SegmentsBaker implements IEarthDataBaker<GeoJsonObject[][]>{
public static final Set<Set<SegmentLinearFunc>> FALLBACK_CUSTOM_TREE_REPO_POLYGONS = new HashSet<>();

@Override
public void bake(ChunkPos pos, Builder builder, GeoJsonObject[][] rawGsonObjects) {
if(rawGsonObjects == null)
public void bake(ChunkPos pos, Builder builder, GeoJsonObject[][] data) {
if(data == null)
return;

List<RawSegments> buildings = new ArrayList<>();
Expand All @@ -61,7 +62,7 @@ public void bake(ChunkPos pos, Builder builder, GeoJsonObject[][] rawGsonObjects
chunkBounds = chunkBounds.expand(16.0d);

try {
for(GeoJsonObject[] objects : rawGsonObjects) {
for(GeoJsonObject[] objects : data) {
for(GeoJsonObject object : objects) {
if(object instanceof Feature) {
Feature feature = (Feature) object;
Expand Down Expand Up @@ -104,23 +105,7 @@ public CompletableFuture<GeoJsonObject[][]> requestData(ChunkPos pos, GeneratorD
if(PROJECTION == null)
PROJECTION = datasets.projection();

CompletableFuture<double[]> treeCoverF = datasets.<IScalarDataset>getCustom(EarthGeneratorPipelines.KEY_DATASET_TREE_COVER).getAsync(boundsGeo, 16, 16);
boolean hasTrees = false;

double[] treeCover = treeCoverF.join();
if(treeCover != null){
for (double v : treeCover)
if (v > 0.0d) {
hasTrees = true;
break;
}
}


if(!hasTrees)
return null;

return datasets.<IElementDataset<GeoJsonObject[]>>getCustom(EarthGeneratorPipelines.KEY_DATASET_OSM_RAW)
return datasets.<TiledGeoJsonDataset>getCustom(EarthGeneratorPipelines.KEY_DATASET_OSM_RAW)
.getAsync(bounds.expand(16.0d).toCornerBB(datasets.projection(), false).toGeo());
}

Expand Down

0 comments on commit 7a25b1b

Please sign in to comment.