mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 08:25:31 +00:00
create and register RandomLocatorTemplate
This commit is contained in:
parent
137206884c
commit
7b9a473275
@ -1,6 +1,7 @@
|
||||
package com.dfsek.terra.addons.feature.locator;
|
||||
|
||||
import com.dfsek.tectonic.loading.object.ObjectTemplate;
|
||||
import com.dfsek.terra.addons.feature.locator.config.RandomLocatorTemplate;
|
||||
import com.dfsek.terra.addons.feature.locator.config.SurfaceLocatorTemplate;
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.addon.TerraAddon;
|
||||
@ -33,5 +34,6 @@ public class LocatorAddon extends TerraAddon implements EventListener {
|
||||
public void onPackLoad(ConfigPackPreLoadEvent event) {
|
||||
CheckedRegistry<Supplier<ObjectTemplate<Locator>>> locatorRegistry = event.getPack().getOrCreateRegistry(LOCATOR_TOKEN);
|
||||
locatorRegistry.register("SURFACE", () -> new SurfaceLocatorTemplate(main));
|
||||
locatorRegistry.register("RANDOM", RandomLocatorTemplate::new);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.dfsek.terra.addons.feature.locator.config;
|
||||
|
||||
import com.dfsek.tectonic.annotations.Value;
|
||||
import com.dfsek.tectonic.loading.object.ObjectTemplate;
|
||||
import com.dfsek.terra.addons.feature.locator.locators.RandomLocator;
|
||||
import com.dfsek.terra.addons.feature.locator.locators.SurfaceLocator;
|
||||
import com.dfsek.terra.api.structure.feature.Locator;
|
||||
import com.dfsek.terra.api.util.Range;
|
||||
|
||||
public class RandomLocatorTemplate implements ObjectTemplate<Locator> {
|
||||
@Value("height")
|
||||
private Range height;
|
||||
|
||||
@Value("amount")
|
||||
private Range amount;
|
||||
|
||||
@Override
|
||||
public Locator get() {
|
||||
return new RandomLocator(height, amount);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user