Neon oasis enhancements

This commit is contained in:
paulevsGitch 2021-04-21 19:27:49 +03:00
parent b6f6541e94
commit e6c411d6a1
9 changed files with 266 additions and 42 deletions

View file

@ -44,13 +44,7 @@ public class NeonCactusBlock extends BlockBaseNotFull implements SimpleWaterlogg
private static final EnumMap<Axis, VoxelShape> SMALL_SHAPES = Maps.newEnumMap(Axis.class);
public NeonCactusBlock() {
super(FabricBlockSettings.copyOf(Blocks.CACTUS).luminance(state -> {
TripleShape shape = state.getValue(SHAPE);
if (shape == TripleShape.TOP) {
return 15;
}
return shape == TripleShape.MIDDLE ? 13 : 10;
}));
super(FabricBlockSettings.copyOf(Blocks.CACTUS).luminance(15));
registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false).setValue(FACING, Direction.UP).setValue(SHAPE, TripleShape.TOP));
}

View file

@ -2,6 +2,7 @@ package ru.betterend.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.components.ImageButton;

View file

@ -43,6 +43,7 @@ import ru.betterend.world.features.bushes.LargeAmaranitaFeature;
import ru.betterend.world.features.bushes.Lumecorn;
import ru.betterend.world.features.bushes.TenaneaBushFeature;
import ru.betterend.world.features.terrain.BigAuroraCrystalFeature;
import ru.betterend.world.features.terrain.DesertLakeFeature;
import ru.betterend.world.features.terrain.EndLakeFeature;
import ru.betterend.world.features.terrain.FallenPillarFeature;
import ru.betterend.world.features.terrain.FloatingSpireFeature;
@ -186,6 +187,7 @@ public class EndFeatures {
public static final EndFeature END_LAKE = EndFeature.makeLakeFeature("end_lake", new EndLakeFeature(), 4);
public static final EndFeature END_LAKE_NORMAL = EndFeature.makeLakeFeature("end_lake_normal", new EndLakeFeature(), 20);
public static final EndFeature END_LAKE_RARE = EndFeature.makeLakeFeature("end_lake_rare", new EndLakeFeature(), 40);
public static final EndFeature DESERT_LAKE = EndFeature.makeLakeFeature("desert_lake", new DesertLakeFeature(), 8);
public static final EndFeature ROUND_CAVE = EndFeature.makeRawGenFeature("round_cave", new RoundCaveFeature(), 2);
public static final EndFeature SPIRE = EndFeature.makeRawGenFeature("spire", new SpireFeature(), 2);
public static final EndFeature FLOATING_SPIRE = EndFeature.makeRawGenFeature("floating_spire", new FloatingSpireFeature(), 8);

View file

@ -15,6 +15,7 @@ public class DustWastelandsBiome extends EndBiome {
.setFogDensity(2)
.setWaterAndFogColor(192, 180, 131)
.setSurface(EndBlocks.ENDSTONE_DUST)
.setDepth(1.5F)
.setParticles(ParticleTypes.WHITE_ASH, 0.01F)
.setLoop(EndSounds.AMBIENT_DUST_WASTELANDS)
.setMusic(EndSounds.MUSIC_OPENSPACE)

View file

@ -15,12 +15,15 @@ public class NeonOasisBiome extends EndBiome {
.setGenChance(0.5F)
.setFogColor(226, 239, 168)
.setFogDensity(2)
.setWaterAndFogColor(192, 180, 131)
.setWaterAndFogColor(106, 238, 215)
.setSurface(EndBlocks.ENDSTONE_DUST, EndBlocks.END_MOSS)
.setParticles(ParticleTypes.WHITE_ASH, 0.01F)
.setLoop(EndSounds.AMBIENT_DUST_WASTELANDS)
.setMusic(EndSounds.MUSIC_OPENSPACE)
.addFeature(EndFeatures.DESERT_LAKE)
.addFeature(EndFeatures.NEON_CACTUS)
.addFeature(EndFeatures.UMBRELLA_MOSS)
.addFeature(EndFeatures.CREEPING_MOSS)
.addStructureFeature(StructureFeatures.END_CITY)
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 2));
}

View file

