Inflexia (WIP)
This commit is contained in:
parent
e32c6c76cb
commit
6c24a2022b
7 changed files with 121 additions and 69 deletions
|
@ -237,6 +237,7 @@ public class WoodenMaterial {
|
||||||
TagAPI.addTags(stairs, ItemTags.WOODEN_STAIRS, ItemTags.STAIRS);
|
TagAPI.addTags(stairs, ItemTags.WOODEN_STAIRS, ItemTags.STAIRS);
|
||||||
TagAPI.addTags(trapdoor, ItemTags.WOODEN_TRAPDOORS, ItemTags.TRAPDOORS);
|
TagAPI.addTags(trapdoor, ItemTags.WOODEN_TRAPDOORS, ItemTags.TRAPDOORS);
|
||||||
TagAPI.addTag(TagAPI.ITEM_CHEST, chest);
|
TagAPI.addTag(TagAPI.ITEM_CHEST, chest);
|
||||||
|
TagAPI.addTag(TagAPI.ITEM_WORKBENCHES, craftingTable);
|
||||||
|
|
||||||
// Block Tags //
|
// Block Tags //
|
||||||
TagAPI.addTag(BlockTags.PLANKS, planks);
|
TagAPI.addTag(BlockTags.PLANKS, planks);
|
||||||
|
@ -252,6 +253,7 @@ public class WoodenMaterial {
|
||||||
TagAPI.addTags(trapdoor, BlockTags.WOODEN_TRAPDOORS, BlockTags.TRAPDOORS);
|
TagAPI.addTags(trapdoor, BlockTags.WOODEN_TRAPDOORS, BlockTags.TRAPDOORS);
|
||||||
TagAPI.addTag(TagAPI.BLOCK_BOOKSHELVES, shelf);
|
TagAPI.addTag(TagAPI.BLOCK_BOOKSHELVES, shelf);
|
||||||
TagAPI.addTag(TagAPI.BLOCK_CHEST, chest);
|
TagAPI.addTag(TagAPI.BLOCK_CHEST, chest);
|
||||||
|
TagAPI.addTag(TagAPI.BLOCK_WORKBENCHES, craftingTable);
|
||||||
|
|
||||||
logBlockTag = TagAPI.makeBlockTag(BetterEnd.MOD_ID, name + "_logs");
|
logBlockTag = TagAPI.makeBlockTag(BetterEnd.MOD_ID, name + "_logs");
|
||||||
logItemTag = TagAPI.makeItemTag(BetterEnd.MOD_ID, name + "_logs");
|
logItemTag = TagAPI.makeItemTag(BetterEnd.MOD_ID, name + "_logs");
|
||||||
|
|
|
@ -447,6 +447,15 @@ public class EndBlocks extends BlocksRegistry {
|
||||||
public static final Block AERIDIUM = registerBlock("aeridium", new TerrainPlantBlock(RUTISCUS));
|
public static final Block AERIDIUM = registerBlock("aeridium", new TerrainPlantBlock(RUTISCUS));
|
||||||
public static final Block LUTEBUS = registerBlock("lutebus", new TerrainPlantBlock(RUTISCUS));
|
public static final Block LUTEBUS = registerBlock("lutebus", new TerrainPlantBlock(RUTISCUS));
|
||||||
public static final Block LAMELLARIUM = registerBlock("lamellarium", new TerrainPlantBlock(RUTISCUS));
|
public static final Block LAMELLARIUM = registerBlock("lamellarium", new TerrainPlantBlock(RUTISCUS));
|
||||||
|
public static final Block INFLEXIA = registerBlock(
|
||||||
|
"inflexia",
|
||||||
|
new TerrainPlantBlock(
|
||||||
|
PALLIDIUM,
|
||||||
|
PALLIDIUM_TRANSITION_1,
|
||||||
|
PALLIDIUM_TRANSITION_2,
|
||||||
|
PALLIDIUM_TRANSITION_3
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
public static final Block BLUE_VINE_SEED = registerBlock("blue_vine_seed", new BlueVineSeedBlock());
|
public static final Block BLUE_VINE_SEED = registerBlock("blue_vine_seed", new BlueVineSeedBlock());
|
||||||
public static final Block BLUE_VINE = registerEndBlockOnly("blue_vine", new BlueVineBlock());
|
public static final Block BLUE_VINE = registerEndBlockOnly("blue_vine", new BlueVineBlock());
|
||||||
|
|
|
@ -79,6 +79,7 @@ import ru.betterend.world.features.trees.PythadendronTreeFeature;
|
||||||
import ru.betterend.world.features.trees.TenaneaFeature;
|
import ru.betterend.world.features.trees.TenaneaFeature;
|
||||||
import ru.betterend.world.features.trees.UmbrellaTreeFeature;
|
import ru.betterend.world.features.trees.UmbrellaTreeFeature;
|
||||||
import ru.betterend.world.generator.GeneratorOptions;
|
import ru.betterend.world.generator.GeneratorOptions;
|
||||||
|
import ru.betterend.world.surface.UmbraSurfaceBuilder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
@ -303,6 +304,7 @@ public class EndFeatures {
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
//public static final BCLFeature PEARLBERRY = redisterVegetation("pearlberry", new SinglePlantFeature(EndBlocks.PEARLBERRY, 5, 5), 1);
|
//public static final BCLFeature PEARLBERRY = redisterVegetation("pearlberry", new SinglePlantFeature(EndBlocks.PEARLBERRY, 5, 5), 1);
|
||||||
|
public static final BCLFeature INFLEXIA = redisterVegetation("inflexia", new SinglePlantFeature(EndBlocks.INFLEXIA, 5, 3), 8);
|
||||||
|
|
||||||
// Vines //
|
// Vines //
|
||||||
public static final BCLFeature DENSE_VINE = redisterVegetation(
|
public static final BCLFeature DENSE_VINE = redisterVegetation(
|
||||||
|
@ -519,7 +521,13 @@ public class EndFeatures {
|
||||||
BetterEnd.makeID("tunel_cave"),
|
BetterEnd.makeID("tunel_cave"),
|
||||||
new TunelCaveFeature()
|
new TunelCaveFeature()
|
||||||
);
|
);
|
||||||
public static final BCLFeature UMBRALITH_ARCH = registerChanced("umbralith_arch", new ArchFeature(EndBlocks.UMBRALITH.stone), 10);
|
public static final BCLFeature UMBRALITH_ARCH = registerChanced(
|
||||||
|
"umbralith_arch",
|
||||||
|
new ArchFeature(
|
||||||
|
EndBlocks.UMBRALITH.stone,
|
||||||
|
UmbraSurfaceBuilder::getSurfaceState
|
||||||
|
),
|
||||||
|
10);
|
||||||
public static final BCLFeature THIN_UMBRALITH_ARCH = registerChanced("thin_umbralith_arch", new ThinArchFeature(EndBlocks.UMBRALITH.stone), 15);
|
public static final BCLFeature THIN_UMBRALITH_ARCH = registerChanced("thin_umbralith_arch", new ThinArchFeature(EndBlocks.UMBRALITH.stone), 15);
|
||||||
|
|
||||||
// Ores //
|
// Ores //
|
||||||
|
|
|
@ -8,14 +8,14 @@ import ru.betterend.world.surface.SurfaceBuilders;
|
||||||
|
|
||||||
public class UmbraValleyBiome extends EndBiome {
|
public class UmbraValleyBiome extends EndBiome {
|
||||||
public UmbraValleyBiome() {
|
public UmbraValleyBiome() {
|
||||||
super(
|
super(new BCLBiomeDef(BetterEnd.makeID("umbra_valley"))
|
||||||
new BCLBiomeDef(BetterEnd.makeID("umbra_valley"))
|
.setFogColor(100, 100, 100)
|
||||||
.setFogColor(100, 100, 100)
|
.setPlantsColor(200, 200, 200)
|
||||||
.setPlantsColor(200, 200, 200)
|
.setWaterAndFogColor(69, 104, 134)
|
||||||
.setWaterAndFogColor(69, 104, 134)
|
.setSurface(SurfaceBuilders.UMBRA_SURFACE.configured(SurfaceBuilders.DEFAULT_END_CONFIG))
|
||||||
.setSurface(SurfaceBuilders.UMBRA_SURFACE.configured(SurfaceBuilders.DEFAULT_END_CONFIG))
|
.addFeature(EndFeatures.UMBRALITH_ARCH)
|
||||||
.addFeature(EndFeatures.UMBRALITH_ARCH)
|
.addFeature(EndFeatures.THIN_UMBRALITH_ARCH)
|
||||||
.addFeature(EndFeatures.THIN_UMBRALITH_ARCH)
|
.addFeature(EndFeatures.INFLEXIA)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
package ru.betterend.world.features.terrain;
|
package ru.betterend.world.features.terrain;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.block.Block;
|
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.feature.FeaturePlaceContext;
|
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
|
import net.minecraft.world.level.levelgen.surfacebuilders.ConfiguredSurfaceBuilder;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
|
@ -17,49 +21,69 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.bclib.world.features.DefaultFeature;
|
import ru.bclib.world.features.DefaultFeature;
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class ArchFeature extends DefaultFeature {
|
public class ArchFeature extends DefaultFeature {
|
||||||
private Block block;
|
private Function<BlockPos, BlockState> surfaceFunction;
|
||||||
|
private Block block;
|
||||||
|
|
||||||
public ArchFeature(Block block) {
|
public ArchFeature(Block block, Function<BlockPos, BlockState> surfaceFunction) {
|
||||||
this.block = block;
|
this.surfaceFunction = surfaceFunction;
|
||||||
}
|
this.block = block;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featurePlaceContext) {
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featurePlaceContext) {
|
||||||
final WorldGenLevel world = featurePlaceContext.level();
|
final WorldGenLevel world = featurePlaceContext.level();
|
||||||
BlockPos origin = featurePlaceContext.origin();
|
BlockPos origin = featurePlaceContext.origin();
|
||||||
Random random = featurePlaceContext.random();
|
Random random = featurePlaceContext.random();
|
||||||
|
|
||||||
BlockPos pos = getPosOnSurfaceWG(world, new BlockPos((origin.getX() & 0xFFFFFFF0) | 7, 0, (origin.getZ() & 0xFFFFFFF0) | 7));
|
BlockPos pos = getPosOnSurfaceWG(
|
||||||
if (!world.getBlockState(pos.below(5)).is(TagAPI.BLOCK_GEN_TERRAIN)) {
|
world,
|
||||||
return false;
|
new BlockPos((origin.getX() & 0xFFFFFFF0) | 7, 0, (origin.getZ() & 0xFFFFFFF0) | 7)
|
||||||
}
|
);
|
||||||
|
if (!world.getBlockState(pos.below(5)).is(TagAPI.BLOCK_GEN_TERRAIN)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
float bigRadius = MHelper.randRange(10F, 20F, random);
|
float bigRadius = MHelper.randRange(10F, 20F, random);
|
||||||
float smallRadius = MHelper.randRange(3F, 7F, random);
|
float smallRadius = MHelper.randRange(3F, 7F, random);
|
||||||
if (smallRadius + bigRadius > 23) {
|
if (smallRadius + bigRadius > 23) {
|
||||||
smallRadius = 23 - bigRadius;
|
smallRadius = 23 - bigRadius;
|
||||||
}
|
}
|
||||||
SDF arch = new SDFTorus().setBigRadius(bigRadius).setSmallRadius(smallRadius).setBlock(block);
|
SDF arch = new SDFTorus().setBigRadius(bigRadius).setSmallRadius(smallRadius).setBlock(block);
|
||||||
arch = new SDFRotation().setRotation(MHelper.randomHorizontal(random), (float) Math.PI * 0.5F).setSource(arch);
|
arch = new SDFRotation().setRotation(MHelper.randomHorizontal(random), (float) Math.PI * 0.5F).setSource(arch);
|
||||||
|
|
||||||
final float smallRadiusF = smallRadius;
|
final float smallRadiusF = smallRadius;
|
||||||
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
|
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
|
||||||
arch = new SDFDisplacement().setFunction((vec) -> {
|
arch = new SDFDisplacement().setFunction((vec) -> {
|
||||||
return (float) (Math.abs(noise.eval(
|
return (float) (Math.abs(noise.eval(vec.x() * 0.1,
|
||||||
vec.x() * 0.1,
|
vec.y() * 0.1,
|
||||||
vec.y() * 0.1,
|
vec.z() * 0.1
|
||||||
vec.z() * 0.1
|
)) * 3F + Math.abs(noise.eval(
|
||||||
)) * 3F + Math.abs(noise.eval(vec.x() * 0.3, vec.y() * 0.3 + 100, vec.z() * 0.3)) * 1.3F) - smallRadiusF * Math.abs(1 - vec.y() / bigRadius);
|
vec.x() * 0.3,
|
||||||
}).setSource(arch);
|
vec.y() * 0.3 + 100,
|
||||||
|
vec.z() * 0.3
|
||||||
|
)) * 1.3F) - smallRadiusF * Math.abs(1 - vec.y() / bigRadius);
|
||||||
|
}).setSource(arch);
|
||||||
|
|
||||||
float side = (bigRadius + smallRadius + 3F) * 2;
|
List<BlockPos> surface = Lists.newArrayList();
|
||||||
if (side > 47) {
|
arch.addPostProcess((info) -> {
|
||||||
side = 47;
|
if (info.getStateUp().isAir()) {
|
||||||
}
|
return surfaceFunction.apply(info.getPos());
|
||||||
arch.fillArea(world, pos, AABB.ofSize(Vec3.atCenterOf(pos), side, side, side));
|
}
|
||||||
return true;
|
return info.getState();
|
||||||
}
|
});
|
||||||
|
|
||||||
|
float side = (bigRadius + smallRadius + 3F) * 2;
|
||||||
|
if (side > 47) {
|
||||||
|
side = 47;
|
||||||
|
}
|
||||||
|
arch.fillArea(world, pos, AABB.ofSize(Vec3.atCenterOf(pos), side, side, side));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package ru.betterend.world.surface;
|
package ru.betterend.world.surface;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilder;
|
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilder;
|
||||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderBaseConfiguration;
|
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderBaseConfiguration;
|
||||||
|
import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -19,23 +21,30 @@ public class UmbraSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderBaseConfig
|
||||||
@Override
|
@Override
|
||||||
public void apply(Random random, ChunkAccess chunk, Biome biome, int x, int z, int height, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, int seed, long n, SurfaceBuilderBaseConfiguration surfaceBlocks) {
|
public void apply(Random random, ChunkAccess chunk, Biome biome, int x, int z, int height, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, int seed, long n, SurfaceBuilderBaseConfiguration surfaceBlocks) {
|
||||||
int depth = (int) (NOISE.eval(x * 0.1, z * 0.1) * 20 + NOISE.eval(x * 0.5, z * 0.5) * 10 + 60);
|
int depth = (int) (NOISE.eval(x * 0.1, z * 0.1) * 20 + NOISE.eval(x * 0.5, z * 0.5) * 10 + 60);
|
||||||
float grass = ((float) NOISE.eval(x * 0.03, z * 0.03) + (float) NOISE.eval(x * 0.1, z * 0.1) * 0.6F + random.nextFloat() * 0.2F) - 0.05F;
|
SurfaceBuilderBaseConfiguration config = getConfig(x, z, random);
|
||||||
SurfaceBuilderBaseConfiguration config = null;
|
|
||||||
if (grass > 0.3F) {
|
|
||||||
config = SurfaceBuilders.PALLIDIUM_SURFACE_CONFIG;
|
|
||||||
}
|
|
||||||
else if (grass > 0.1F) {
|
|
||||||
config = SurfaceBuilders.PALLIDIUM_T1_SURFACE_CONFIG;
|
|
||||||
}
|
|
||||||
else if (grass > -0.1) {
|
|
||||||
config = SurfaceBuilders.PALLIDIUM_T2_SURFACE_CONFIG;
|
|
||||||
}
|
|
||||||
else if (grass > -0.3F) {
|
|
||||||
config = SurfaceBuilders.PALLIDIUM_T3_SURFACE_CONFIG;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
config = SurfaceBuilders.UMBRA_SURFACE_CONFIG;
|
|
||||||
}
|
|
||||||
SurfaceBuilder.DEFAULT.apply(random, chunk, biome, x, z, height, noise + depth, defaultBlock, defaultFluid, seaLevel, seed, n, config);
|
SurfaceBuilder.DEFAULT.apply(random, chunk, biome, x, z, height, noise + depth, defaultBlock, defaultFluid, seaLevel, seed, n, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BlockState getSurfaceState(BlockPos pos) {
|
||||||
|
return getConfig(pos.getX(), pos.getZ(), MHelper.RANDOM).getTopMaterial();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SurfaceBuilderBaseConfiguration getConfig(int x, int z, Random random) {
|
||||||
|
float grass = ((float) NOISE.eval(x * 0.03, z * 0.03) + (float) NOISE.eval(x * 0.1, z * 0.1) * 0.6F + random.nextFloat() * 0.2F) - 0.05F;
|
||||||
|
if (grass > 0.3F) {
|
||||||
|
return SurfaceBuilders.PALLIDIUM_SURFACE_CONFIG;
|
||||||
|
}
|
||||||
|
else if (grass > 0.1F) {
|
||||||
|
return SurfaceBuilders.PALLIDIUM_T1_SURFACE_CONFIG;
|
||||||
|
}
|
||||||
|
else if (grass > -0.1) {
|
||||||
|
return SurfaceBuilders.PALLIDIUM_T2_SURFACE_CONFIG;
|
||||||
|
}
|
||||||
|
else if (grass > -0.3F) {
|
||||||
|
return SurfaceBuilders.PALLIDIUM_T3_SURFACE_CONFIG;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return SurfaceBuilders.UMBRA_SURFACE_CONFIG;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
BIN
src/main/resources/assets/betterend/textures/block/inflexia.png
Normal file
BIN
src/main/resources/assets/betterend/textures/block/inflexia.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 210 B |
Loading…
Add table
Add a link
Reference in a new issue