- require min depth for shipwrecks
- added tall_birch biomes to custom trees list - further tweaking to ore gen better replicate vanilla - tweak structure settings defaults
This commit is contained in:
parent
43ef4e955c
commit
38a55e9feb
|
@ -75,11 +75,11 @@ public class RegionGenerator implements RegionExtent {
|
|||
}
|
||||
|
||||
public CompletableFuture<Region> generate(int regionX, int regionZ) {
|
||||
return CompletableFuture.supplyAsync(() -> generateRegion(regionX, regionZ), threadPool);
|
||||
return CompletableFuture.supplyAsync(() -> generateRegion(regionX, regionZ));
|
||||
}
|
||||
|
||||
public CompletableFuture<Region> generate(float centerX, float centerZ, float zoom, boolean filter) {
|
||||
return CompletableFuture.supplyAsync(() -> generateRegion(centerX, centerZ, zoom, filter), threadPool);
|
||||
return CompletableFuture.supplyAsync(() -> generateRegion(centerX, centerZ, zoom, filter));
|
||||
}
|
||||
|
||||
public Region generateRegion(int regionX, int regionZ) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020 TerraForged
|
||||
|
@ -27,14 +27,15 @@ package com.terraforged.core.util.concurrent;
|
|||
|
||||
import com.terraforged.core.util.concurrent.batcher.AsyncBatcher;
|
||||
import com.terraforged.core.util.concurrent.batcher.Batcher;
|
||||
import com.terraforged.core.util.concurrent.batcher.SyncBatcher;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ThreadPool implements Executor {
|
||||
|
||||
|
@ -42,7 +43,7 @@ public class ThreadPool implements Executor {
|
|||
|
||||
private static final Object lock = new Object();
|
||||
|
||||
private static ThreadPool instance = new ThreadPool();
|
||||
private static ThreadPool instance = new ThreadPool(defaultPoolSize());
|
||||
|
||||
private final int poolSize;
|
||||
private final ExecutorService service;
|
||||
|
@ -53,8 +54,8 @@ public class ThreadPool implements Executor {
|
|||
}
|
||||
|
||||
public ThreadPool(int size) {
|
||||
this.service = Executors.newFixedThreadPool(size);
|
||||
this.poolSize = size;
|
||||
this.service = ThreadPool.createService(size);
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
|
@ -77,9 +78,6 @@ public class ThreadPool implements Executor {
|
|||
}
|
||||
|
||||
public Batcher batcher(int size) {
|
||||
if (this.poolSize != -1 && this.poolSize < 3) {
|
||||
return new SyncBatcher();
|
||||
}
|
||||
return new AsyncBatcher(service, size);
|
||||
}
|
||||
|
||||
|
@ -122,6 +120,19 @@ public class ThreadPool implements Executor {
|
|||
|
||||
private static int defaultPoolSize() {
|
||||
int threads = Runtime.getRuntime().availableProcessors();
|
||||
return Math.max(2, (int) ((threads / 3F) * 2));
|
||||
return Math.max(2, (int) (threads / 3F) * 2);
|
||||
}
|
||||
|
||||
private static ExecutorService createService(int size) {
|
||||
ThreadPoolExecutor service = new ThreadPoolExecutor(
|
||||
size,
|
||||
size,
|
||||
30,
|
||||
TimeUnit.SECONDS,
|
||||
new LinkedBlockingQueue<>(),
|
||||
new ThreadPoolFactory()
|
||||
);
|
||||
service.allowCoreThreadTimeOut(true);
|
||||
return service;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.terraforged.core.util.concurrent;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
// As DefaultThreadPool but with custom thread names
|
||||
public class ThreadPoolFactory implements ThreadFactory {
|
||||
|
||||
private final ThreadGroup group;
|
||||
private final AtomicInteger threadNumber = new AtomicInteger(1);
|
||||
|
||||
public ThreadPoolFactory() {
|
||||
group = Thread.currentThread().getThreadGroup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable task) {
|
||||
Thread thread = new Thread(group, task);
|
||||
thread.setDaemon(true);
|
||||
thread.setName("TerraForged-Worker-" + threadNumber.getAndIncrement());
|
||||
return thread;
|
||||
}
|
||||
}
|
|
@ -43,9 +43,9 @@ import com.terraforged.feature.matcher.dynamic.DynamicMatcher;
|
|||
import com.terraforged.feature.matcher.feature.FeatureMatcher;
|
||||
import com.terraforged.feature.modifier.FeatureModifierLoader;
|
||||
import com.terraforged.feature.modifier.FeatureModifiers;
|
||||
import com.terraforged.feature.predicate.BiomePredicate;
|
||||
import com.terraforged.feature.predicate.DeepWater;
|
||||
import com.terraforged.feature.predicate.FeaturePredicate;
|
||||
import com.terraforged.feature.predicate.MinDepth;
|
||||
import com.terraforged.feature.predicate.MinHeight;
|
||||
import com.terraforged.feature.template.type.FeatureTypes;
|
||||
import com.terraforged.mod.Log;
|
||||
|
@ -312,7 +312,7 @@ public class TerraChunkGenerator extends ObfHelperChunkGenerator<GenerationSetti
|
|||
modifiers.getPredicates().add(FeatureMatcher.of(Feature.SPRING_FEATURE), FeaturePredicate.DENY);
|
||||
|
||||
// limit to deep oceans
|
||||
modifiers.getPredicates().add(FeatureMatcher.of(Feature.SHIPWRECK), BiomePredicate.oceans());
|
||||
modifiers.getPredicates().add(FeatureMatcher.of(Feature.SHIPWRECK), MinDepth.DEPTH55);
|
||||
modifiers.getPredicates().add(FeatureMatcher.of(Feature.OCEAN_RUIN), DeepWater.INSTANCE);
|
||||
modifiers.getPredicates().add(FeatureMatcher.of(Feature.OCEAN_MONUMENT), DeepWater.INSTANCE);
|
||||
|
||||
|
|
|
@ -38,25 +38,25 @@ public class StructureSettings {
|
|||
|
||||
@Range(min = 1, max = 10)
|
||||
@Comment("Controls the distance between mansions")
|
||||
public int mansionDistance = 2;
|
||||
public int mansionDistance = 3;
|
||||
|
||||
@Range(min = 1, max = 10)
|
||||
@Comment("Controls the distance between strongholds")
|
||||
public int strongholdDistance = 2;
|
||||
public int strongholdDistance = 3;
|
||||
|
||||
@Range(min = 1, max = 10)
|
||||
@Comment("Controls the distance between strongholds")
|
||||
public int strongholdSpread = 2;
|
||||
public int strongholdSpread = 3;
|
||||
|
||||
@Range(min = 1, max = 10)
|
||||
@Comment("Controls the distance between biome structures")
|
||||
public int biomeStructureDistance = 2;
|
||||
public int biomeStructureDistance = 4;
|
||||
|
||||
@Range(min = 1, max = 10)
|
||||
@Comment("Controls the distance between ocean monuments")
|
||||
public int oceanMonumentSpacing = 2;
|
||||
public int oceanMonumentSpacing = 3;
|
||||
|
||||
@Range(min = 1, max = 10)
|
||||
@Comment("Controls the separation between ocean monuments")
|
||||
public int oceanMonumentSeparation = 2;
|
||||
public int oceanMonumentSeparation = 3;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"feature": {
|
||||
"name": "minecraft:ore",
|
||||
"config": {
|
||||
"size": 20,
|
||||
"size": 16,
|
||||
"target": "natural_stone",
|
||||
"state": {
|
||||
"Name": "minecraft:coal_ore"
|
||||
|
@ -21,10 +21,10 @@
|
|||
"decorator": {
|
||||
"name": "minecraft:count_range",
|
||||
"config": {
|
||||
"count": 24,
|
||||
"count": 18,
|
||||
"bottom_offset": 0,
|
||||
"top_offset": 0,
|
||||
"maximum": 154
|
||||
"maximum": 140
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"feature": {
|
||||
"name": "minecraft:ore",
|
||||
"config": {
|
||||
"size": 10,
|
||||
"size": 8,
|
||||
"target": "natural_stone",
|
||||
"state": {
|
||||
"Name": "minecraft:diamond_ore"
|
||||
|
@ -24,7 +24,7 @@
|
|||
"count": 1,
|
||||
"bottom_offset": 0,
|
||||
"top_offset": 0,
|
||||
"maximum": 19
|
||||
"maximum": 18
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"feature": {
|
||||
"name": "minecraft:ore",
|
||||
"config": {
|
||||
"size": 11,
|
||||
"size": 9,
|
||||
"target": "natural_stone",
|
||||
"state": {
|
||||
"Name": "minecraft:gold_ore"
|
||||
|
@ -21,10 +21,10 @@
|
|||
"decorator": {
|
||||
"name": "minecraft:count_range",
|
||||
"config": {
|
||||
"count": 2,
|
||||
"count": 3,
|
||||
"bottom_offset": 0,
|
||||
"top_offset": 0,
|
||||
"maximum": 38
|
||||
"maximum": 35
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
"feature": {
|
||||
"name": "minecraft:ore",
|
||||
"config": {
|
||||
"size": 11,
|
||||
"size": 9,
|
||||
"target": "natural_stone",
|
||||
"state": {
|
||||
"Name": "minecraft:gold_ore"
|
||||
|
@ -28,10 +28,10 @@
|
|||
"decorator": {
|
||||
"name": "minecraft:count_range",
|
||||
"config": {
|
||||
"count": 24,
|
||||
"bottom_offset": 38,
|
||||
"top_offset": 38,
|
||||
"maximum": 96
|
||||
"count": 22,
|
||||
"bottom_offset": 35,
|
||||
"top_offset": 35,
|
||||
"maximum": 90
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"feature": {
|
||||
"name": "minecraft:ore",
|
||||
"config": {
|
||||
"size": 11,
|
||||
"size": 9,
|
||||
"target": "natural_stone",
|
||||
"state": {
|
||||
"Name": "minecraft:iron_ore"
|
||||
|
@ -24,7 +24,7 @@
|
|||
"count": 24,
|
||||
"bottom_offset": 0,
|
||||
"top_offset": 0,
|
||||
"maximum": 90
|
||||
"maximum": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"feature": {
|
||||
"name": "minecraft:ore",
|
||||
"config": {
|
||||
"size": 8,
|
||||
"size": 7,
|
||||
"target": "natural_stone",
|
||||
"state": {
|
||||
"Name": "minecraft:lapis_ore"
|
||||
|
@ -22,8 +22,8 @@
|
|||
"name": "minecraft:count_depth_average",
|
||||
"config": {
|
||||
"count": 1,
|
||||
"baseline": 19,
|
||||
"spread": 19
|
||||
"baseline": 18,
|
||||
"spread": 18
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"feature": {
|
||||
"name": "minecraft:ore",
|
||||
"config": {
|
||||
"size": 10,
|
||||
"size": 8,
|
||||
"target": "natural_stone",
|
||||
"state": {
|
||||
"Name": "minecraft:redstone_ore",
|
||||
|
@ -24,10 +24,10 @@
|
|||
"decorator": {
|
||||
"name": "minecraft:count_range",
|
||||
"config": {
|
||||
"count": 10,
|
||||
"count": 8,
|
||||
"bottom_offset": 0,
|
||||
"top_offset": 0,
|
||||
"maximum": 19
|
||||
"maximum": 18
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"biomes": [
|
||||
"minecraft:birch_forest*"
|
||||
"minecraft:birch*",
|
||||
"minecraft:tall_birch*"
|
||||
],
|
||||
"match": [
|
||||
[
|
||||
|
|
Loading…
Reference in New Issue