Zones
Generate Minecraft worlds by map images!
You can view all Zones that are shipped with CTGen in the source code. Those zones are used by Elarth. They are also listed here:
ctgen:lake
- - lake at the sea levelctgen:river
- - river at the sea levelctgen:ocean
- - ocean at the sea levelctgen:deep_ocean
- - deep ocean at the sea levelctgen:frozen_river
- - frozen river at the sea levelctgen:frozen_lake
- - frozen lake at the sea levelctgen:stony_flats
- - flat stony areactgen:snowy_flats
- - flat snowy areactgen:snowy_slopes
- - similar to plains but with snowctgen:snowy_mountains
- - big mountains that are snowed inctgen:plains
- - plains biomectgen:forest
- - forest biomectgen:hills
- - transition between normal terrain (as taiga, plains, forest, …) andctgen:mountains
ctgen:mountains
- - big stony mountainsctgen:desert
- - desert biomectgen:badlands
- - custom badlands biomectgen:badlands_mountains
- - mountains with custom badlands biome
If you want to use any of these Zones in java, use the Zones
class:
public final class Zones {
// Northern Continent
public static final ResourceKey<Zone> STONY_FLATS = getKey("stony_flats");
public static final ResourceKey<Zone> SNOWY_FLATS = getKey("snowy_flats");
public static final ResourceKey<Zone> SNOWY_SLOPES = getKey("snowy_slopes");
public static final ResourceKey<Zone> SNOWY_MOUNTAINS = getKey("snowy_mountains");
public static final ResourceKey<Zone> FROZEN_LAKE = getKey("frozen_lake");
public static final ResourceKey<Zone> FROZEN_RIVER = getKey("frozen_river");
// Eastern Continent
public static final ResourceKey<Zone> PLAINS = getKey("plains");
public static final ResourceKey<Zone> FOREST = getKey("forest");
public static final ResourceKey<Zone> HILLS = getKey("hills");
public static final ResourceKey<Zone> MOUNTAINS = getKey("mountains");
public static final ResourceKey<Zone> LAKE = getKey("lake");
// Western Continent
public static final ResourceKey<Zone> DESERT = getKey("desert");
public static final ResourceKey<Zone> BADLANDS = getKey("badlands");
public static final ResourceKey<Zone> BADLANDS_MOUNTAINS = getKey("badlands_mountains");
// General Water Biomes
public static final ResourceKey<Zone> RIVER = getKey("river");
public static final ResourceKey<Zone> OCEAN = getKey("ocean");
public static final ResourceKey<Zone> DEEP_OCEAN = getKey("deep_ocean");
}
To register a custom zone, take a look at Starting with Data Packs.
To create a custom zone in java, use code, similar to the following:
new ZoneBuilder().setBiome(getBiome(context, Biomes.STONY_SHORE)).setColor(new Color(130, 140, 130)).setDirtBlock(Blocks.STONE).setSurfaceBlock(Blocks.STONE).setHeight(12).build();
Zones created in Java must be registered by bootstrapping them in to CTRegistries.ZONES_KEY
during the runData
task. No matter if running on Forge, Fabric or NeoForge, code similar to this one will be required:
public final class Zones {
public static final ResourceKey<Zone> OCEAN = getKey("ocean");
public static final ResourceKey<Zone> DEEP_OCEAN = getKey("deep_ocean");
public static void bootstrap(@NotNull BootstapContext<Zone> context) {
context.register(OCEAN, new ZoneBuilder().setBiome(getBiome(context, Biomes.OCEAN)).setColor(new Color(0, 42, 103)).setSurfaceBlock(Blocks.SAND).setHeight(-35).setTerrainModifier(16).setCarverModifier(26).build());
context.register(DEEP_OCEAN, new ZoneBuilder().setBiome(getBiome(context, Biomes.DEEP_OCEAN)).setColor(new Color(0, 35, 85)).setHeight(-60).setTerrainModifier(33).setCarverModifier(26).build());
}
private static @NotNull Holder<Biome> getBiome(@NotNull BootstapContext<?> context, ResourceKey<Biome> biome) {
return context.lookup(Registries.BIOME).getOrThrow(biome);
}
private static @NotNull ResourceKey<Zone> getKey(String name) {
return ResourceKey.create(CTRegistries.ZONES_KEY, new ResourceLocation(YourMod.MODID, name));
}
}
For Fabric, this code snippet is used in CTGen:
public final class CTGDataGen implements DataGeneratorEntrypoint {
private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder().add(CTRegistries.ZONES_KEY, Zones::bootstrap);
@Override
public void onInitializeDataGenerator(@NotNull FabricDataGenerator generator) {
FabricDataGenerator.Pack pack = generator.createPack();
// generate zones
pack.addProvider((FabricDataGenerator.Pack.RegistryDependentFactory<DataProvider>) (output, registriesFuture) ->
new RegistriesDatapackGenerator(output, registriesFuture.thenComposeAsync(registries -> CompletableFuture.supplyAsync(() -> {
RegistryAccess.Frozen frozen = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY);
return BUILDER.buildPatch(frozen, registries);
}))));
}
}
For Forge, it would look like the following code:
@Mod.EventBusSubscriber(modid = MyMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class DataGenerators {
@SubscribeEvent
public static void gatherData(GatherDataEvent event) {
DataGenerator generator = event.getGenerator();
PackOutput packOutput = generator.getPackOutput();
CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider();
generator.addProvider(event.includeServer(), new MyRegistryDataProvider(packOutput, lookupProvider));
}
}
public class MyRegistryDataProvider extends DatapackBuiltinEntriesProvider {
private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder().add(CTRegistries.ZONES_KEY, Zones::bootstrap);
public ModWorldGenProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> registries) {
super(output, registries, BUILDER, Set.of(AGoTMod.MOD_ID));
}
}
Continue with Preprocessing Maps