mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-07 16:26:13 +00:00
create and register GaussianRandomLocatorTemplate
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user