@ -0,0 +1,210 @@
package ru.betterend.world.features.terrain;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Material;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.world.features.DefaultFeature;
public class DesertLakeFeature extends DefaultFeature {
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
private static final MutableBlockPos POS = new MutableBlockPos();
@Override
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, NoneFeatureConfiguration featureConfig) {
double radius = MHelper.randRange(8.0, 15.0, random);
double depth = radius * 0.5 * MHelper.randRange(0.8, 1.2, random);
int dist = MHelper.floor(radius);
int dist2 = MHelper.floor(radius * 1.5);
int bott = MHelper.floor(depth);
blockPos = getPosOnSurfaceWG(world, blockPos);
if (blockPos.getY() < 10) return false;
int waterLevel = blockPos.getY();
BlockPos pos = getPosOnSurfaceRaycast(world, blockPos.north(dist).above(10), 20);
if (Math.abs(blockPos.getY() - pos.getY()) > 5) return false;
waterLevel = MHelper.min(pos.getY(), waterLevel);
pos = getPosOnSurfaceRaycast(world, blockPos.south(dist).above(10), 20);
if (Math.abs(blockPos.getY() - pos.getY()) > 5) return false;
waterLevel = MHelper.min(pos.getY(), waterLevel);
pos = getPosOnSurfaceRaycast(world, blockPos.east(dist).above(10), 20);
if (Math.abs(blockPos.getY() - pos.getY()) > 5) return false;
waterLevel = MHelper.min(pos.getY(), waterLevel);
pos = getPosOnSurfaceRaycast(world, blockPos.west(dist).above(10), 20);
if (Math.abs(blockPos.getY() - pos.getY()) > 5) return false;
waterLevel = MHelper.min(pos.getY(), waterLevel);
BlockState state;
int minX = blockPos.getX() - dist2;
int maxX = blockPos.getX() + dist2;
int minZ = blockPos.getZ() - dist2;
int maxZ = blockPos.getZ() + dist2;
int maskMinX = minX - 1;
int maskMinZ = minZ - 1;
boolean[][] mask = new boolean[maxX - minX + 3][maxZ - minZ + 3];
for (int x = minX; x <= maxX; x++) {
POS.setX(x);
int mx = x - maskMinX;
for (int z = minZ; z <= maxZ; z++) {
POS.setZ(z);
int mz = z - maskMinZ;
if (!mask[mx][mz]) {
for (int y = waterLevel + 1; y <= waterLevel + 20; y++) {
POS.setY(y);
FluidState fluid = world.getFluidState(POS);
if (!fluid.isEmpty()) {
for (int i = -1; i < 2; i++) {
int px = mx + i;
for (int j = -1; j < 2; j++) {
int pz = mz + j;
mask[px][pz] = true;
}
}
break;
}
}
}
}
}
for (int x = minX; x <= maxX; x++) {
POS.setX(x);
int x2 = x - blockPos.getX();
x2 *= x2;
int mx = x - maskMinX;
for (int z = minZ; z <= maxZ; z++) {
POS.setZ(z);
int z2 = z - blockPos.getZ();
z2 *= z2;
int mz = z - maskMinZ;
if (!mask[mx][mz]) {
double size = 1;
for (int y = blockPos.getY(); y <= blockPos.getY() + 20; y++) {
POS.setY(y);
double add = y - blockPos.getY();
if (add > 5) {
size *= 0.8;
add = 5;
}
double r = (add * 1.8 + radius * (NOISE.eval(x * 0.2, y * 0.2, z * 0.2) * 0.25 + 0.75)) - 1.0 / size;
if (r > 0) {
r *= r;
if (x2 + z2 <= r) {
state = world.getBlockState(POS);
if (state.is(EndTags.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, POS, AIR);
}
pos = POS.below();
if (world.getBlockState(pos).is(EndTags.GEN_TERRAIN)) {
state = world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
if (y > waterLevel + 1)
BlocksHelper.setWithoutUpdate(world, pos, state);
else if (y > waterLevel)
BlocksHelper.setWithoutUpdate(world, pos, random.nextBoolean() ? state : EndBlocks.ENDSTONE_DUST.defaultBlockState());
else
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.defaultBlockState());
}
}
}
else {
break;
}
}
}
}
}
double aspect = ((double) radius / (double) depth);
for (int x = blockPos.getX() - dist; x <= blockPos.getX() + dist; x++) {
POS.setX(x);
int x2 = x - blockPos.getX();
x2 *= x2;
int mx = x - maskMinX;
for (int z = blockPos.getZ() - dist; z <= blockPos.getZ() + dist; z++) {
POS.setZ(z);
int z2 = z - blockPos.getZ();
z2 *= z2;
int mz = z - maskMinZ;
if (!mask[mx][mz]) {
for (int y = blockPos.getY() - bott; y < blockPos.getY(); y++) {
POS.setY(y);
double y2 = (double) (y - blockPos.getY()) * aspect;
y2 *= y2;
double r = radius * (NOISE.eval(x * 0.2, y * 0.2, z * 0.2) * 0.25 + 0.75);
double rb = r * 1.2;
r *= r;
rb *= rb;
if (y2 + x2 + z2 <= r) {
state = world.getBlockState(POS);
if (canReplace(state)) {
state = world.getBlockState(POS.above());
state = canReplace(state) ? (y < waterLevel ? WATER : AIR) : state;
BlocksHelper.setWithoutUpdate(world, POS, state);
}
pos = POS.below();
if (world.getBlockState(pos).getBlock().is(EndTags.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.defaultBlockState());
}
pos = POS.above();
while (canReplace(state = world.getBlockState(pos)) && !state.isAir() && state.getFluidState().isEmpty()) {
BlocksHelper.setWithoutUpdate(world, pos, pos.getY() < waterLevel ? WATER : AIR);
pos = pos.above();
}
}
// Make border
else if (y2 + x2 + z2 <= rb) {
state = world.getBlockState(POS);
if (state.is(EndTags.GEN_TERRAIN) && world.isEmptyBlock(POS.above())) {
BlocksHelper.setWithoutUpdate(world, POS, EndBlocks.END_MOSS);
}
else if (y < waterLevel) {
if (world.isEmptyBlock(POS.above())) {
state = world.getBiome(POS).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
BlocksHelper.setWithoutUpdate(world, POS, random.nextBoolean() ? state : EndBlocks.ENDSTONE_DUST.defaultBlockState());
BlocksHelper.setWithoutUpdate(world, POS.below(), END_STONE);
}
else {
BlocksHelper.setWithoutUpdate(world, POS, EndBlocks.ENDSTONE_DUST.defaultBlockState());
BlocksHelper.setWithoutUpdate(world, POS.below(), END_STONE);
}
}
}
}
}
}
}
BlocksHelper.fixBlocks(world, new BlockPos(minX - 2, waterLevel - 2, minZ - 2), new BlockPos(maxX + 2, blockPos.getY() + 20, maxZ + 2));
return true;
}
private boolean canReplace(BlockState state) {
return state.getMaterial().isReplaceable()
|| state.is(EndTags.GEN_TERRAIN)
|| state.is(EndBlocks.ENDSTONE_DUST)
|| state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.WATER_PLANT)
|| state.getMaterial().equals(Material.CORAL);
}
}

