New terrain, render fixes
This commit is contained in:
parent
36ea4b8726
commit
2061a12aff
25 changed files with 147 additions and 41 deletions
|
@ -32,6 +32,7 @@ import net.minecraft.world.gen.surfacebuilder.TernarySurfaceConfig;
|
|||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.world.features.EndFeature;
|
||||
import ru.betterend.world.surface.DoubleBlockSurfaceBuilder;
|
||||
|
||||
public class BiomeDefinition {
|
||||
private final List<ConfiguredStructureFeature<?, ?>> structures = Lists.newArrayList();
|
||||
|
@ -65,6 +66,21 @@ public class BiomeDefinition {
|
|||
));
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setSurface(Block surfaceBlock1, Block surfaceBlock2) {
|
||||
this.surface = DoubleBlockSurfaceBuilder.INSTANCE.setConfigUpper(new TernarySurfaceConfig(
|
||||
surfaceBlock1.getDefaultState(),
|
||||
Blocks.END_STONE.getDefaultState(),
|
||||
Blocks.END_STONE.getDefaultState()
|
||||
)).setConfigLower(new TernarySurfaceConfig(
|
||||
surfaceBlock2.getDefaultState(),
|
||||
Blocks.END_STONE.getDefaultState(),
|
||||
Blocks.END_STONE.getDefaultState()
|
||||
)).method_30478(new TernarySurfaceConfig(surfaceBlock1.getDefaultState(),
|
||||
Blocks.END_STONE.getDefaultState(),
|
||||
Blocks.END_STONE.getDefaultState()));
|
||||
return this;
|
||||
}
|
||||
|
||||
public BiomeDefinition setParticleConfig(BiomeParticleConfig config) {
|
||||
this.particleConfig = config;
|
||||
|
|
|
@ -12,7 +12,7 @@ public class BiomeFoggyMushroomland extends EndBiome {
|
|||
.setFogDensity(3)
|
||||
.setWaterColor(119, 227, 250)
|
||||
.setWaterFogColor(119, 227, 250)
|
||||
.setSurface(BlockRegistry.WET_MYCELIUM)
|
||||
.setSurface(BlockRegistry.END_MOSS, BlockRegistry.END_MYCELIUM)
|
||||
.addFeature(FeatureRegistry.STONE_SPIRAL)
|
||||
.addFeature(Feature.LAKES, ConfiguredFeatures.LAKE_WATER));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package ru.betterend.world.surface;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
|
||||
import net.minecraft.world.gen.surfacebuilder.TernarySurfaceConfig;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
||||
public class DoubleBlockSurfaceBuilder extends SurfaceBuilder<TernarySurfaceConfig> {
|
||||
public static final DoubleBlockSurfaceBuilder INSTANCE = new DoubleBlockSurfaceBuilder(TernarySurfaceConfig.CODEC);
|
||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(4141);
|
||||
private TernarySurfaceConfig config1;
|
||||
private TernarySurfaceConfig config2;
|
||||
|
||||
public DoubleBlockSurfaceBuilder(Codec<TernarySurfaceConfig> codec) {
|
||||
super(codec);
|
||||
}
|
||||
|
||||
public DoubleBlockSurfaceBuilder setConfigUpper(TernarySurfaceConfig config) {
|
||||
config1 = config;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DoubleBlockSurfaceBuilder setConfigLower(TernarySurfaceConfig config) {
|
||||
config2 = config;
|
||||
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) {
|
||||
noise = NOISE.eval(x * 0.1, z * 0.1);
|
||||
SurfaceBuilder.DEFAULT.generate(random, chunk, biome, x, z, height, noise, defaultBlock, defaultFluid, seaLevel, seed, noise > 0 ? config1 : config2);
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
Registry.register(Registry.SURFACE_BUILDER, "double_block_surface_builder", INSTANCE);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue