Continue mapping migration

This commit is contained in:
Aleksey 2021-04-12 21:38:22 +03:00
parent 99ade39404
commit f03fd03bd0
499 changed files with 12567 additions and 12723 deletions

View file

@ -1,55 +1,51 @@
package ru.betterend.world.surface;
import java.util.Random;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.core.Registry;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.surfacebuilder.ConfiguredSurfaceBuilder;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilder.TernarySurfaceConfig;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.levelgen.surfacebuilders.ConfiguredSurfaceBuilder;
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilder;
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderBaseConfiguration;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.util.MHelper;
public class DoubleBlockSurfaceBuilder extends SurfaceBuilder<TernarySurfaceConfig> {
public class DoubleBlockSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderBaseConfiguration> {
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(4141);
private TernarySurfaceConfig config1;
private TernarySurfaceConfig config2;
private SurfaceBuilderBaseConfiguration config1;
private SurfaceBuilderBaseConfiguration config2;
private DoubleBlockSurfaceBuilder() {
super(TernarySurfaceConfig.CODEC);
super(SurfaceBuilderBaseConfiguration.CODEC);
}
public DoubleBlockSurfaceBuilder setBlock1(Block block) {
BlockState stone = Blocks.END_STONE.defaultBlockState();
config1 = new TernarySurfaceConfig(block.defaultBlockState(), stone, stone);
config1 = new SurfaceBuilderBaseConfiguration(block.defaultBlockState(), stone, stone);
return this;
}
public DoubleBlockSurfaceBuilder setBlock2(Block block) {
BlockState stone = Blocks.END_STONE.defaultBlockState();
config2 = new TernarySurfaceConfig(block.defaultBlockState(), stone, stone);
config2 = new SurfaceBuilderBaseConfiguration(block.defaultBlockState(), stone, stone);
return this;
}
@Override
public void generate(Random random, Chunk chunk, Biome biome, int x, int z, int height, double noise,
BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed,
TernarySurfaceConfig surfaceBlocks) {
public void apply(Random random, ChunkAccess chunk, Biome biome, int x, int z, int height, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderBaseConfiguration surfaceBlocks) {
noise = NOISE.eval(x * 0.1, z * 0.1) + MHelper.randRange(-0.4, 0.4, random);
SurfaceBuilder.DEFAULT.generate(random, chunk, biome, x, z, height, noise, defaultBlock, defaultFluid, seaLevel,
seed, noise > 0 ? config1 : config2);
SurfaceBuilder.DEFAULT.apply(random, chunk, biome, x, z, height, noise, defaultBlock, defaultFluid, seaLevel, seed, noise > 0 ? config1 : config2);
}
public static DoubleBlockSurfaceBuilder register(String name) {
return Registry.register(Registry.SURFACE_BUILDER, name, new DoubleBlockSurfaceBuilder());
}
public ConfiguredSurfaceBuilder<TernarySurfaceConfig> configured() {
public ConfiguredSurfaceBuilder<SurfaceBuilderBaseConfiguration> configured() {
BlockState stone = Blocks.END_STONE.defaultBlockState();
return this.withConfig(new TernarySurfaceConfig(config1.getTopMaterial(), stone, stone));
return this.configured(new SurfaceBuilderBaseConfiguration(config1.getTopMaterial(), stone, stone));
}
}

View file

@ -1,44 +1,39 @@
package ru.betterend.world.surface;
import java.util.Random;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.Registry;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilder.TernarySurfaceConfig;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilder;
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderBaseConfiguration;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.util.MHelper;
public class SulphuricSurfaceBuilder extends SurfaceBuilder<TernarySurfaceConfig> {
public class SulphuricSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderBaseConfiguration> {
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(5123);
public SulphuricSurfaceBuilder() {
super(TernarySurfaceConfig.CODEC);
super(SurfaceBuilderBaseConfiguration.CODEC);
}
@Override
public void generate(Random random, Chunk chunk, Biome biome, int x, int z, int height, double noise,
BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed,
TernarySurfaceConfig surfaceBlocks) {
double value = NOISE.eval(x * 0.03, z * 0.03) + NOISE.eval(x * 0.1, z * 0.1) * 0.3
+ MHelper.randRange(-0.1, 0.1, MHelper.RANDOM);
public void apply(Random random, ChunkAccess chunk, Biome biome, int x, int z, int height, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderBaseConfiguration surfaceBlocks) {
double value = NOISE.eval(x * 0.03, z * 0.03) + NOISE.eval(x * 0.1, z * 0.1) * 0.3 + MHelper.randRange(-0.1, 0.1, MHelper.RANDOM);
if (value < -0.6) {
SurfaceBuilder.DEFAULT.generate(random, chunk, biome, x, z, height, noise, defaultBlock, defaultFluid,
seaLevel, seed, SurfaceBuilders.DEFAULT_END_CONFIG);
} else if (value < -0.3) {
SurfaceBuilder.DEFAULT.generate(random, chunk, biome, x, z, height, noise, defaultBlock, defaultFluid,
seaLevel, seed, SurfaceBuilders.FLAVOLITE_CONFIG);
} else if (value < 0.5) {
SurfaceBuilder.DEFAULT.generate(random, chunk, biome, x, z, height, noise, defaultBlock, defaultFluid,
seaLevel, seed, SurfaceBuilders.SULFURIC_ROCK_CONFIG);
} else {
SurfaceBuilder.DEFAULT.generate(random, chunk, biome, x, z, height, noise, defaultBlock, defaultFluid,
seaLevel, seed, SurfaceBuilders.BRIMSTONE_CONFIG);
SurfaceBuilder.DEFAULT.apply(random, chunk, biome, x, z, height, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilders.DEFAULT_END_CONFIG);
}
else if (value < -0.3) {
SurfaceBuilder.DEFAULT.apply(random, chunk, biome, x, z, height, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilders.FLAVOLITE_CONFIG);
}
else if (value < 0.5) {
SurfaceBuilder.DEFAULT.apply(random, chunk, biome, x, z, height, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilders.SULFURIC_ROCK_CONFIG);
}
else {
SurfaceBuilder.DEFAULT.apply(random, chunk, biome, x, z, height, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilders.BRIMSTONE_CONFIG);
}
}
public static SulphuricSurfaceBuilder register(String name) {
return Registry.register(Registry.SURFACE_BUILDER, name, new SulphuricSurfaceBuilder());
}

View file

@ -1,32 +1,29 @@
package ru.betterend.world.surface;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.core.Registry;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilder.TernarySurfaceConfig;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilder;
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderBaseConfiguration;
import ru.betterend.registry.EndBlocks;
public class SurfaceBuilders {
public static final TernarySurfaceConfig DEFAULT_END_CONFIG = makeSimpleConfig(Blocks.END_STONE);
public static final TernarySurfaceConfig FLAVOLITE_CONFIG = makeSimpleConfig(EndBlocks.FLAVOLITE.stone);
public static final TernarySurfaceConfig BRIMSTONE_CONFIG = makeSimpleConfig(EndBlocks.BRIMSTONE);
public static final TernarySurfaceConfig SULFURIC_ROCK_CONFIG = makeSimpleConfig(EndBlocks.SULPHURIC_ROCK.stone);
public static final SurfaceBuilder<TernarySurfaceConfig> SULPHURIC_SURFACE = register("sulphuric_surface",
new SulphuricSurfaceBuilder());
private static SurfaceBuilder<TernarySurfaceConfig> register(String name,
SurfaceBuilder<TernarySurfaceConfig> builder) {
public static final SurfaceBuilderBaseConfiguration DEFAULT_END_CONFIG = makeSimpleConfig(Blocks.END_STONE);
public static final SurfaceBuilderBaseConfiguration FLAVOLITE_CONFIG = makeSimpleConfig(EndBlocks.FLAVOLITE.stone);
public static final SurfaceBuilderBaseConfiguration BRIMSTONE_CONFIG = makeSimpleConfig(EndBlocks.BRIMSTONE);
public static final SurfaceBuilderBaseConfiguration SULFURIC_ROCK_CONFIG = makeSimpleConfig(EndBlocks.SULPHURIC_ROCK.stone);
public static final SurfaceBuilder<SurfaceBuilderBaseConfiguration> SULPHURIC_SURFACE = register("sulphuric_surface", new SulphuricSurfaceBuilder());
private static SurfaceBuilder<SurfaceBuilderBaseConfiguration> register(String name, SurfaceBuilder<SurfaceBuilderBaseConfiguration> builder) {
return Registry.register(Registry.SURFACE_BUILDER, name, builder);
}
private static TernarySurfaceConfig makeSimpleConfig(Block block) {
private static SurfaceBuilderBaseConfiguration makeSimpleConfig(Block block) {
BlockState state = block.defaultBlockState();
return new TernarySurfaceConfig(state, state, state);
}
public static void register() {
return new SurfaceBuilderBaseConfiguration(state, state, state);
}
public static void register() {}
}