View file

@ -24,37 +24,32 @@ public class EndLakeFeature extends DefaultFeature {
private static final MutableBlockPos POS = new MutableBlockPos();
@Override
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos,
NoneFeatureConfiguration featureConfig) {
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, NoneFeatureConfiguration featureConfig) {
double radius = MHelper.randRange(10.0, 20.0, random);
double depth = radius * 0.5 * MHelper.randRange(0.8, 1.2, random);
int dist = MHelper.floor(radius);
int dist2 = MHelper.floor(radius * 1.5);
int bott = MHelper.floor(depth);
blockPos = getPosOnSurfaceWG(world, blockPos);
if (blockPos.getY() < 10)
return false;
if (blockPos.getY() < 10) return false;
int waterLevel = blockPos.getY();
BlockPos pos = getPosOnSurfaceRaycast(world, blockPos.north(dist).above(10), 20);
if (Math.abs(blockPos.getY() - pos.getY()) > 5)
return false;
if (Math.abs(blockPos.getY() - pos.getY()) > 5) return false;
waterLevel = MHelper.min(pos.getY(), waterLevel);
pos = getPosOnSurfaceRaycast(world, blockPos.south(dist).above(10), 20);
if (Math.abs(blockPos.getY() - pos.getY()) > 5)
return false;
if (Math.abs(blockPos.getY() - pos.getY()) > 5) return false;
waterLevel = MHelper.min(pos.getY(), waterLevel);
pos = getPosOnSurfaceRaycast(world, blockPos.east(dist).above(10), 20);
if (Math.abs(blockPos.getY() - pos.getY()) > 5)
return false;
if (Math.abs(blockPos.getY() - pos.getY()) > 5) return false;
waterLevel = MHelper.min(pos.getY(), waterLevel);
pos = getPosOnSurfaceRaycast(world, blockPos.west(dist).above(10), 20);
if (Math.abs(blockPos.getY() - pos.getY()) > 5)
return false;
if (Math.abs(blockPos.getY() - pos.getY()) > 5) return false;
waterLevel = MHelper.min(pos.getY(), waterLevel);
BlockState state;
@ -110,8 +105,7 @@ public class EndLakeFeature extends DefaultFeature {
size *= 0.8;
add = 5;
}
double r = (add * 1.8 + radius * (NOISE.eval(x * 0.2, y * 0.2, z * 0.2) * 0.25 + 0.75))
- 1.0 / size;
double r = (add * 1.8 + radius * (NOISE.eval(x * 0.2, y * 0.2, z * 0.2) * 0.25 + 0.75)) - 1.0 / size;
if (r > 0) {
r *= r;
if (x2 + z2 <= r) {
@ -121,19 +115,17 @@ public class EndLakeFeature extends DefaultFeature {
}
pos = POS.below();
if (world.getBlockState(pos).is(EndTags.GEN_TERRAIN)) {
state = world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig()
.getTopMaterial();
state = world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
if (y > waterLevel + 1)
BlocksHelper.setWithoutUpdate(world, pos, state);
else if (y > waterLevel)
BlocksHelper.setWithoutUpdate(world, pos, random.nextBoolean() ? state
: EndBlocks.ENDSTONE_DUST.defaultBlockState());
BlocksHelper.setWithoutUpdate(world, pos, random.nextBoolean() ? state : EndBlocks.ENDSTONE_DUST.defaultBlockState());
else
BlocksHelper.setWithoutUpdate(world, pos,
EndBlocks.ENDSTONE_DUST.defaultBlockState());
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.defaultBlockState());
}
}
} else {
}
else {
break;
}
}
@ -174,8 +166,7 @@ public class EndLakeFeature extends DefaultFeature {
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.defaultBlockState());
}
pos = POS.above();
while (canReplace(state = world.getBlockState(pos)) && !state.isAir()
&& state.getFluidState().isEmpty()) {
while (canReplace(state = world.getBlockState(pos)) && !state.isAir() && state.getFluidState().isEmpty()) {
BlocksHelper.setWithoutUpdate(world, pos, pos.getY() < waterLevel ? WATER : AIR);
pos = pos.above();
}
@ -183,31 +174,31 @@ public class EndLakeFeature extends DefaultFeature {
// Make border
else if (y < waterLevel && y2 + x2 + z2 <= rb) {
if (world.isEmptyBlock(POS.above())) {
state = world.getBiome(POS).getGenerationSettings().getSurfaceBuilderConfig()
.getTopMaterial();
BlocksHelper.setWithoutUpdate(world, POS,
random.nextBoolean() ? state : EndBlocks.ENDSTONE_DUST.defaultBlockState());
state = world.getBiome(POS).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
BlocksHelper.setWithoutUpdate(world, POS, random.nextBoolean() ? state : EndBlocks.ENDSTONE_DUST.defaultBlockState());
BlocksHelper.setWithoutUpdate(world, POS.below(), END_STONE);
} else {
}
else {
BlocksHelper.setWithoutUpdate(world, POS, EndBlocks.ENDSTONE_DUST.defaultBlockState());
BlocksHelper.setWithoutUpdate(world, POS.below(), END_STONE);
}
// }
}
}
}
}
}
BlocksHelper.fixBlocks(world, new BlockPos(minX - 2, waterLevel - 2, minZ - 2),
new BlockPos(maxX + 2, blockPos.getY() + 20, maxZ + 2));
BlocksHelper.fixBlocks(world, new BlockPos(minX - 2, waterLevel - 2, minZ - 2), new BlockPos(maxX + 2, blockPos.getY() + 20, maxZ + 2));
return true;
}
private boolean canReplace(BlockState state) {
return state.getMaterial().isReplaceable() || state.is(EndTags.GEN_TERRAIN) || state.is(EndBlocks.ENDSTONE_DUST)
|| state.getMaterial().equals(Material.PLANT) || state.getMaterial().equals(Material.WATER_PLANT)
return state.getMaterial().isReplaceable()
|| state.is(EndTags.GEN_TERRAIN)
|| state.is(EndBlocks.ENDSTONE_DUST)
|| state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.WATER_PLANT)
|| state.getMaterial().equals(Material.CORAL);
}
}