mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 22:31:52 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
# biome-provider-single
|
||||||
|
|
||||||
|
Registers and configures the `SINGLE` biome provider, a biome provider which
|
||||||
|
accepts a single biome to generate continuously.
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
dependencies {
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
package com.dfsek.terra.addons.biome.single;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.world.biome.TerraBiome;
|
||||||
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
|
|
||||||
|
|
||||||
|
public class SingleBiomeProvider implements BiomeProvider {
|
||||||
|
private final TerraBiome biome;
|
||||||
|
|
||||||
|
public SingleBiomeProvider(TerraBiome biome) {
|
||||||
|
this.biome = biome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TerraBiome getBiome(int x, int z, long seed) {
|
||||||
|
return biome;
|
||||||
|
}
|
||||||
|
}
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
package com.dfsek.terra.addons.biome.single;
|
||||||
|
|
||||||
|
import com.dfsek.tectonic.loading.object.ObjectTemplate;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.Platform;
|
||||||
|
import com.dfsek.terra.api.addon.TerraAddon;
|
||||||
|
import com.dfsek.terra.api.addon.annotations.Addon;
|
||||||
|
import com.dfsek.terra.api.addon.annotations.Author;
|
||||||
|
import com.dfsek.terra.api.addon.annotations.Version;
|
||||||
|
import com.dfsek.terra.api.event.events.config.pack.ConfigPackPreLoadEvent;
|
||||||
|
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
||||||
|
import com.dfsek.terra.api.inject.annotations.Inject;
|
||||||
|
import com.dfsek.terra.api.registry.CheckedRegistry;
|
||||||
|
import com.dfsek.terra.api.util.reflection.TypeKey;
|
||||||
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
|
|
||||||
|
|
||||||
|
@Addon("biome-provider-single")
|
||||||
|
@Author("Terra")
|
||||||
|
@Version("1.0.0")
|
||||||
|
public class SingleBiomeProviderAddon extends TerraAddon {
|
||||||
|
public static final TypeKey<Supplier<ObjectTemplate<BiomeProvider>>> PROVIDER_REGISTRY_KEY = new TypeKey<>() {
|
||||||
|
};
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Platform platform;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
platform.getEventManager()
|
||||||
|
.getHandler(FunctionalEventHandler.class)
|
||||||
|
.register(this, ConfigPackPreLoadEvent.class)
|
||||||
|
.then(event -> {
|
||||||
|
CheckedRegistry<Supplier<ObjectTemplate<BiomeProvider>>> providerRegistry = event.getPack().getOrCreateRegistry(
|
||||||
|
PROVIDER_REGISTRY_KEY);
|
||||||
|
providerRegistry.register("SINGLE", SingleBiomeProviderTemplate::new);
|
||||||
|
})
|
||||||
|
.failThrough();
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.dfsek.terra.addons.biome.single;
|
||||||
|
|
||||||
|
import com.dfsek.tectonic.annotations.Value;
|
||||||
|
import com.dfsek.tectonic.loading.object.ObjectTemplate;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.config.meta.Meta;
|
||||||
|
import com.dfsek.terra.api.world.biome.TerraBiome;
|
||||||
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
|
|
||||||
|
|
||||||
|
public class SingleBiomeProviderTemplate implements ObjectTemplate<BiomeProvider> {
|
||||||
|
@Value("biome")
|
||||||
|
private @Meta TerraBiome biome;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BiomeProvider get() {
|
||||||
|
return new SingleBiomeProvider(biome);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user