create and register GaussianRandomLocatorTemplate

This commit is contained in:
dfsek
2021-12-15 21:59:32 -07:00
parent 7305236724
commit 1fc139cc8c
2 changed files with 39 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import java.util.function.Supplier;
import com.dfsek.terra.addons.feature.locator.config.AndLocatorTemplate;
import com.dfsek.terra.addons.feature.locator.config.GaussianRandomLocatorTemplate;
import com.dfsek.terra.addons.feature.locator.config.Noise3DLocatorTemplate;
import com.dfsek.terra.addons.feature.locator.config.NoiseLocatorTemplate;
import com.dfsek.terra.addons.feature.locator.config.OrLocatorTemplate;
@@ -57,8 +58,12 @@ public class LocatorAddon implements AddonInitializer {
.then(event -> {
CheckedRegistry<Supplier<ObjectTemplate<Locator>>> locatorRegistry = event.getPack().getOrCreateRegistry(LOCATOR_TOKEN);
locatorRegistry.register("SURFACE", () -> new SurfaceLocatorTemplate(platform));
locatorRegistry.register("RANDOM", RandomLocatorTemplate::new);
locatorRegistry.register("GAUSSIAN_RANDOM", GaussianRandomLocatorTemplate::new);
locatorRegistry.register("PATTERN", PatternLocatorTemplate::new);
locatorRegistry.register("NOISE", NoiseLocatorTemplate::new);
locatorRegistry.register("NOISE_3D", Noise3DLocatorTemplate::new);

View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2020-2021 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
*/
package com.dfsek.terra.addons.feature.locator.config;
import com.dfsek.tectonic.api.config.template.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import com.dfsek.terra.addons.feature.locator.locators.GaussianRandomLocator;
import com.dfsek.terra.addons.feature.locator.locators.RandomLocator;
import com.dfsek.terra.api.config.meta.Meta;
import com.dfsek.terra.api.structure.feature.Locator;
import com.dfsek.terra.api.util.Range;
public class GaussianRandomLocatorTemplate implements ObjectTemplate<Locator> {
@Value("height")
private @Meta Range height;
@Value("amount")
private @Meta Range amount;
@Value("standard-deviation")
private double standardDeviation;
@Override
public Locator get() {
return new GaussianRandomLocator(height, amount, standardDeviation);
}
}