Biome source options
This commit is contained in:
parent
cc33a9138b
commit
e45f1ac064
2 changed files with 27 additions and 10 deletions
|
@ -12,24 +12,29 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
import ru.bclib.world.generator.BCLibEndBiomeSource;
|
import ru.bclib.world.generator.BCLibEndBiomeSource;
|
||||||
import ru.bclib.world.generator.BCLibNetherBiomeSource;
|
import ru.bclib.world.generator.BCLibNetherBiomeSource;
|
||||||
|
import ru.bclib.world.generator.GeneratorOptions;
|
||||||
|
|
||||||
@Mixin(value = DimensionType.class, priority = 100)
|
@Mixin(value = DimensionType.class, priority = 100)
|
||||||
public class DimensionTypeMixin {
|
public class DimensionTypeMixin {
|
||||||
@Inject(method = "defaultNetherGenerator", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "defaultNetherGenerator", at = @At("HEAD"), cancellable = true)
|
||||||
private static void be_replaceNetherBiomeSource(Registry<Biome> biomeRegistry, Registry<NoiseGeneratorSettings> chunkGeneratorSettingsRegistry, long seed, CallbackInfoReturnable<ChunkGenerator> info) {
|
private static void be_replaceNetherBiomeSource(Registry<Biome> biomeRegistry, Registry<NoiseGeneratorSettings> chunkGeneratorSettingsRegistry, long seed, CallbackInfoReturnable<ChunkGenerator> info) {
|
||||||
info.setReturnValue(new NoiseBasedChunkGenerator(
|
if (GeneratorOptions.customNetherBiomeSource()) {
|
||||||
new BCLibNetherBiomeSource(biomeRegistry, seed),
|
info.setReturnValue(new NoiseBasedChunkGenerator(
|
||||||
seed,
|
new BCLibNetherBiomeSource(biomeRegistry, seed),
|
||||||
() -> chunkGeneratorSettingsRegistry.getOrThrow(NoiseGeneratorSettings.NETHER)
|
seed,
|
||||||
));
|
() -> chunkGeneratorSettingsRegistry.getOrThrow(NoiseGeneratorSettings.NETHER)
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "defaultEndGenerator", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "defaultEndGenerator", at = @At("HEAD"), cancellable = true)
|
||||||
private static void be_replaceEndBiomeSource(Registry<Biome> biomeRegistry, Registry<NoiseGeneratorSettings> chunkGeneratorSettingsRegistry, long seed, CallbackInfoReturnable<ChunkGenerator> info) {
|
private static void be_replaceEndBiomeSource(Registry<Biome> biomeRegistry, Registry<NoiseGeneratorSettings> chunkGeneratorSettingsRegistry, long seed, CallbackInfoReturnable<ChunkGenerator> info) {
|
||||||
info.setReturnValue(new NoiseBasedChunkGenerator(
|
if (GeneratorOptions.customEndBiomeSource()) {
|
||||||
new BCLibEndBiomeSource(biomeRegistry, seed),
|
info.setReturnValue(new NoiseBasedChunkGenerator(
|
||||||
seed,
|
new BCLibEndBiomeSource(biomeRegistry, seed),
|
||||||
() -> chunkGeneratorSettingsRegistry.getOrThrow(NoiseGeneratorSettings.END)
|
seed,
|
||||||
));
|
() -> chunkGeneratorSettingsRegistry.getOrThrow(NoiseGeneratorSettings.END)
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,11 +12,15 @@ public class GeneratorOptions {
|
||||||
private static int biomeSizeEndVoid;
|
private static int biomeSizeEndVoid;
|
||||||
private static Function<Point, Boolean> endLandFunction;
|
private static Function<Point, Boolean> endLandFunction;
|
||||||
private static boolean farEndBiomes = true;
|
private static boolean farEndBiomes = true;
|
||||||
|
private static boolean customNetherBiomeSource = true;
|
||||||
|
private static boolean customEndBiomeSource = true;
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
biomeSizeNether = Configs.GENERATOR_CONFIG.getInt("nether.biomeMap", "biomeSize", 256);
|
biomeSizeNether = Configs.GENERATOR_CONFIG.getInt("nether.biomeMap", "biomeSize", 256);
|
||||||
biomeSizeEndLand = Configs.GENERATOR_CONFIG.getInt("end.biomeMap", "biomeSizeLand", 256);
|
biomeSizeEndLand = Configs.GENERATOR_CONFIG.getInt("end.biomeMap", "biomeSizeLand", 256);
|
||||||
biomeSizeEndVoid = Configs.GENERATOR_CONFIG.getInt("end.biomeMap", "biomeSizeVoid", 256);
|
biomeSizeEndVoid = Configs.GENERATOR_CONFIG.getInt("end.biomeMap", "biomeSizeVoid", 256);
|
||||||
|
customNetherBiomeSource = Configs.GENERATOR_CONFIG.getBoolean("options", "customNetherBiomeSource", true);
|
||||||
|
customEndBiomeSource = Configs.GENERATOR_CONFIG.getBoolean("options", "customEndBiomeSource", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getBiomeSizeNether() {
|
public static int getBiomeSizeNether() {
|
||||||
|
@ -46,4 +50,12 @@ public class GeneratorOptions {
|
||||||
public static void setFarEndBiomes(boolean farEndBiomes) {
|
public static void setFarEndBiomes(boolean farEndBiomes) {
|
||||||
GeneratorOptions.farEndBiomes = farEndBiomes;
|
GeneratorOptions.farEndBiomes = farEndBiomes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean customNetherBiomeSource() {
|
||||||
|
return customNetherBiomeSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean customEndBiomeSource() {
|
||||||
|
return customEndBiomeSource;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue